* [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476]
@ 2021-09-10 18:38 Aurelien Jarno
2021-09-14 14:06 ` Aurelien Jarno
2021-09-16 8:28 ` Florian Weimer via Libc-alpha
0 siblings, 2 replies; 3+ messages in thread
From: Aurelien Jarno @ 2021-09-10 18:38 UTC (permalink / raw)
To: libc-alpha; +Cc: Aurelien Jarno
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.
---
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.
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476]
2021-09-10 18:38 [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476] Aurelien Jarno
@ 2021-09-14 14:06 ` Aurelien Jarno
2021-09-16 8:28 ` Florian Weimer via Libc-alpha
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2021-09-14 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Florian Weimer
Any opinion about that patch? Florian maybe given you have reviewed v1?
Thanks
Aurelien
On 2021-09-10 20:38, Aurelien Jarno wrote:
> 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.
> ---
> 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.
> --
> 2.30.2
>
>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476]
2021-09-10 18:38 [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476] Aurelien Jarno
2021-09-14 14:06 ` Aurelien Jarno
@ 2021-09-16 8:28 ` Florian Weimer via Libc-alpha
1 sibling, 0 replies; 3+ messages in thread
From: Florian Weimer via Libc-alpha @ 2021-09-16 8:28 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: libc-alpha
* Aurelien Jarno:
> 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.
> ---
> 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.
This looks okay to me, thanks.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-16 8:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 18:38 [PATCH v2] posix: Fix attribute access mode on getcwd [BZ #27476] Aurelien Jarno
2021-09-14 14:06 ` Aurelien Jarno
2021-09-16 8:28 ` Florian Weimer via Libc-alpha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).