Public bug reported:

>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.

** Affects: mksh
     Importance: Undecided
         Status: New

** Attachment added: "mksh.txt"
   https://bugs.launchpad.net/bugs/1817959/+attachment/5242146/+files/mksh.txt

-- 
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:
  New

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