[Top][All Lists]

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

Re: access(), test and scripts

From: Thomas Schwinge
Subject: Re: access(), test and scripts
Date: Tue, 8 Jul 2008 23:55:17 +0200
User-agent: Mutt/1.5.11


On Sat, May 24, 2008 at 10:44:21PM +0100, Samuel Thibault wrote:
> 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?

I say we should do here what other POSIX systems use.  No need to be
special, in my opinion.

I'll change this (or Samuel does) unless somebody objects, OK?


Attachment: signature.asc
Description: Digital signature

reply via email to

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