Are there any legal paths in POSIX that cannot be associated with a file, regular or irregular? That is, for which test -e "$LEGITIMATEPOSIXPATHNAME"
cannot succeed?
Clarification #1: pathnames
By "legal paths in POSIX", I mean ones that POSIX says are allowed, not ones that POSIX doesn't explicitly forbid. I've looked this up, and the are POSIX specification calls them character strings that:
- Use only characters from the portable filename character set
[a-zA-Z0-9._-]
(cf. http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_276); - Do not begin with
-
; and - Have length between 1 and NAME_MAX, a number unspecified for POSIX that is not less than 14.
POSIX also allows that filesystems will probably be more relaxed than this, but it forbids the characters NUL and /
from appearing in filenames. Note that such a paradigmatically UNIX filename as lost+found
isn't FPF, according to this def. There's another constant PATH_MAX, whose use needs no further explanation.
The ideal answer will use FPFs, but I'm interested in any example with filenames that POSIX doesn't expressly forbid.
Clarification #2: impossibility
Obviously, pathnames normally could be bound to a file. But UNIX semantics will tell you that there are special places that couldn't normally have arbitrary files created, like in the /dev
directory. Are any such special places stipulated in POSIX? That is what the question is getting after.
Best Answer
Since the final question is whether there are special places that couldn't normally have a file, like in the /dev directory stipulated in POSIX, then the andswer is YES.
The complete list of pre-determined files and directories is given in chapter 10, POSIX Directory Structure and Devices, of the IEEE Open Group Base Specifications Issue 6: