[PATCH] posix: Fix system error return value [BZ #25715]
Stefan Liebler
stli@linux.ibm.com
Tue Mar 24 13:53:26 GMT 2020
Hi Adhemerval,
I've got two test fails as shown below on my Fedora 31/30 (s390x,
x86_64) machines. I assume the error-messages differs depending on the
used shell?
Bye,
Stefan
On 3/23/20 7:31 PM, Adhemerval Zanella via Libc-alpha wrote:
> It fixes 5fb7fc9635 when posix_spawn fails.
>
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> ---
> stdlib/tst-system.c | 122 +++++++++++++++++++++++++++++++++++++++--
> sysdeps/posix/system.c | 18 +++---
> 2 files changed, 129 insertions(+), 11 deletions(-)
>
> diff --git a/stdlib/tst-system.c b/stdlib/tst-system.c
> index b6c5aea08f..04c87a1c6b 100644
> --- a/stdlib/tst-system.c
> +++ b/stdlib/tst-system.c
...
> + char cmd[namemax];
> + memset (cmd, 'a', sizeof(cmd));
> + cmd[sizeof(cmd) - 1] = '\0';
> +
> + struct support_capture_subprocess result;
> + result = support_capture_subprocess (call_system,
> + &(struct args) {
> + cmd, 127, 0, tmpdir
> + });
> + support_capture_subprocess_check (&result, "system", 0, sc_allow_stderr);
> +
> + char *returnerr = xasprintf ("%s: 1: %s: not found\n",
> + basename(_PATH_BSHELL), cmd);
> + TEST_COMPARE_STRING (result.err.buffer, returnerr);
tst-system.c:93: error: string comparison failed
left string: 279 bytes
right string: 274 bytes
left (evaluated from result.err.buffer):
"sh: aa...aa: command not found\n"
right (evaluated from returnerr):
"sh: 1: aa...aa: not found\n"
> + free (returnerr);
> + }
> +
> + {
> + char cmd[namemax + 1];
> + memset (cmd, 'a', sizeof(cmd));
> + cmd[sizeof(cmd) - 1] = '\0';
> +
> + struct support_capture_subprocess result;
> + result = support_capture_subprocess (call_system,
> + &(struct args) {
> + cmd, 127, 0, tmpdir
> + });
> + support_capture_subprocess_check (&result, "system", 0, sc_allow_stderr);
> +
> + char *returnerr = xasprintf ("%s: 1: %s: File name too long\n",
> + basename(_PATH_BSHELL), cmd);
> + TEST_COMPARE_STRING (result.err.buffer, returnerr);
tst-system.c:111: error: string comparison failed
left string: 280 bytes
right string: 284 bytes
left (evaluated from result.err.buffer):
"sh: aa...aa: command not found\n"
right (evaluated from returnerr):
"sh: 1: aa...aa: File name too long\n"
> + free (returnerr);
> + }
More information about the Libc-alpha
mailing list