Bug 10396 - test -w should return false on a R/O fs as root
Summary: test -w should return false on a R/O fs as root
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.27.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-11 19:48 UTC by hobbitalastair
Modified: 2017-10-11 19:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hobbitalastair 2017-10-11 19:48:11 UTC
According to POSIX.1-2008:

"When a file is to be read or written, the file shall be opened with an access mode corresponding to the operation to be performed. If file access permissions deny access, the requested operation shall fail."

However, if a filesystem is mounted R/O, then the "root can write to any file" assumption (coreutils/test.c#603) fails, and test -w returns true even if the file is not actually writeable. This differs from the behaviour of bash, which correctly returns false.