[phobos] [D-Programming-Language/phobos] f999f6: std.file: Use stat instead of access to check file...

GitHub noreply at github.com
Sat Feb 18 11:36:14 PST 2012


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: f999f6ba0e86a9e6b54f9853ca48d830396aec8e
      https://github.com/D-Programming-Language/phobos/commit/f999f6ba0e86a9e6b54f9853ca48d830396aec8e
  Author: Vladimir Panteleev <vladimir at thecybershadow.net>
  Date:   2012-02-18 (Sat, 18 Feb 2012)

  Changed paths:
    M std/file.d

  Log Message:
  -----------
  std.file: Use stat instead of access to check file existence on POSIX

The reason for this change is the quirky behavior of access for SUID
programs: a file may not appear to "exist", despite that the program
would be able to open it just fine. The behavior in question is described
as follows in the access man page:

> The check is done using the calling process's real UID and GID, rather
> than the effective IDs as is done when actually attempting an operation
> (e.g., open(2)) on the file. This allows set-user-ID programs to easily
> determine the invoking user's authority.

While various operating systems provide eaccess or euidaccess functions,
these are not part of POSIX - so it's safer to use stat instead.


  Commit: 2f39ce1b826cdb1ff59ff827788e1cb568f1fcbb
      https://github.com/D-Programming-Language/phobos/commit/2f39ce1b826cdb1ff59ff827788e1cb568f1fcbb
  Author: Andrei Alexandrescu <andrei at erdani.com>
  Date:   2012-02-18 (Sat, 18 Feb 2012)

  Changed paths:
    M std/file.d

  Log Message:
  -----------
  Merge pull request #422 from CyberShadow/std-file-exists

std.file: Use stat instead of access to check file existence on POSIX


Compare: https://github.com/D-Programming-Language/phobos/compare/1b871d9...2f39ce1


More information about the phobos mailing list