bug-bash
[Top][All Lists]
Advanced

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

Re: access(2) shouldn't be used with test(1)


From: Garrett Cooper
Subject: Re: access(2) shouldn't be used with test(1)
Date: Tue, 20 Jul 2010 18:12:55 -0700

On Tue, Jul 20, 2010 at 5:16 PM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 7/20/10 2:00 PM, Garrett Cooper wrote:
>>     According to the POSIX spec, using access(2) is implementation
>> dependent when running as superuser [1]. FreeBSD intentionally returns
>> true whenever euid/uid = 0 [2]. FreeBSD's /bin/sh doesn't have this
>> `issue' with test(1). Example:
>
> Bash-4.1 doesn't use access for `test -x' (or -e, -r, or -w, for that
> matter) on FreeBSD.  If eaccess is available and configure detects its
> presence, bash uses that, otherwise it either uses access or checks the
> permissions returned by stat.
>
> Bash-4.2 will prefer the use of faccessat if available, falling back to
> eaccess and then access/stat.  On FreeBSD, bash-4.2 will use stat to
> verify X_OK when euid == 0 even if eaccess returns true, since eaccess
> lies also (the FreeBSD test does the same thing).
>
> The relevant code is in lib/sh/eaccess.c:sh_eaccess().  This was
> discussed extensively back in March.

I see what you mean.. I need to do more digging because according to
the config logs, eaccess(2) is used, and when I put an #error in the
relevant block, it pops up with:

findcmd.c:98:2: error: #error "!eaccess!"
*** Error code 1

Stop in /usr/ports/shells/bash/work/bash-4.1.
*** Error code 1

:(...

Thanks,
-Garrett



reply via email to

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