From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DA5223858427; Fri, 1 Apr 2022 12:53:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA5223858427 From: "arnaud.lb at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug stdio/29016] New: popen() sets errno to ENOMEM when shell does not exist Date: Fri, 01 Apr 2022 12:53:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: arnaud.lb 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 target_milestone 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, 01 Apr 2022 12:53:21 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29016 Bug ID: 29016 Summary: popen() sets errno to ENOMEM when shell does not exist Product: glibc Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: stdio Assignee: unassigned at sourceware dot org Reporter: arnaud.lb at gmail dot com Target Milestone: --- Hi I've found that popen() sets errno to ENOMEM when shell does not exist, and= I'm not sure whether it's expected or not by looking at the man page. Here is a small reproducer: ``` // test.c #include #include #include int main() { errno =3D 0; FILE * f =3D popen("/true", "r"); fprintf(stderr, "f: %p, errno: %d, strerror: %s\n", f, errno, strerror(errno)); } ``` ``` ; gcc -static -o test test.c ; sudo chroot . /test f: (nil), errno: 12, strerror: Cannot allocate memory ``` (Using chroot here to execute the program in an environment without /bin/sh) >>From the man page I can not tell whether this is expected or not. --=20 You are receiving this mail because: You are on the CC list for the bug.=