| Summary: | "test -r" does not work properly with pipe files | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Oriol <opalenzuela> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED INVALID | ||
| Severity: | minor | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.13.x | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Host: | VirtualBox | Target: | |
| Build: | |||
| Attachments: | Busybox "test" command playground | ||
|
Description
Oriol
2009-09-11 10:33:54 UTC
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". |