[elbe-devel] [PATCH] Fix silent command error in cpio examples
Olivier Dion
dion at linutronix.de
Fri Jul 5 16:34:48 CEST 2019
Little update on the subject:
The command tee is not at fault here. The same problem can be made
using who.
``````````````````````````````````````````````````````````````````````
<command>who</command>
<command>who -0</command>
<command>echo "hello" | who -a</command>
<command>echo "hello" | who</command>
<command>/usr/bin/who</command>
<command>/usr/bin/who -0</command>
``````````````````````````````````````````````````````````````````````
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN who+
------------------------------------------------------------------------------
qemu: no user program specified
------------------------------------------------------------------------------
Command failed with errorcode 1
Finetuning Error, trying to continue anyways
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN who -0+
------------------------------------------------------------------------------
qemu: missing argument for option '0'
------------------------------------------------------------------------------
Command failed with errorcode 1
Finetuning Error, trying to continue anyways
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN echo "hello" | who -a+
------------------------------------------------------------------------------
qemu: unknown option 'a'
------------------------------------------------------------------------------
Command failed with errorcode 1
Finetuning Error, trying to continue anyways
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN echo "hello" | who+
------------------------------------------------------------------------------
qemu: no user program specified
------------------------------------------------------------------------------
Command failed with errorcode 1
Finetuning Error, trying to continue anyways
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN /usr/bin/who+
------------------------------------------------------------------------------
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN /usr/bin/who -0+
------------------------------------------------------------------------------
/usr/bin/who: invalid option -- '0'
BusyBox v1.22.1 (Debian 1:1.22.0-19+b3) multi-call binary.
Usage: who [-a]
Show who is logged on
-a Show all
-H Print column headers
------------------------------------------------------------------------------
Command failed with errorcode 1
Finetuning Error, trying to continue anyways
running cmd +chroot /var/cache/elbe/e0566604-8e28-4e6f-a4fc-6582d9783dc5/target /bin/sh with STDIN echo "hello" | /usr/bin/who -a+
------------------------------------------------------------------------------
------------------------------------------------------------------------------
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
The problem seems to be not related to the pipe, but really to the
absolute path.
echo is an exception since it's either builtin in the shell or found
under /bin and not /usr/bin like tee and who. Thus other tests have
been made to see if the problem is exclusive to /usr/bin.
``````````````````````````````````````````````````````````````````````
<command>ls</command>
<command>ls -l</command>
<command>/bin/ls</command>
<command>/bin/ls -l</command>
<command>echo "hello" | ls</command>
<command>echo "hello" | ls -l</command>
<command>echo "hello" | /bin/ls</command>
<command>echo "hello" | /bin/ls -l</command>
``````````````````````````````````````````````````````````````````````
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN ls+
------------------------------------------------------------------------------
bin
dev
etc
init
proc
sbin
sys
usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN ls -l+
------------------------------------------------------------------------------
total 16
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 bin
drwxr-xr-x 17 0 0 3160 Jul 5 10:45 dev
drwxr-xr-x 3 0 0 4096 Jul 5 13:17 etc
lrwxrwxrwx 1 0 0 10 Jul 5 13:17 init -> /sbin/init
dr-xr-xr-x 124 0 0 0 Jul 5 08:15 proc
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 sbin
dr-xr-xr-x 13 0 0 0 Jul 5 08:15 sys
drwxr-xr-x 5 0 0 4096 Jul 5 13:17 usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN /bin/ls+
------------------------------------------------------------------------------
bin
dev
etc
init
proc
sbin
sys
usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN /bin/ls -l+
------------------------------------------------------------------------------
total 16
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 bin
drwxr-xr-x 17 0 0 3160 Jul 5 10:45 dev
drwxr-xr-x 3 0 0 4096 Jul 5 13:17 etc
lrwxrwxrwx 1 0 0 10 Jul 5 13:17 init -> /sbin/init
dr-xr-xr-x 124 0 0 0 Jul 5 08:15 proc
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 sbin
dr-xr-xr-x 13 0 0 0 Jul 5 08:15 sys
drwxr-xr-x 5 0 0 4096 Jul 5 13:17 usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN echo "hello" | ls+
------------------------------------------------------------------------------
bin
dev
etc
init
proc
sbin
sys
usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN echo "hello" | ls -l+
------------------------------------------------------------------------------
total 16
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 bin
drwxr-xr-x 17 0 0 3160 Jul 5 10:45 dev
drwxr-xr-x 3 0 0 4096 Jul 5 13:17 etc
lrwxrwxrwx 1 0 0 10 Jul 5 13:17 init -> /sbin/init
dr-xr-xr-x 124 0 0 0 Jul 5 08:15 proc
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 sbin
dr-xr-xr-x 13 0 0 0 Jul 5 08:15 sys
drwxr-xr-x 5 0 0 4096 Jul 5 13:17 usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN echo "hello" | /bin/ls+
------------------------------------------------------------------------------
bin
dev
etc
init
proc
sbin
sys
usr
------------------------------------------------------------------------------
running cmd +chroot /var/cache/elbe/45670842-9d5a-4bb6-9545-b47771fe8a71/target /bin/sh with STDIN echo "hello" | /bin/ls -l+
------------------------------------------------------------------------------
total 16
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 bin
drwxr-xr-x 17 0 0 3160 Jul 5 10:45 dev
drwxr-xr-x 3 0 0 4096 Jul 5 13:17 etc
lrwxrwxrwx 1 0 0 10 Jul 5 13:17 init -> /sbin/init
dr-xr-xr-x 124 0 0 0 Jul 5 08:15 proc
drwxr-xr-x 2 0 0 4096 Jul 5 13:17 sbin
dr-xr-xr-x 13 0 0 0 Jul 5 08:15 sys
drwxr-xr-x 5 0 0 4096 Jul 5 13:17 usr
------------------------------------------------------------------------------
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
So apparently /bin is fine, but not /usr/bin. The only explanation
would be that /usr/bin is not in PATH. Previous tests (see GitHub) have
shown that this is not the case.
Just in case, here's a nother test ..
``````````````````````````````````````````````````````````````````````
<command>who</command>
<command>who -a</command>
<command>who -0</command>
<command>echo "hello" | who</command>
<command>echo "hello" | who -a</command>
<command>echo "hello" | who -0</command>
``````````````````````````````````````````````````````````````````````
But this time we do this in the chroot env:
``````````````````````````````````````````````````````````````````````
if os.environ["PATH"]:
os.environ["PATH"] = "%s:/usr/bin" % os.environ["PATH"]
else:
os.environ["PATH"] = "/usr/bin"
``````````````````````````````````````````````````````````````````````
but same error as previously ...
I'm done.
--
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
More information about the elbe-devel
mailing list