git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-compat-util: work around for access(X_OK) under root

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 24, 2019, 01:16 UTC
Message-ID
<20190424011617.GG6316@genre.crustytoothpaste.net>
In-Reply-To
<xmqqsgu843yv.fsf@gitster-ct.c.googlers.com>
On Wed, Apr 24, 2019 at 09:55:04AM +0900, Junio C Hamano wrote:
Show 13 quoted lines
> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
> 
> > What POSIX says on this is the following:
> >
> >   If any access permissions are checked, each shall be checked
> >   individually, as described in XBD File Access Permissions, except that
> >   where that description refers to execute permission for a process with
> >   appropriate privileges, an implementation may indicate success for
> >   X_OK even if execute permission is not granted to any user.
> 
> Do I take this "not granted to any user" as "no +x bit is set for
> owner, group or other", and "a process with appropriate privileges"
> as "running as root"?

Yes. The language of the former is designed to allow ACLs or other mechanisms, and "appropriate privileges" is the POSIX term for "root permissions". The latter is also designed to allow implementations leeway to implement an alternate mechanism.

Sorry for not explaining that up front; I'm so used to POSIX-speak by now that it doesn't seem strange to me.

> The latter half feels iffy, if the system is still allowed to fail
> execution by "a process with appropriate privileges", leading to
> inconsistent answer from access(2) and behaviour by execv(2).  But
> at least that explains what was observed.

Yeah, I don't love that POSIX makes this exception, but it is what it is.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 9 in “git-compat-util: work around for access(X_OK) under root”
  1. git-compat-util: work around for access(X_OK) under rootCHIGOT, CLEMENT, Apr 23, 2019
  2. Duy NguyenApr 23, 2019
  3. Junio C HamanoApr 23, 2019
  4. CHIGOT, CLEMENTApr 23, 2019
  5. brian m. carlsonApr 23, 2019
  6. Junio C HamanoApr 24, 2019
  7. brian m. carlsonApr 24, 2019
  8. Junio C HamanoApr 24, 2019
  9. CHIGOT, CLEMENTApr 24, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.