Bug 10396

Summary: test -w should return false on a R/O fs as root
Product: Busybox Reporter: hobbitalastair
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs, hobbitalastair
Priority: P5    
Version: 1.27.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

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.