Description of problem: I have a script that performs a test ([ -w /etc/passwd ]), and it's returning as if /etc/passwd is writable when it really isn't. I had set the immutable flag on /etc/passwd, then ran the script, and it didn't pick up that passwd was not writable. This works on RH9. Version-Release number of selected component (if applicable): RH9 - test (GNU coreutils) 4.5.3 Fedora 1 - test (GNU coreutils) 5.0 Actual results: Script functions as if /etc/passwd was writable, when in fact it's not. Expected results: Test should return the proper value to allow scripts to function properly. Additional Info: Test does appear to return the proper values. For instance, if I do a 'test -w /etc/passwd' at a prompt, then 'echo $status', it doesn't return a 0 to me. However, in scripts, this doesn't appear to be caught.
You filed this bug against coreutils, but the coreutils-provided 'test' (/usr/bin/test) uses access(2) to determine writability -- and this returns the result you want. The bash built-in (both [ and test) use stat(2) and this just looks at the regular file permissions.
Reported upstream via bashbug.