Is there a POSIX pathname that can't name a file?
Posted
by Charles Stewart
on Super User
See other posts from Super User
or by Charles Stewart
Published on 2010-01-14T11:59:26Z
Indexed on
2010/04/13
10:03 UTC
Read the original article
Hit count: 334
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.
© Super User or respective owner