yesterday. anth_x discovered that test -w on directory always
returns false even tho the directory is writable.

test works by calling access(AWRITE) on the file which tries
a open(OWRITE) on the directory. this always fails because
you can't open directory for writing.

some rc scripts seem to assume that test -w should work on
directories. examples are /rc/bin/lp which tests for /tmp
being writable. another is /rc/bin/juke that tests on
/mnt/juke.

i dont know if there are other programs that use access()
to test on directory writability. (i guess not)

its hard for access() to figure out effective directory
writability except by trying to create a file in the
dir (very bad idea). (is access() allowed to return
false positives but no false negatives?)

its not clear to me from the manpage that access() is
expected to work on directories.

access bug? is test at fault here? did it work once?
are these rc scripts that use test -w on directories bogus?

suggestions? :)

--
cinap

Reply via email to