public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "arnaud.lb at gmail dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-29016-131@http.sourceware.org/bugzilla/> (raw)

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

            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 <stdio.h>
#include <errno.h>
#include <string.h>

int main() {
    errno = 0;
    FILE * f = 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.

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

             reply	other threads:[~2022-04-01 12:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 12:53 arnaud.lb at gmail dot com [this message]
2022-12-06 15:47 ` [Bug stdio/29016] " schwab@linux-m68k.org
2022-12-07 18:26 ` sam at gentoo dot org
2023-02-14 18:37 ` adhemerval.zanella at linaro dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29016-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).