From patchwork Fri Sep 10 18:38:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 1526584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=aurel32.net header.i=@aurel32.net header.a=rsa-sha256 header.s=202004.hall header.b=wQnHrWVo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H5l4v73z6z9sVq for ; Sat, 11 Sep 2021 04:38:39 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7253D384A8B1 for ; Fri, 10 Sep 2021 18:38:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id 3A8573858D29 for ; Fri, 10 Sep 2021 18:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A8573858D29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Content-Type:From:Reply-To:Subject:Content-ID: Content-Description:In-Reply-To:References:X-Debbugs-Cc; bh=hkDoOHd9XD4GRq/8bfpFYo9BXUt+6yrl9E0ACL5/kmE=; b=wQnHrWVoOskgLHeT6M3tS4y9Rx Tk3YOl4O6uZRmNRzZLU8fK+dJmhLQGQiD1mYOCIs9HU3jcemT/zLpOASdGN2LLpPe5242AOiGj3mw HOOPSoBgbSWzj6UcjVvqZtEOBi5pd8hKT/XBMyJBlmvPuiQ0RbsT7Y51utHOtbSqXgozvhFIcaVD3 rZgT7O6Ia8IK8OgknOCd/Yv95gG2FCbCeP+j4V8DOBRyToSAGurJj/y71z0ADxxvAEQVsSqqAvYtH wIuBDtVAd1pYwhfXHHaQeit3U7r3BeLHn0VvLgBEcgu2jSJ43Ue/qAkzoGhT1d4l9G3/iuBxz4a7Z VCQ3Pznw==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOlPu-0004Q3-La; Fri, 10 Sep 2021 20:38:26 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.94.2) (envelope-from ) id 1mOlPu-0067YS-3G; Fri, 10 Sep 2021 20:38:26 +0200 From: Aurelien Jarno To: libc-alpha@sourceware.org Subject: [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476] Date: Fri, 10 Sep 2021 20:38:22 +0200 Message-Id: <20210910183822.1458644-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aurelien Jarno Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" There is a GNU extension that allows to call getcwd(NULL, >0). It is described in the documentation, but also directly in the unistd.h header, just above the declaration. Therefore the attribute access mode added in commit 06febd8c6705 is not correct. Drop it. Reviewed-by: Florian Weimer --- posix/bits/unistd.h | 5 ++--- posix/unistd.h | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) Note: I am aware of BZ #26545, however while it is being discussed, the bug is still there, so I don't think we should block on a decision to fix it. diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index f0831386c7..622adeb2b2 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -199,10 +199,9 @@ __NTH (readlinkat (int __fd, const char *__restrict __path, #endif extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) - __THROW __wur __attr_access ((__write_only__, 1, 2)); + __THROW __wur; extern char *__REDIRECT_NTH (__getcwd_alias, - (char *__buf, size_t __size), getcwd) - __wur __attr_access ((__write_only__, 1, 2)); + (char *__buf, size_t __size), getcwd) __wur; extern char *__REDIRECT_NTH (__getcwd_chk_warn, (char *__buf, size_t __size, size_t __buflen), __getcwd_chk) diff --git a/posix/unistd.h b/posix/unistd.h index 3dca65732f..8224c5fbc9 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -528,8 +528,7 @@ extern int fchdir (int __fd) __THROW __wur; an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ -extern char *getcwd (char *__buf, size_t __size) __THROW __wur - __attr_access ((__write_only__, 1, 2)); +extern char *getcwd (char *__buf, size_t __size) __THROW __wur; #ifdef __USE_GNU /* Return a malloc'd string containing the current directory name.