On Monday 03 March 2008 20:08, Sridhar Ayengar wrote:
Fred Cisin wrote:
On Mon, 3 Mar 2008, Sridhar Ayengar wrote:
And there really isn't any reason one cannot
create filenames with
slashes in them in UNIX. The only OS I know of that completely
prohibits it is Windows.
Even Windoze can't stop us from creating files with
"invalid"
filenames.
You can also create a file named *.*
(getting rid of it may be harder)
Except, in UNIX, one can have a completely
*valid* filename with
slashes in it. Or almost any other character in the system
character-set really.
No you can't. The only two characters you can't have in a filename
are "/" and NUL, as far as the kernel is concerned. Of course, you can
have a "\", but that's properly called a "backslash" not a
"slash". :)
I ran into this problem at work once; the HSM we use exports itself as
an nfs share, and through timezone settings it didn't like, "/" got
inserted into filenames that it automatically generated when useres
deleted files.
I can site a reference even (though a different one than I remember
looking at when I was trying out how to fix the HSM):
http://www.faqs.org/faqs/unix-faq/faq/part2/section-2.html
I can't think of any UNIX(-alike) kernel that wouldn't interpret a "/"
passed to it in a filename as a directory separator. The only way to
get around this is to go around the kernel and poke at the filesystem
(or filesystem drivers) yourself, to convince them to shoot you in the
foot.
I've done it, so I know it's possible. And I didn't have to do anything
in the kernel to do it.
That's not to say that I didn't do something very strange in a program I
was writing to do it, but the file sat there happily in my filesystem.
ls(1) displayed its name just fine. rm(1) couldn't remove it, so I had
to do something similarly strange to remove it.
Peace... Sridhar