[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#990268: busybox: incorrect handling of output error for various BusyBox commands



Package: busybox
Version: 1:1.30.1-6+b2
Severity: normal

BusyBox does not always handle output error correctly, e.g. with
closed stdout. For instance:

$ busybox sh -c 'exec >&-; for i in echo env pwd; do echo "[$i]" >&2; $i; echo $? >&2; busybox $i; echo $? >&2; done'
[echo]
sh: write error: Bad file descriptor
1
echo: write error: Bad file descriptor
1
[env]
env: write error: Bad file descriptor
125
env: standard output: Bad file descriptor
0
[pwd]
1
255

There are 3 issues here:

1. For echo, in the error message, "sh" is written instead of "echo".
   But the message is OK for "busybox echo".

2. For "busybox env", the exit status is 0 instead of non-zero.
   But the exit status is correct for just "env".

3. For pwd and "busybox pwd", the error message is missing, though it
   is required by POSIX:
     https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pwd.html

Other BusyBox commands might be affected too. To be checked...

-- System Information:
Debian Release: 11.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-security'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-7-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages busybox depends on:
ii  libc6  2.31-12

busybox recommends no packages.

busybox suggests no packages.

-- no debconf information

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: