EOF while scanning triple-quoted string literal

Seebs usenet-nospam at seebs.net
Fri Oct 15 21:41:17 CEST 2010

On 2010-10-15, Grant Edwards <invalid at invalid.invalid> wrote:
> Yes, all of the Unix syscalls use NULL-terminated path parameters (AKA
> "C strings").  What I don't know is whether the underlying filesystem
> code also uses NULL-terminated strings for filenames or if they have
> explicit lengths.  If the latter, there might be some way to bypass
> the normal Unix syscalls and actually create a file with a NULL in its
> name -- a file that then couldn't be accessed via the normal Unix
> system calls.  My _guess_ is that the underlying filesystem code in
> most all Unices also uses NULL-terminated strings, but I haven't
> looked yet.

There's some dire magic there.  The classic V7 or so filesystem had 16-byte
file names which were null terminated unless they were 16 characters, in
which case they weren't but were still only 16 characters.  Apart from that,
though, so far as I know everything is always null terminated.

The weird special case is slashes; you can never have a slash in a file name,
but at least one NFS implementation was able to create file names containing
slashes, and if you had a Mac client (where slash was valid in file names),
it could then create files with names that you could never use on the Unix
side, because the path resolution code kept trying to find directories
instead.  This was, worse yet, common, because so many people used
"mm/dd/yy" in file names!  Later implementations changed to silently
translating between colons and slashes.  (I think this still happened under
the hood in at least some OS X, because the HFS filesystem really uses
colons somewhere down in there.)

... But so far as I know, there's never been a Unix-type system where it
was actually possible to get a null byte into a file name.  Spaces, newlines,
sure.  Slashes, under rare and buggy circumstances.  But I've never heard
of a null byte in a file name.

Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

More information about the Python-list mailing list