Hello,

It's quite common to see code that calls test -x to check whether the x
bit was disabled on a file, before trying to execute it.

That does not work on the Hurd for uid 0:

# touch foo
# ls -l foo
-rw-r--r-- 1 root root 0 May 24 21:31 foo
# [ -x foo ] && echo erf
erf
# ./foo
-bash: ./foo: Permission denied

because in fshelp_access(), as soon as user->uids contains 0, everything
is permitted, thus making access() always return X_OK...  

What POSIX says is `New implementations are discouraged from returning
X_OK unless at least one execution permission bit is set.'

Now, I can not remember about executability in the Hurd: can it happen
that something -x may actually be executable?  If not, shouldn't we
change our behavior?

Samuel


Reply via email to