* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe [not found] <CAMO6KYomqkRFVnE1gfNa=htbZ5oBrVAm+AsFVqc6+vqZ0YxnAw@mail.gmail.com> @ 2023-07-13 8:12 ` Florian Weimer 2023-07-13 11:15 ` Shani Leviim 2023-08-13 20:19 ` [PATCH v2] " Alejandro Colomar 2023-08-13 20:21 ` [PATCH v3] " Alejandro Colomar 2 siblings, 1 reply; 13+ messages in thread From: Florian Weimer @ 2023-07-13 8:12 UTC (permalink / raw) To: Shani Leviim Cc: alx, linux-man, automotive-devel, Carlos O'Donell, Sergei Gromeniuk, Gobinda Das * Shani Leviim: > @@ -169,6 +172,16 @@ is too small and > is unknown). > The string always includes a terminating null byte (\(aq\e0\(aq). > .\" > +.PP > +The automatically generated buffer for > +.BR strerror () > +and > +.BR strerror_l () > +is sufficient to avoid an > +.B ERANGE > +error when calling > +.BR strerror_r (). > +.PP I think this gives the wrong impression that the pointer returned by strerror/strerror_l can be used with strerror_r. This is not the case because the application does not own that buffer, or know its length. Thanks, Florian ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-07-13 8:12 ` [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe Florian Weimer @ 2023-07-13 11:15 ` Shani Leviim 2023-07-16 17:28 ` Shani Leviim 0 siblings, 1 reply; 13+ messages in thread From: Shani Leviim @ 2023-07-13 11:15 UTC (permalink / raw) To: Florian Weimer Cc: alx, linux-man, automotive-devel, Carlos O'Donell, Sergei Gromeniuk, Gobinda Das Thanks, Florian, for reviewing, My original mail wasn't text plained, sorry for that. The information in my patch was obtained from a glibc upstream patch, commit ID 28aff047818eb1726394296d27b9c7885340bead Following the patch above, for glibc versions >=2.32, strerror() is considered MT-Safe, and the man page should be changed accordingly. diff --git a/man3/strerror.3 b/man3/strerror.3 index 72b4d3994..31818e4ae 100644 --- a/man3/strerror.3 +++ b/man3/strerror.3 @@ -91,11 +91,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. @@ -120,12 +121,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), @@ -249,7 +250,7 @@ l l l. Interface Attribute Value T{ .BR strerror () -T} Thread safety MT-Unsafe race:strerror +T} Thread safety MT-Safe T{ .BR strerrorname_np (), .BR strerrordesc_np () @@ -260,6 +261,10 @@ T{ .BR strerror_l () T} Thread safety MT-Safe .TE +.PP +Before glibc 2.32, +.BR strerror () +is not MT-Safe. .SH CONFORMING TO .BR strerror () is specified by POSIX.1-2001, POSIX.1-2008, C89, and C99. @@ -300,13 +305,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 () @@ -317,4 +315,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) Signed-off-by: Shani Leviim <sleviim@redhat.com> Regards, Shani Leviim Regards, Shani Leviim On Thu, Jul 13, 2023 at 11:12 AM Florian Weimer <fweimer@redhat.com> wrote: > > * Shani Leviim: > > > @@ -169,6 +172,16 @@ is too small and > > is unknown). > > The string always includes a terminating null byte (\(aq\e0\(aq). > > .\" > > +.PP > > +The automatically generated buffer for > > +.BR strerror () > > +and > > +.BR strerror_l () > > +is sufficient to avoid an > > +.B ERANGE > > +error when calling > > +.BR strerror_r (). > > +.PP > > I think this gives the wrong impression that the pointer returned by > strerror/strerror_l can be used with strerror_r. This is not the case > because the application does not own that buffer, or know its length. > > Thanks, > Florian > ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-07-13 11:15 ` Shani Leviim @ 2023-07-16 17:28 ` Shani Leviim 2023-07-28 18:55 ` Alejandro Colomar 0 siblings, 1 reply; 13+ messages in thread From: Shani Leviim @ 2023-07-16 17:28 UTC (permalink / raw) To: Florian Weimer Cc: alx, linux-man, automotive-devel, Carlos O'Donell, Sergei Gromeniuk, Gobinda Das Hi all, My previous patch wasn't aligned with the master branch. Here's the updated patch (compared to master): 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) Signed-off-by: Shani Leviim <sleviim@redhat.com> Regards, Shani Leviim On Thu, Jul 13, 2023 at 2:15 PM Shani Leviim <sleviim@redhat.com> wrote: > > Thanks, Florian, for reviewing, > My original mail wasn't text plained, sorry for that. > > The information in my patch was obtained from a glibc upstream patch, > commit ID 28aff047818eb1726394296d27b9c7885340bead > Following the patch above, for glibc versions >=2.32, strerror() is > considered MT-Safe, and the man page should be changed accordingly. > > diff --git a/man3/strerror.3 b/man3/strerror.3 > index 72b4d3994..31818e4ae 100644 > --- a/man3/strerror.3 > +++ b/man3/strerror.3 > @@ -91,11 +91,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. > @@ -120,12 +121,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), > @@ -249,7 +250,7 @@ l l l. > Interface Attribute Value > T{ > .BR strerror () > -T} Thread safety MT-Unsafe race:strerror > +T} Thread safety MT-Safe > T{ > .BR strerrorname_np (), > .BR strerrordesc_np () > @@ -260,6 +261,10 @@ T{ > .BR strerror_l () > T} Thread safety MT-Safe > .TE > +.PP > +Before glibc 2.32, > +.BR strerror () > +is not MT-Safe. > .SH CONFORMING TO > .BR strerror () > is specified by POSIX.1-2001, POSIX.1-2008, C89, and C99. > @@ -300,13 +305,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 () > @@ -317,4 +315,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) > > Signed-off-by: Shani Leviim <sleviim@redhat.com> > > Regards, > Shani Leviim > > Regards, > Shani Leviim > > > On Thu, Jul 13, 2023 at 11:12 AM Florian Weimer <fweimer@redhat.com> wrote: > > > > * Shani Leviim: > > > > > @@ -169,6 +172,16 @@ is too small and > > > is unknown). > > > The string always includes a terminating null byte (\(aq\e0\(aq). > > > .\" > > > +.PP > > > +The automatically generated buffer for > > > +.BR strerror () > > > +and > > > +.BR strerror_l () > > > +is sufficient to avoid an > > > +.B ERANGE > > > +error when calling > > > +.BR strerror_r (). > > > +.PP > > > > I think this gives the wrong impression that the pointer returned by > > strerror/strerror_l can be used with strerror_r. This is not the case > > because the application does not own that buffer, or know its length. > > > > Thanks, > > Florian > > ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-07-16 17:28 ` Shani Leviim @ 2023-07-28 18:55 ` Alejandro Colomar 2023-07-30 13:41 ` Shani Leviim 0 siblings, 1 reply; 13+ messages in thread From: Alejandro Colomar @ 2023-07-28 18:55 UTC (permalink / raw) To: Shani Leviim, Florian Weimer Cc: linux-man, automotive-devel, Carlos O'Donell, Sergei Gromeniuk, Gobinda Das [-- Attachment #1.1: Type: text/plain, Size: 6951 bytes --] Hi Shani, Florian, On 2023-07-16 19:28, Shani Leviim wrote: > Hi all, > My previous patch wasn't aligned with the master branch. > Here's the updated patch (compared to master): Thanks for the patch. Florian, do you have any comments about this patch? > > 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) > > > Signed-off-by: Shani Leviim <sleviim@redhat.com> Can you please include that information in the commit message itself? I suggest using git-format-patch(1) + git-send-email(1) to send the patch. If git-send-email(1) is not an option for you, then I suggest adding a copy of the patch as an attachment (but keep the inline copy please). Check the ./CONTRIBUTING file. Cheers, Alex > > Regards, > Shani Leviim > > On Thu, Jul 13, 2023 at 2:15 PM Shani Leviim <sleviim@redhat.com> wrote: >> >> Thanks, Florian, for reviewing, >> My original mail wasn't text plained, sorry for that. >> >> The information in my patch was obtained from a glibc upstream patch, >> commit ID 28aff047818eb1726394296d27b9c7885340bead >> Following the patch above, for glibc versions >=2.32, strerror() is >> considered MT-Safe, and the man page should be changed accordingly. >> >> diff --git a/man3/strerror.3 b/man3/strerror.3 >> index 72b4d3994..31818e4ae 100644 >> --- a/man3/strerror.3 >> +++ b/man3/strerror.3 >> @@ -91,11 +91,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. >> @@ -120,12 +121,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), >> @@ -249,7 +250,7 @@ l l l. >> Interface Attribute Value >> T{ >> .BR strerror () >> -T} Thread safety MT-Unsafe race:strerror >> +T} Thread safety MT-Safe >> T{ >> .BR strerrorname_np (), >> .BR strerrordesc_np () >> @@ -260,6 +261,10 @@ T{ >> .BR strerror_l () >> T} Thread safety MT-Safe >> .TE >> +.PP >> +Before glibc 2.32, >> +.BR strerror () >> +is not MT-Safe. >> .SH CONFORMING TO >> .BR strerror () >> is specified by POSIX.1-2001, POSIX.1-2008, C89, and C99. >> @@ -300,13 +305,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 () >> @@ -317,4 +315,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) >> >> Signed-off-by: Shani Leviim <sleviim@redhat.com> >> >> Regards, >> Shani Leviim >> >> Regards, >> Shani Leviim >> >> >> On Thu, Jul 13, 2023 at 11:12 AM Florian Weimer <fweimer@redhat.com> wrote: >>> >>> * Shani Leviim: >>> >>>> @@ -169,6 +172,16 @@ is too small and >>>> is unknown). >>>> The string always includes a terminating null byte (\(aq\e0\(aq). >>>> .\" >>>> +.PP >>>> +The automatically generated buffer for >>>> +.BR strerror () >>>> +and >>>> +.BR strerror_l () >>>> +is sufficient to avoid an >>>> +.B ERANGE >>>> +error when calling >>>> +.BR strerror_r (). >>>> +.PP >>> >>> I think this gives the wrong impression that the pointer returned by >>> strerror/strerror_l can be used with strerror_r. This is not the case >>> because the application does not own that buffer, or know its length. >>> >>> Thanks, >>> Florian >>> > -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-07-28 18:55 ` Alejandro Colomar @ 2023-07-30 13:41 ` Shani Leviim 2023-08-11 22:51 ` Alejandro Colomar 0 siblings, 1 reply; 13+ messages in thread From: Shani Leviim @ 2023-07-30 13:41 UTC (permalink / raw) To: Alejandro Colomar Cc: Florian Weimer, linux-man, automotive-devel, Carlos O'Donell, Gobinda Das [-- Attachment #1: Type: text/plain, Size: 10326 bytes --] Thanks, Alex, Attaching the patch (see attachments) From: Shani Leviim <sleviim@redhat.com> 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@redhat.com> --- 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 Regards, Shani Leviim On Fri, Jul 28, 2023 at 9:56 PM Alejandro Colomar <alx@kernel.org> wrote: > > Hi Shani, Florian, > > On 2023-07-16 19:28, Shani Leviim wrote: > > Hi all, > > My previous patch wasn't aligned with the master branch. > > Here's the updated patch (compared to master): > > Thanks for the patch. > > Florian, do you have any comments about this patch? > > > > > 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) > > > > > > Signed-off-by: Shani Leviim <sleviim@redhat.com> > > Can you please include that information in the commit message itself? > I suggest using git-format-patch(1) + git-send-email(1) to send the patch. > If git-send-email(1) is not an option for you, then I suggest adding a > copy of the patch as an attachment (but keep the inline copy please). > > Check the ./CONTRIBUTING file. > > Cheers, > Alex > > > > > Regards, > > Shani Leviim > > > > On Thu, Jul 13, 2023 at 2:15 PM Shani Leviim <sleviim@redhat.com> wrote: > >> > >> Thanks, Florian, for reviewing, > >> My original mail wasn't text plained, sorry for that. > >> > >> The information in my patch was obtained from a glibc upstream patch, > >> commit ID 28aff047818eb1726394296d27b9c7885340bead > >> Following the patch above, for glibc versions >=2.32, strerror() is > >> considered MT-Safe, and the man page should be changed accordingly. > >> > >> diff --git a/man3/strerror.3 b/man3/strerror.3 > >> index 72b4d3994..31818e4ae 100644 > >> --- a/man3/strerror.3 > >> +++ b/man3/strerror.3 > >> @@ -91,11 +91,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. > >> @@ -120,12 +121,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), > >> @@ -249,7 +250,7 @@ l l l. > >> Interface Attribute Value > >> T{ > >> .BR strerror () > >> -T} Thread safety MT-Unsafe race:strerror > >> +T} Thread safety MT-Safe > >> T{ > >> .BR strerrorname_np (), > >> .BR strerrordesc_np () > >> @@ -260,6 +261,10 @@ T{ > >> .BR strerror_l () > >> T} Thread safety MT-Safe > >> .TE > >> +.PP > >> +Before glibc 2.32, > >> +.BR strerror () > >> +is not MT-Safe. > >> .SH CONFORMING TO > >> .BR strerror () > >> is specified by POSIX.1-2001, POSIX.1-2008, C89, and C99. > >> @@ -300,13 +305,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 () > >> @@ -317,4 +315,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) > >> > >> Signed-off-by: Shani Leviim <sleviim@redhat.com> > >> > >> Regards, > >> Shani Leviim > >> > >> Regards, > >> Shani Leviim > >> > >> > >> On Thu, Jul 13, 2023 at 11:12 AM Florian Weimer <fweimer@redhat.com> wrote: > >>> > >>> * Shani Leviim: > >>> > >>>> @@ -169,6 +172,16 @@ is too small and > >>>> is unknown). > >>>> The string always includes a terminating null byte (\(aq\e0\(aq). > >>>> .\" > >>>> +.PP > >>>> +The automatically generated buffer for > >>>> +.BR strerror () > >>>> +and > >>>> +.BR strerror_l () > >>>> +is sufficient to avoid an > >>>> +.B ERANGE > >>>> +error when calling > >>>> +.BR strerror_r (). > >>>> +.PP > >>> > >>> I think this gives the wrong impression that the pointer returned by > >>> strerror/strerror_l can be used with strerror_r. This is not the case > >>> because the application does not own that buffer, or know its length. > >>> > >>> Thanks, > >>> Florian > >>> > > > > -- > <http://www.alejandro-colomar.es/> > GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 > [-- Attachment #2: 0001-strerror.3-Change-strerror-reference-from-MT-Unsafe-.patch --] [-- Type: text/x-patch, Size: 2700 bytes --] From 387522bc37d492bfa8aa094b99c6d5f1131e3a4b Mon Sep 17 00:00:00 2001 From: Shani Leviim <sleviim@redhat.com> 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@redhat.com> --- 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 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-07-30 13:41 ` Shani Leviim @ 2023-08-11 22:51 ` Alejandro Colomar 2023-08-13 14:37 ` Shani Leviim 0 siblings, 1 reply; 13+ messages in thread From: Alejandro Colomar @ 2023-08-11 22:51 UTC (permalink / raw) To: Shani Leviim Cc: Florian Weimer, linux-man, automotive-devel, Carlos O'Donell, Gobinda Das [-- Attachment #1.1: Type: text/plain, Size: 3850 bytes --] Hi Shani, On 2023-07-30 15:41, Shani Leviim wrote: > Thanks, Alex, > Attaching the patch (see attachments) > > From: Shani Leviim <sleviim@redhat.com> > 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@redhat.com> 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 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-08-11 22:51 ` Alejandro Colomar @ 2023-08-13 14:37 ` Shani Leviim 2023-08-13 15:11 ` Alejandro Colomar 0 siblings, 1 reply; 13+ messages in thread From: Shani Leviim @ 2023-08-13 14:37 UTC (permalink / raw) To: Alejandro Colomar Cc: Florian Weimer, linux-man, automotive-devel, Carlos O'Donell, Gobinda Das [-- Attachment #1: Type: text/plain, Size: 4495 bytes --] 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@kernel.org> wrote: > > Hi Shani, > > On 2023-07-30 15:41, Shani Leviim wrote: > > Thanks, Alex, > > Attaching the patch (see attachments) > > > > From: Shani Leviim <sleviim@redhat.com> > > 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@redhat.com> > > 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 > [-- Attachment #2: 0001-strerror.3-Change-strerror-reference-from-MT-Unsafe-.patch --] [-- Type: text/x-patch, Size: 2696 bytes --] From 387522bc37d492bfa8aa094b99c6d5f1131e3a4b Mon Sep 17 00:00:00 2001 From: Shani Leviim <sleviim@redhat.com> 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@redhat.com> --- 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 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-08-13 14:37 ` Shani Leviim @ 2023-08-13 15:11 ` Alejandro Colomar 2023-08-13 16:58 ` Shani Leviim 0 siblings, 1 reply; 13+ messages in thread From: Alejandro Colomar @ 2023-08-13 15:11 UTC (permalink / raw) To: Shani Leviim Cc: Florian Weimer, linux-man, automotive-devel, Carlos O'Donell, Gobinda Das [-- Attachment #1.1: Type: text/plain, Size: 4987 bytes --] On 2023-08-13 16:37, Shani Leviim wrote: > 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 No problem :) However, it still doesn't apply to master. I see that it applies to somewhere between man-pages-6.03 and man-pages-6.04. Could you please rebase it to either a release tag or the master branch, or specify the base to which it applies? Thanks, Alex > > > Regards, > Shani Leviim > > On Sat, Aug 12, 2023 at 1:52 AM Alejandro Colomar <alx@kernel.org> wrote: >> >> Hi Shani, >> >> On 2023-07-30 15:41, Shani Leviim wrote: >>> Thanks, Alex, >>> Attaching the patch (see attachments) >>> >>> From: Shani Leviim <sleviim@redhat.com> >>> 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@redhat.com> >> >> 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 -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-08-13 15:11 ` Alejandro Colomar @ 2023-08-13 16:58 ` Shani Leviim 2023-08-13 20:06 ` Alejandro Colomar 0 siblings, 1 reply; 13+ messages in thread From: Shani Leviim @ 2023-08-13 16:58 UTC (permalink / raw) To: Alejandro Colomar Cc: Florian Weimer, linux-man, automotive-devel, Carlos O'Donell, Gobinda Das That's very strange Working on master, my HEAD commit is commit 60eb580d1e836977d57355b6519f32e37bdc3392. I might be missing something. Regards, Shani Leviim On Sun, Aug 13, 2023 at 6:12 PM Alejandro Colomar <alx@kernel.org> wrote: > > On 2023-08-13 16:37, Shani Leviim wrote: > > 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 > > No problem :) > > However, it still doesn't apply to master. I see that it applies to > somewhere between man-pages-6.03 and man-pages-6.04. Could you please > rebase it to either a release tag or the master branch, or specify the > base to which it applies? > > Thanks, > Alex > > > > > > > Regards, > > Shani Leviim > > > > On Sat, Aug 12, 2023 at 1:52 AM Alejandro Colomar <alx@kernel.org> wrote: > >> > >> Hi Shani, > >> > >> On 2023-07-30 15:41, Shani Leviim wrote: > >>> Thanks, Alex, > >>> Attaching the patch (see attachments) > >>> > >>> From: Shani Leviim <sleviim@redhat.com> > >>> 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@redhat.com> > >> > >> 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 > > > > > > -- > <http://www.alejandro-colomar.es/> > GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-08-13 16:58 ` Shani Leviim @ 2023-08-13 20:06 ` Alejandro Colomar 0 siblings, 0 replies; 13+ messages in thread From: Alejandro Colomar @ 2023-08-13 20:06 UTC (permalink / raw) To: Shani Leviim Cc: Florian Weimer, linux-man, automotive-devel, Carlos O'Donell, Gobinda Das [-- Attachment #1.1: Type: text/plain, Size: 596 bytes --] On 2023-08-13 18:58, Shani Leviim wrote: > That's very strange > Working on master, my HEAD commit is commit > 60eb580d1e836977d57355b6519f32e37bdc3392. > I might be missing something. Indeed. That commit is somewhere between man-pages-6.02 and man-pages-6.03, around 600 commits and 8 months ago. A lot of things have changed since then. I released a few days ago man-pages-6.05.01. :) Don't worry, I'll apply the patch there and rebase it to git HEAD. Cheers, Alex -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe [not found] <CAMO6KYomqkRFVnE1gfNa=htbZ5oBrVAm+AsFVqc6+vqZ0YxnAw@mail.gmail.com> 2023-07-13 8:12 ` [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe Florian Weimer @ 2023-08-13 20:19 ` Alejandro Colomar 2023-08-13 20:21 ` [PATCH v3] " Alejandro Colomar 2 siblings, 0 replies; 13+ messages in thread From: Alejandro Colomar @ 2023-08-13 20:19 UTC (permalink / raw) To: linux-man; +Cc: Alejandro Colomar, Shani Leviim From: Shani Leviim <sleviim@redhat.com> 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@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- Hi Shani, This is your patch rebased to the current git HEAD. Cheers, Alex man3/strerror.3 | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/man3/strerror.3 b/man3/strerror.3 index 8b36d6487..73199ef85 100644 --- a/man3/strerror.3 +++ b/man3/strerror.3 @@ -72,11 +72,12 @@ .SH DESCRIPTION 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. @@ -101,12 +102,12 @@ .SH DESCRIPTION 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), @@ -231,7 +232,7 @@ .SH ATTRIBUTES T} Thread safety T{ .na .nh -MT-Unsafe race:strerror +MT-Safe T} T{ .na @@ -246,6 +247,10 @@ .SH ATTRIBUTES .BR strerror_l () T} Thread safety MT-Safe .TE +.PP +Before glibc 2.32, +.BR strerror () +is not MT-Safe. .SH STANDARDS .TP .BR strerror () @@ -301,13 +306,6 @@ .SH HISTORY .BR strerrordesc_np () glibc 2.32. .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 () @@ -318,4 +316,5 @@ .SH SEE ALSO .BR error (3), .BR perror (3), .BR strsignal (3), -.BR locale (7) +.BR locale (7), +.BR signal-safety (7) -- 2.40.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v3] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe [not found] <CAMO6KYomqkRFVnE1gfNa=htbZ5oBrVAm+AsFVqc6+vqZ0YxnAw@mail.gmail.com> 2023-07-13 8:12 ` [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe Florian Weimer 2023-08-13 20:19 ` [PATCH v2] " Alejandro Colomar @ 2023-08-13 20:21 ` Alejandro Colomar 2023-08-14 10:44 ` Alejandro Colomar 2 siblings, 1 reply; 13+ messages in thread From: Alejandro Colomar @ 2023-08-13 20:21 UTC (permalink / raw) To: linux-man Cc: Alejandro Colomar, Shani Leviim, Florian Weimer, Carlos O'Donell, Sergei Gromeniuk, Gobinda Das From: Shani Leviim <sleviim@redhat.com> 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@redhat.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Cc: Sergei Gromeniuk <sgromeni@redhat.com> Cc: Gobinda Das <godas@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- v3: Added the CCs from the original thread. man3/strerror.3 | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/man3/strerror.3 b/man3/strerror.3 index 8b36d6487..73199ef85 100644 --- a/man3/strerror.3 +++ b/man3/strerror.3 @@ -72,11 +72,12 @@ .SH DESCRIPTION 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. @@ -101,12 +102,12 @@ .SH DESCRIPTION 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), @@ -231,7 +232,7 @@ .SH ATTRIBUTES T} Thread safety T{ .na .nh -MT-Unsafe race:strerror +MT-Safe T} T{ .na @@ -246,6 +247,10 @@ .SH ATTRIBUTES .BR strerror_l () T} Thread safety MT-Safe .TE +.PP +Before glibc 2.32, +.BR strerror () +is not MT-Safe. .SH STANDARDS .TP .BR strerror () @@ -301,13 +306,6 @@ .SH HISTORY .BR strerrordesc_np () glibc 2.32. .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 () @@ -318,4 +316,5 @@ .SH SEE ALSO .BR error (3), .BR perror (3), .BR strsignal (3), -.BR locale (7) +.BR locale (7), +.BR signal-safety (7) -- 2.40.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe 2023-08-13 20:21 ` [PATCH v3] " Alejandro Colomar @ 2023-08-14 10:44 ` Alejandro Colomar 0 siblings, 0 replies; 13+ messages in thread From: Alejandro Colomar @ 2023-08-14 10:44 UTC (permalink / raw) To: linux-man Cc: Shani Leviim, Florian Weimer, Carlos O'Donell, Sergei Gromeniuk, Gobinda Das [-- Attachment #1.1: Type: text/plain, Size: 3098 bytes --] On 2023-08-13 22:21, Alejandro Colomar wrote: > From: Shani Leviim <sleviim@redhat.com> > > 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@redhat.com> > Cc: Florian Weimer <fweimer@redhat.com> > Cc: Carlos O'Donell <carlos@redhat.com> > Cc: Sergei Gromeniuk <sgromeni@redhat.com> > Cc: Gobinda Das <godas@redhat.com> > Signed-off-by: Alejandro Colomar <alx@kernel.org> > --- Patch applied. Cheers, Alex > > v3: Added the CCs from the original thread. > > man3/strerror.3 | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/man3/strerror.3 b/man3/strerror.3 > index 8b36d6487..73199ef85 100644 > --- a/man3/strerror.3 > +++ b/man3/strerror.3 > @@ -72,11 +72,12 @@ .SH DESCRIPTION > 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. > @@ -101,12 +102,12 @@ .SH DESCRIPTION > 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), > @@ -231,7 +232,7 @@ .SH ATTRIBUTES > T} Thread safety T{ > .na > .nh > -MT-Unsafe race:strerror > +MT-Safe > T} > T{ > .na > @@ -246,6 +247,10 @@ .SH ATTRIBUTES > .BR strerror_l () > T} Thread safety MT-Safe > .TE > +.PP > +Before glibc 2.32, > +.BR strerror () > +is not MT-Safe. > .SH STANDARDS > .TP > .BR strerror () > @@ -301,13 +306,6 @@ .SH HISTORY > .BR strerrordesc_np () > glibc 2.32. > .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 () > @@ -318,4 +316,5 @@ .SH SEE ALSO > .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 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-08-14 10:46 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAMO6KYomqkRFVnE1gfNa=htbZ5oBrVAm+AsFVqc6+vqZ0YxnAw@mail.gmail.com>
2023-07-13 8:12 ` [patch] strerror.3: Change strerror() reference from MT-Unsafe to MT-Safe Florian Weimer
2023-07-13 11:15 ` Shani Leviim
2023-07-16 17:28 ` Shani Leviim
2023-07-28 18:55 ` Alejandro Colomar
2023-07-30 13:41 ` Shani Leviim
2023-08-11 22:51 ` Alejandro Colomar
2023-08-13 14:37 ` Shani Leviim
2023-08-13 15:11 ` Alejandro Colomar
2023-08-13 16:58 ` Shani Leviim
2023-08-13 20:06 ` Alejandro Colomar
2023-08-13 20:19 ` [PATCH v2] " Alejandro Colomar
2023-08-13 20:21 ` [PATCH v3] " Alejandro Colomar
2023-08-14 10:44 ` Alejandro Colomar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox