bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

access(), test and scripts


From: Samuel Thibault
Subject: access(), test and scripts
Date: Sat, 24 May 2008 22:44:21 +0100
User-agent: Mutt/1.5.12-2006-07-14

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

[Prev in Thread] Current Thread [Next in Thread]