Hi Alex, I am re-attaching it. I changed its name once it was created, so it may have caused an issue. git apply --verbose 0001-strerror.3-Change-strerror-reference-from-MT-Unsafe-.patch Checking patch man3/strerror.3... Applied patch man3/strerror.3 cleanly. Sorry for the inconvenience Regards, Shani Leviim On Sat, Aug 12, 2023 at 1:52 AM Alejandro Colomar <alx@xxxxxxxxxx> wrote: > > Hi Shani, > > On 2023-07-30 15:41, Shani Leviim wrote: > > Thanks, Alex, > > Attaching the patch (see attachments) > > > > From: Shani Leviim <sleviim@xxxxxxxxxx> > > Date: Sun, 30 Jul 2023 15:51:07 +0300 > > Subject: [PATCH 1/1] strerror.3: Change strerror() reference from MT-Unsafe to > > MT-Safe > > > > The information in this patch was obtained from a glibc upstream patch, > > commit ID 28aff047818eb1726394296d27b9c7885340bead > > > > According the patch above, for glibc versions >=2.32, > > strerror() is considered MT-Safe, and the man page should be changed > > accordingly. > > > > Signed-off-by: Shani Leviim <sleviim@xxxxxxxxxx> > > The patch doesn't apply. Can you please check what's wrong with it? > > > $ git am patches/0001-strerror.3-Change-strerror-reference-from-MT-Unsafe-.patch > Applying: strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe > error: patch failed: man3/strerror.3:238 > error: man3/strerror.3: patch does not apply > Patch failed at 0001 strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe > hint: Use 'git am --show-current-patch=diff' to see the failed patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > > Thanks, > Alex > > > --- > > man3/strerror.3 | 31 +++++++++++++++---------------- > > 1 file changed, 15 insertions(+), 16 deletions(-) > > > > diff --git a/man3/strerror.3 b/man3/strerror.3 > > index 862e153ee..6a3d83164 100644 > > --- a/man3/strerror.3 > > +++ b/man3/strerror.3 > > @@ -71,11 +71,12 @@ part of the current locale to select the > > appropriate language. > > is > > .BR EINVAL , > > the returned description will be "Invalid argument".) > > -This string must not be modified by the application, but may be > > -modified by a subsequent call to > > +This string must not be modified by the application, > > +and the returned pointer will be invalidated on a subsequent call to > > .BR strerror () > > or > > -.BR strerror_l (). > > +.BR strerror_l (), > > +or if the thread that obtained the string exits. > > No other library function, including > > .BR perror (3), > > will modify this string. > > @@ -100,12 +101,12 @@ For example, given > > as an argument, this function returns a pointer to the string "EPERM". > > .\" > > .SS strerror_r() > > -The > > .BR strerror_r () > > -function is similar to > > +is like > > .BR strerror (), > > -but is > > -thread safe. > > +but might use the supplied buffer > > +.I buf > > +instead of allocating one internally. > > This function is available in two versions: > > an XSI-compliant version specified in POSIX.1-2001 > > (available since glibc 2.3.4, but not POSIX-compliant until glibc 2.13), > > @@ -238,7 +239,7 @@ Interface Attribute Value > > T{ > > .BR strerror () > > T} Thread safety T{ > > -MT-Unsafe race:strerror > > +MT-Safe > > T} > > T{ > > .BR strerrorname_np (), > > @@ -249,6 +250,10 @@ T{ > > .BR strerror_l () > > T} Thread safety MT-Safe > > .TE > > +.PP > > +Before glibc 2.32, > > +.BR strerror () > > +is not MT-Safe. > > .hy > > .ad > > .sp 1 > > @@ -292,13 +297,6 @@ to > > if the error number is unknown. > > C99 and POSIX.1-2008 require the return value to be non-NULL. > > .SH NOTES > > -The GNU C Library uses a buffer of 1024 characters for > > -.BR strerror (). > > -This buffer size therefore should be sufficient to avoid an > > -.B ERANGE > > -error when calling > > -.BR strerror_r (). > > -.PP > > .BR strerrorname_np () > > and > > .BR strerrordesc_np () > > @@ -309,4 +307,5 @@ are thread-safe and async-signal-safe. > > .BR error (3), > > .BR perror (3), > > .BR strsignal (3), > > -.BR locale (7) > > +.BR locale (7), > > +.BR signal-safety (7) > > -- > <http://www.alejandro-colomar.es/> > GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 >
From 387522bc37d492bfa8aa094b99c6d5f1131e3a4b Mon Sep 17 00:00:00 2001 From: Shani Leviim <sleviim@xxxxxxxxxx> Date: Sun, 30 Jul 2023 15:51:07 +0300 Subject: [PATCH] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe The information in this patch was obtained from a glibc upstream patch, commit ID 28aff047818eb1726394296d27b9c7885340bead According the patch above, for glibc versions >=2.32, strerror() is considered MT-Safe, and the man page should be changed accordingly. Signed-off-by: Shani Leviim <sleviim@xxxxxxxxxx> --- man3/strerror.3 | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/man3/strerror.3 b/man3/strerror.3 index 862e153ee..6a3d83164 100644 --- a/man3/strerror.3 +++ b/man3/strerror.3 @@ -71,11 +71,12 @@ part of the current locale to select the appropriate language. is .BR EINVAL , the returned description will be "Invalid argument".) -This string must not be modified by the application, but may be -modified by a subsequent call to +This string must not be modified by the application, +and the returned pointer will be invalidated on a subsequent call to .BR strerror () or -.BR strerror_l (). +.BR strerror_l (), +or if the thread that obtained the string exits. No other library function, including .BR perror (3), will modify this string. @@ -100,12 +101,12 @@ For example, given as an argument, this function returns a pointer to the string "EPERM". .\" .SS strerror_r() -The .BR strerror_r () -function is similar to +is like .BR strerror (), -but is -thread safe. +but might use the supplied buffer +.I buf +instead of allocating one internally. This function is available in two versions: an XSI-compliant version specified in POSIX.1-2001 (available since glibc 2.3.4, but not POSIX-compliant until glibc 2.13), @@ -238,7 +239,7 @@ Interface Attribute Value T{ .BR strerror () T} Thread safety T{ -MT-Unsafe race:strerror +MT-Safe T} T{ .BR strerrorname_np (), @@ -249,6 +250,10 @@ T{ .BR strerror_l () T} Thread safety MT-Safe .TE +.PP +Before glibc 2.32, +.BR strerror () +is not MT-Safe. .hy .ad .sp 1 @@ -292,13 +297,6 @@ to if the error number is unknown. C99 and POSIX.1-2008 require the return value to be non-NULL. .SH NOTES -The GNU C Library uses a buffer of 1024 characters for -.BR strerror (). -This buffer size therefore should be sufficient to avoid an -.B ERANGE -error when calling -.BR strerror_r (). -.PP .BR strerrorname_np () and .BR strerrordesc_np () @@ -309,4 +307,5 @@ are thread-safe and async-signal-safe. .BR error (3), .BR perror (3), .BR strsignal (3), -.BR locale (7) +.BR locale (7), +.BR signal-safety (7) -- 2.39.3