To be clear, having stat() return an error is not "breaking UNIX" (re
https://bazaar.launchpad.net/~mirabilos/mksh/MAIN/revision/2874). UNIX,
as defined by IEEE Std 1003.1-2017, says:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html

  An implementation that provides additional or
  alternate file access control mechanisms may, 
  under implementation-defined conditions, cause
  stat() to fail. In particular, the system may
  deny the existence of the file specified by path.

Returning an error for stat() is well defined, UNIX standard behavior.
Not properly handling a UNIX defined, standardized behavior is a bug.

-- 
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1817959

Title:
  "test -e" inaccurately returns false when stat() is disallowed

Status in mksh:
  Invalid

Bug description:
  From "man 1 test"

    NAME
         test - check file types and compare values
    DESCRIPTION
         Exit with the status determined by EXPRESSION.
         [deleted]
         -e FILE
                FILE exists

  When "test -e" is called, it is intended to determine the existence or
  non-existence of a file. However, the "test" command is implemented
  using stat(), which may be disallowed by security policy. If stat() is
  disallowed, "test" will falsely claim a file doesn't exist when it
  really exists.

  Replacing "stat() == 0" with "access(F_OK) == 0" fixes this problem.
  See attached patch.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1817959/+subscriptions

Reply via email to