Help! There's a slash '/' in my filename.
Guy Harris
guy at auspex.auspex.com
Sun Feb 3 08:09:13 AEST 1991
>This won't work. The / is not interpreted by the shell, but by the
>kernel routine namei(), which translates file names into inode numbers.
Actually, it's not called "namei()" in SunOS, but that's an extremely
minor detail; your explanation is correct, and your suggested fix is
mostly correct, except that you probably want to unmount the file system
*before* doing the "clri".
However, if you end up nuking the inode for the file, you've lost that
file. Another possibility is to make another directory at the same
level as the one containing the file with the "/" in its name, move all
the other files into that directory (including files with names
beginning with ".", other than "." and "..", if any exist), do "ls -id"
on the directory containing that file, unmount the file system, nuke
that *directory's* inode with "clri", and then do an "fsck". "fsck"
should make a new link to the file with the bad name in "lost+found", so
you won't lose the file. Then renmae the newly-created directory to
have the name of the old directory, and move the file from "lost+found"
into that directory with some name (not containing a "/", needless to
say...).
I suspect the bad file got there because of a Mac or maybe PC or some
other non-UNIX NFS or perhaps Tops client. There's a bug in older
versions of the Sun NFS server code (probably inherited by some other
vendors; we've gotten rid of that bug, and so has Sun in SunOS 4.1)
where it doesn't check for "/" in file names coming over the wire, but
instead creates files with "/" in their name.
If that's the case, another alternative fo rdealing with the file might
be to find out who created it, and have *them* rename it; the same NFS
server bug that let them create the file in the first place should let
them rename it to something nicer....
More information about the Comp.unix.internals
mailing list