From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D92233972C20; Fri, 11 Dec 2020 14:08:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D92233972C20 From: "mtk.manpages at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/27053] New: Conformance regression in system(3) (and probably also pclose(3)) Date: Fri, 11 Dec 2020 14:08:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.33 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mtk.manpages at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2020 14:08:02 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27053 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=3D13037&action=3Ded= it 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 chi= ld had done _exit(127). This was once true in the glibc implementation, but is no longer true. I th= ink the change must have come in glibc 2.29, with=20 commit 5fb7fc96350575c9adb1316833e48ca11553be49 Author: Adhemerval Zanella 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 h= as been triggered in pclose() with the following commit: commit 14d0e87d9b8caaa2eca7ca81f1189596671fe4fb Author: Adhemerval Zanella Date: Wed Sep 12 10:32:05 2018 -0300 posix: Use posix_spawn on popen =3D=3D=3D=3D 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=3D0xffffffff (-1,255) system: Permission denied The expected output when running the test program was: system() returned: status=3D0x7f00 (127,0) (Probably) could not invoke shell --=20 You are receiving this mail because: You are on the CC list for the bug.=