> it's open() which is failing. i suppose it should.
>
> if the open fails, maybe access should stat the file, and if it's a
> directory, try dirread(2). or maybe just opening it for reading will
> work. i don't know, i'm new to this bit of plan 9 & i haven't slept.
This is a bit subtle, though -- if you want
to check if *you* can traverse the directory,
then simply checking for an execute bit isn't
enough -- you need to check that you belong to
a group that has the execute bit.
On a related note, execute permission seems
to behave strangely in general. You can create
a directory and list it:
Even without execute permission it's listable.
Makes sense.
cpu% mkdir -p d/a/b
cpu% touch d/x
cpu% chmod -x d
cpu% ls -ld d
d-rw-r--r-- M 81 ori ori 0 Jun 5 07:53 d
cpu% ls d
d/a
d/x
As expected, it can't be traversed:
cpu% ls d/x
ls: d/x: 'd/x' does not exist
But, you can cd into it:
cpu% cd d
And list '.':
cpu% ls
a
x
cpu% ls .
a
x
Can't traverse it to list subdirectories,
though:
ls a
ls: a: 'a' access permission denied
cd a
Can't cd a: 'a' access permission denied
cpu% cd ..
Can't cd ..: '..' access permission denied
So, cd'ing into a directory withut +x leads
to an inescapabler trap.
Perhaps 'cd' should prevent entering that
directory.
------------------------------------------
9fans: 9fans
Permalink:
https://9fans.topicbox.com/groups/9fans/Tdd7a9b1b32d01f54-M7606288952deb77ff6f74eca
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription