5
1
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.
Just a note...
it's not \ it's /. In Unix \ is a fine character to have in a file. /user/chuck/tom\mary the filename=tom\mary. – DrFloyd5 – 2010-04-10T13:43:09.780
@DrFloyd: Right. Fixed. – Charles Stewart – 2010-04-13T10:01:21.713
1I like this question. It reminds me of "Der Mouse", when moving from VMS to UNIX, being annoyed because he could not find a way to create a filename with a slash or a null in it - where the slash was part of the filename within a directory, rather than a separator between directory and something in the directory. // The standard POSIX APIs do not produce an error on such filenames, they simply interpret the embedded special characters as either path separate or string terminator. – Krazy Glew – 2015-12-22T18:07:48.953
4Hmmm, I was wondering if that title couldn't be more descriptive, but whatever I come up with seems to yield a contradiction in terms... – Arjan – 2010-01-14T12:18:22.917