Just ENOENT? What about… … ENOTDIR?
… ENAMETOOLONG? … ELOOP? … EFAULT? … EIO? (That one’s actually Heisenberg.) This approach also will catastrophically fail if new errnos added, or if an OS has defined its own custom ones. Nope, not going there. Do not break stat(), period. -- 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