public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Joe Simmons-Talbott <joetalbott@gmail.com>
To: libc-help@sourceware.org
Subject: Testcase for BZ 28519
Date: Mon, 20 Mar 2023 14:10:21 -0400	[thread overview]
Message-ID: <20230320180132.GA1698111@oak> (raw)

Hi,

I'm trying to write a testcase for BZ 28519 but not having much luck.
My testcase is below.  For a simple application that calls
'system("-echo")' I get the same behavior as the BZ but for the testcase
I get the expected behavior where sh fails to find "-echo".

Does anyone have any thought on what I might be missing?

Thanks,
Joe

My testcase looks like this:

diff --git a/stdlib/tst-system.c b/stdlib/tst-system.c
index 47a0afe6bf..6f3329c08e 100644
--- a/stdlib/tst-system.c
+++ b/stdlib/tst-system.c
@@ -146,6 +146,20 @@ do_test (void)
     TEST_COMPARE_STRING (result.out.buffer, "...\n");
   }

+  {
+    struct support_capture_subprocess result;
+    const char *cmd = "-echo";
+    result = support_capture_subprocess (call_system,
+                                        &(struct args) { cmd, 127, 0 });
+    support_capture_subprocess_check (&result, "system", 0, sc_allow_stderr);
+       printf("JOE: %s\n", result.err.buffer);
+    char *returnerr = xasprintf ("%s: execing %s failed: "
+                                "No such file or directory",
+                                basename(_PATH_BSHELL), cmd);
+    TEST_COMPARE_STRING (result.err.buffer, returnerr);
+    free (returnerr);
+  }
+
   {
     struct support_capture_subprocess result;
     result = support_capture_subprocess (call_system,


             reply	other threads:[~2023-03-20 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 18:10 Joe Simmons-Talbott [this message]
2023-03-20 20:14 ` Florian Weimer
2023-03-21 17:19   ` Joe Talbott

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=20230320180132.GA1698111@oak \
    --to=joetalbott@gmail.com \
    --cc=libc-help@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).