Re: [9fans] test -w on directory
> > >kb=4096 > > say what!? fittingly, it's unused. > > i'd suppose it was probably going to reduce the buffer size on a wirelessly-connected ipaq
Re: [9fans] test -w on directory
> 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. in both cases, the test returning the wrong result won't easily be noticed. lp just mounts somthing else on /tmp on failure, and juke restarts/remounts whatever. i'm not sure anyone has noticed. by the way, i notice juke has this gem: kb=4096 say what!? fittingly, it's unused. - erik
[9fans] test -w on directory
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