When executing "test -r" or "test -w" with a pipe file with or without read/write permission the returned value is always the same. However, it works with standard files (haven't tried with sockets).
Can you give an example, what exactly do you see, and what do you expect to see? mkfifo abc chmod ... abc busybox test -r abc; echo $? /path/to/coreutils/test -r abc; echo $? bash -c 'test -r abc; echo $?'
Created attachment 649 [details] Busybox "test" command playground In the screenshot there are some examples about the tests I performed in my VirtualBox host with busybox 1.13.4. In the top part of the image, there is a directory listing with the actual contents, and next the tests performed with the command "test" and the unexpected results. However, it's possible I didn't understood totally the directory permission policies shown, since the following command didn't produce any error: (notice that di01.info has -r--r--r-- root root permission) # echo TEST2 > di01.info ; cat di01.info TEST2
You see it because you run as root. I see the same with both busybox and with bash: # mkfifo busybox_TST # chmod a=r busybox_TST # bash -c 'test -r busybox_TST; echo $?' 0 # bash -c 'test -w busybox_TST; echo $?' 0 # bash -c './busybox test -r busybox_TST; echo $?' 0 # bash -c './busybox test -w busybox_TST; echo $?' 0 But under non-root, test -w returns "false": # bash -c 'setuidgid 1:1 ./busybox test -r busybox_TST; echo $?' 0 # bash -c 'setuidgid 1:1 ./busybox test -w busybox_TST; echo $?' 1 # setuidgid 1:1 bash -c 'test -r busybox_TST; echo $?' 0 # setuidgid 1:1 bash -c 'test -w busybox_TST; echo $?' 1 Again, we are bash-compatible here. Looks like it is not a bug.
True, "test" works fine if is not executed as "root". I'll change the status to "invalid".