[Toybox] Still poking at shell corner cases...

enh enh at google.com
Mon Jul 1 12:50:56 PDT 2019


works for me as root. i think your copy & paste got mangled somewhere.
strace says the shell is opening files in /data/local/tmp/:

newfstatat(AT_FDCWD, "/data/local/tmp", {st_mode=S_IFDIR|0771,
st_size=20480, ...}, 0) = 0
openat(AT_FDCWD, "/data/local/tmp/shcj1bft.tmp",
O_RDWR|O_CREAT|O_EXCL, 0600) = 3
openat(AT_FDCWD, "/data/local/tmp/shcj1bft.tmp", O_RDONLY) = 4
write(3, "hello\ntwo\n", 10)            = 10
close(3)                                = 0
fcntl(0, F_DUPFD, 10)                   = 11
fcntl(11, F_SETFD, FD_CLOEXEC)          = 0
dup3(4, 0, 0)                           = 0
close(4)                                = 0
newfstatat(AT_FDCWD, "/data/local/tmp", {st_mode=S_IFDIR|0771,
st_size=20480, ...}, 0) = 0
openat(AT_FDCWD, "/data/local/tmp/shyryaav.tmp",
O_RDWR|O_CREAT|O_EXCL, 0600) = 3
openat(AT_FDCWD, "/data/local/tmp/shyryaav.tmp", O_RDONLY) = 4
write(3, "and\n", 4)                    = 4
close(3)                                = 0
dup3(4, 0, 0)                           = 0
close(4)                                = 0

On Mon, Jul 1, 2019 at 12:30 PM Rob Landley <rob at landley.net> wrote:
>
> bash:
>
>   $ cat << one << two
>   > hello
>   > two
>   > one
>   > and
>   > two
>   and
>   $
>
> dash:
>
>   $ cat << one << two
>   > hello
>   > two
>   > one
>   > and
>   > two
>   and
>   $
>
> mksh in terminal app on android:
>
>   $ cat << one << two
>   > hello
>   > two
>   > one
>   > and
>   > two
>   /system/bin/sh: can't create temporary file /data/local/shxijx9k.tmp: Permission denied
>   $
>
> So it consumes the HERE document inputs in sequence, but only the last is passed to stdin. (And mksh is doing whatever it's doing, can't tell because "security" prevents it from working. I should dig up my M phone and see what it did back when it worked.)
>
> Rob.
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list