public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27053] New: Conformance regression in system(3) (and probably also pclose(3))
@ 2020-12-11 14:08 mtk.manpages at gmail dot com
  2020-12-11 14:08 ` [Bug libc/27053] " mtk.manpages at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mtk.manpages at gmail dot com @ 2020-12-11 14:08 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27053

            Bug ID: 27053
           Summary: Conformance regression in system(3) (and probably also
                    pclose(3))
           Product: glibc
           Version: 2.33
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: mtk.manpages at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 13037
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13037&action=edit
Test program to examine return value of system()

According to the POSIX specification of the system() function:

       If some error prevents the command language
       interpreter from executing after the child process is
       created, the return value from system() shall be as if
       the command language interpreter had terminated using
       exit(127) or _exit(127).

Thus, for example, if no shell is present, or the shell pathname is not
executable, then the return value from system() should be as though the child
had done _exit(127).

This was once true in the glibc implementation, but is no longer true. I think
the change must have come in glibc 2.29, with 

commit 5fb7fc96350575c9adb1316833e48ca11553be49
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Oct 24 16:29:38 2018 -0300

    posix: Use posix_spawn on system

That commit removed these lines from sysdeps/posix/system.c:

-      /* Exec the shell.  */
-      (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
-      _exit (127);

I suspect, but have not tested, that a similar nonconformance to the spec has
been triggered in pclose() with the following commit:

commit 14d0e87d9b8caaa2eca7ca81f1189596671fe4fb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Sep 12 10:32:05 2018 -0300

    posix: Use posix_spawn on popen

====

I've attached a test program. Here's a demo run:

$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jul 27 15:18 /bin/sh -> bash
$ sudo chmod 0 /bin/bash
$ ./a.out date
system() returned: status=0xffffffff (-1,255)
system: Permission denied

The expected output when running the test program was:

system() returned: status=0x7f00 (127,0)
(Probably) could not invoke shell

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27053] Conformance regression in system(3) (and probably also pclose(3))
  2020-12-11 14:08 [Bug libc/27053] New: Conformance regression in system(3) (and probably also pclose(3)) mtk.manpages at gmail dot com
@ 2020-12-11 14:08 ` mtk.manpages at gmail dot com
  2020-12-11 14:27 ` adhemerval.zanella at linaro dot org
  2021-01-11 16:44 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: mtk.manpages at gmail dot com @ 2020-12-11 14:08 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27053

Michael Kerrisk <mtk.manpages at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27053] Conformance regression in system(3) (and probably also pclose(3))
  2020-12-11 14:08 [Bug libc/27053] New: Conformance regression in system(3) (and probably also pclose(3)) mtk.manpages at gmail dot com
  2020-12-11 14:08 ` [Bug libc/27053] " mtk.manpages at gmail dot com
@ 2020-12-11 14:27 ` adhemerval.zanella at linaro dot org
  2021-01-11 16:44 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2020-12-11 14:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27053

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |adhemerval.zanella at linaro dot o
                   |                            |rg

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27053] Conformance regression in system(3) (and probably also pclose(3))
  2020-12-11 14:08 [Bug libc/27053] New: Conformance regression in system(3) (and probably also pclose(3)) mtk.manpages at gmail dot com
  2020-12-11 14:08 ` [Bug libc/27053] " mtk.manpages at gmail dot com
  2020-12-11 14:27 ` adhemerval.zanella at linaro dot org
@ 2021-01-11 16:44 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-01-11 16:44 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27053

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |2.33
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.33.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-01-11 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 14:08 [Bug libc/27053] New: Conformance regression in system(3) (and probably also pclose(3)) mtk.manpages at gmail dot com
2020-12-11 14:08 ` [Bug libc/27053] " mtk.manpages at gmail dot com
2020-12-11 14:27 ` adhemerval.zanella at linaro dot org
2021-01-11 16:44 ` adhemerval.zanella at linaro dot org

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).