public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [Bug 214871] New: Man(3) system outdated
@ 2021-10-29 20:37 bugzilla-daemon
  2021-10-30 11:56 ` [Bug 214871] " bugzilla-daemon
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bugzilla-daemon @ 2021-10-29 20:37 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=214871

            Bug ID: 214871
           Summary: Man(3) system outdated
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: man-pages
          Assignee: documentation_man-pages@kernel-bugs.osdl.org
          Reporter: mikekearney85@hotmail.com
        Regression: No

During my recent university work, I have noticed the man (3) page for system
(https://man7.org/linux/man-pages/man3/system.3.html) states:

The system() library function uses fork(2) to create a child process that
executes the shell command specified in command using execl(3) as follows: 
execl("/bin/sh", "sh", "-c", command, (char *) NULL);

On reading the source code for system, this caused me some confusion.
Eventually I found a commit from 2018
(https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5fb7fc96350575c9adb1316833e48ca11553be49),
in which fork and exec were replaced by posix_spawn. The explains why I could
not aline the man page with the source code.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 214871] Man(3) system outdated
  2021-10-29 20:37 [Bug 214871] New: Man(3) system outdated bugzilla-daemon
@ 2021-10-30 11:56 ` bugzilla-daemon
  2021-11-01 12:06 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2021-10-30 11:56 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=214871

--- Comment #1 from Alejandro Colomar (man-pages) (alx.manpages@gmail.com) ---
[CC += Glibc, Adhemerval]

Hi Adhemerval,

On 10/29/21 22:37, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=214871
> 
>              Bug ID: 214871
>             Summary: Man(3) system outdated
>             Product: Documentation
>             Version: unspecified
>            Hardware: All
>                  OS: Linux
>              Status: NEW
>            Severity: normal
>            Priority: P1
>           Component: man-pages
>            Assignee: documentation_man-pages@kernel-bugs.osdl.org
>            Reporter: mikekearney85@hotmail.com
>          Regression: No
> 
> During my recent university work, I have noticed the man (3) page for system
> (https://man7.org/linux/man-pages/man3/system.3.html) states:
> 
> The system() library function uses fork(2) to create a child process that
> executes the shell command specified in command using execl(3) as follows:
> execl("/bin/sh", "sh", "-c", command, (char *) NULL);
> 
> On reading the source code for system, this caused me some confusion.
> Eventually I found a commit from 2018
>
> (https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5fb7fc96350575c9adb1316833e48ca11553be49),
> in which fork and exec were replaced by posix_spawn. The explains why I could
> not aline the man page with the source code.
> 

I was about to change that line to say that it works "as if" using 
fork(2) and execl(3), as POSIX says, but then, reading the page further, 
it talks about many implementation details that seem to relate to when 
glibc did actually use fork(2).  They may be outdated now, so I think 
it's better if someone from glibc that knows its current details reviews 
the full page and proposes changes.

Thanks,

Alex

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 214871] Man(3) system outdated
  2021-10-29 20:37 [Bug 214871] New: Man(3) system outdated bugzilla-daemon
  2021-10-30 11:56 ` [Bug 214871] " bugzilla-daemon
@ 2021-11-01 12:06 ` bugzilla-daemon
  2021-11-02  9:58 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2021-11-01 12:06 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=214871

--- Comment #2 from zatrazz@gmail.com ---
On Sat, Oct 30, 2021 at 8:55 AM Alejandro Colomar (man-pages) <
alx.manpages@gmail.com> wrote:

> [CC += Glibc, Adhemerval]
>
> Hi Adhemerval,
>
> On 10/29/21 22:37, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=214871
> >
> >              Bug ID: 214871
> >             Summary: Man(3) system outdated
> >             Product: Documentation
> >             Version: unspecified
> >            Hardware: All
> >                  OS: Linux
> >              Status: NEW
> >            Severity: normal
> >            Priority: P1
> >           Component: man-pages
> >            Assignee: documentation_man-pages@kernel-bugs.osdl.org
> >            Reporter: mikekearney85@hotmail.com
> >          Regression: No
> >
> > During my recent university work, I have noticed the man (3) page for
> system
> > (https://man7.org/linux/man-pages/man3/system.3.html) states:
> >
> > The system() library function uses fork(2) to create a child process that
> > executes the shell command specified in command using execl(3) as
> follows:
> > execl("/bin/sh", "sh", "-c", command, (char *) NULL);
> >
> > On reading the source code for system, this caused me some confusion.
> > Eventually I found a commit from 2018
> > (
>
> https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5fb7fc96350575c9adb1316833e48ca11553be49
> ),
> > in which fork and exec were replaced by posix_spawn. The explains why I
> could
> > not aline the man page with the source code.
> >
>
> I was about to change that line to say that it works "as if" using
> fork(2) and execl(3), as POSIX says, but then, reading the page further,
> it talks about many implementation details that seem to relate to when
> glibc did actually use fork(2).  They may be outdated now, so I think
> it's better if someone from glibc that knows its current details reviews
> the full page and proposes changes.
>

Hi Alejandro,

Indeed we changed glibc to use posix_spawn on system and popen on  2.29
since
to use posix_spawn (which uses clone (CLONE_VFORK | CLONE_VM)).  It plays
way better with Linux memory subsystem than fork() + exec() specially when
such
calls are used with process with large RSS.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 214871] Man(3) system outdated
  2021-10-29 20:37 [Bug 214871] New: Man(3) system outdated bugzilla-daemon
  2021-10-30 11:56 ` [Bug 214871] " bugzilla-daemon
  2021-11-01 12:06 ` bugzilla-daemon
@ 2021-11-02  9:58 ` bugzilla-daemon
  2021-11-02  9:58 ` bugzilla-daemon
  2021-11-02 11:37 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2021-11-02  9:58 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=214871

--- Comment #3 from Alejandro Colomar (man-pages) (alx.manpages@gmail.com) ---
Hi Adhemerval, Michael,

On 11/1/21 13:06, zatrazz wrote:
> Hi Alejandro,
> 
> Indeed we changed glibc to use posix_spawn on system and popen on  2.29 
> since
> to use posix_spawn (which uses clone (CLONE_VFORK | CLONE_VM)).  It plays
> way better with Linux memory subsystem than fork() + exec() specially 
> when such
> calls are used with process with large RSS.

I applied the following patch.  I'll close the bug.

Thanks,

Alex

---
     system.3: It doesn't call fork anymore

     Reported-by: Michael Kearney <mikekearney85@hotmail.com>
     Cc: Adhemerval Zanella <zatrazz@gmail.com>
     Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

diff --git a/man3/system.3 b/man3/system.3
index 880fe93c6..bde45ed82 100644
--- a/man3/system.3
+++ b/man3/system.3
@@ -40,9 +40,9 @@ system \- execute a shell command
  .SH DESCRIPTION
  The
  .BR system ()
-library function uses
+library function behaves as if it used
  .BR fork (2)
-to create a child process that executes the shell command specified in
+to create a child process that executed the shell command specified in
  .I command
  using
  .BR execl (3)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Bug 214871] Man(3) system outdated
  2021-10-29 20:37 [Bug 214871] New: Man(3) system outdated bugzilla-daemon
                   ` (2 preceding siblings ...)
  2021-11-02  9:58 ` bugzilla-daemon
@ 2021-11-02  9:58 ` bugzilla-daemon
  2021-11-02 11:37 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2021-11-02  9:58 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=214871

Alejandro Colomar (man-pages) (alx.manpages@gmail.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alx.manpages@gmail.com
         Resolution|---                         |DOCUMENTED

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 214871] Man(3) system outdated
  2021-10-29 20:37 [Bug 214871] New: Man(3) system outdated bugzilla-daemon
                   ` (3 preceding siblings ...)
  2021-11-02  9:58 ` bugzilla-daemon
@ 2021-11-02 11:37 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2021-11-02 11:37 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=214871

--- Comment #4 from adhemerval.zanella@linaro.org ---
On 02/11/2021 06:58, Alejandro Colomar (man-pages) via Libc-alpha wrote:
> Hi Adhemerval, Michael,
> 
> On 11/1/21 13:06, zatrazz wrote:
>> Hi Alejandro,
>>
>> Indeed we changed glibc to use posix_spawn on system and popen on  2.29
>> since
>> to use posix_spawn (which uses clone (CLONE_VFORK | CLONE_VM)).  It plays
>> way better with Linux memory subsystem than fork() + exec() specially when
>> such
>> calls are used with process with large RSS.
> 
> I applied the following patch.  I'll close the bug.
> 
> Thanks,
> 
> Alex

I forgot to add that neither system(), posix_spawn(), nor popen() call
atfork handlers [1].  POSIX recently changed their description to make
it implementation-defined instead of unspecified [2], so I think it
is worth to change that is not really behave as called by fork() (since
it will run atfork handlers).

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=17490
[2] https://www.austingroupbugs.net/view.php?id=1317

> 
> ---
>     system.3: It doesn't call fork anymore
> 
>     Reported-by: Michael Kearney <mikekearney85@hotmail.com>
>     Cc: Adhemerval Zanella <zatrazz@gmail.com>
>     Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> 
> diff --git a/man3/system.3 b/man3/system.3
> index 880fe93c6..bde45ed82 100644
> --- a/man3/system.3
> +++ b/man3/system.3
> @@ -40,9 +40,9 @@ system \- execute a shell command
>  .SH DESCRIPTION
>  The
>  .BR system ()
> -library function uses
> +library function behaves as if it used
>  .BR fork (2)
> -to create a child process that executes the shell command specified in
> +to create a child process that executed the shell command specified in
>  .I command
>  using
>  .BR execl (3)
> 
> 
>

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-02 11:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-29 20:37 [Bug 214871] New: Man(3) system outdated bugzilla-daemon
2021-10-30 11:56 ` [Bug 214871] " bugzilla-daemon
2021-11-01 12:06 ` bugzilla-daemon
2021-11-02  9:58 ` bugzilla-daemon
2021-11-02  9:58 ` bugzilla-daemon
2021-11-02 11:37 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox