Summary and Fix for "slashes in filenames"
Andrew H Cowan
cowan at dover.sps.mot.com
Sat Feb 9 08:54:03 AEST 1991
Yes, I posted the original question. And here's a summary for those
who are interested. All wizards who object to sh*t like this in
comp.unix.wizards should note the "Followup-To:" line and lighten
up a little.
Summary of replies to my previous posting:
>Subject: Re: Help! There's a slash '/' in my filename.
>...
>I don't know how it happened... but I've got a directory (on a
>Sun OS 4.0.3 machine) that contains two files with the slash '/'
>character embedded in the filenames. I recall a discussion about bogus
>filenames in this group a while back, did anybody ever figure out how
>to deal with filenames that contain slashes?
>
>Now that I've got 'em, how can I get rid of them?
Summary explanation of how the bogus filename was created:
Most probably it was created by mounting the Sun filesystem
from a client that allows slashes in filenames.
The NFS server takes create requests with '/''s in them
and doesn't bother to filter them out.
-uunet!pyrps5.pyramid.com!mre (Mike Eisler)
Best answer to "Now that I've got 'em, how can I get rid of them?"
1. Find the inode number of the file.
2. Unmount the file system.
3. Zap the file with "clri".
4. Run fsck on the file system.
5. Remount the file system.
-uunet!asi.com!carl (Carl Ellis)
(Wasn't quite that straigtforward for me... but thats the
jist of it. I was able to remove the files. (whew!))
Also: (You might try these.)
There is an article on UNIX WORLD Magazine ANSWERS TO UNIX, dealing
with how to modify a file name with a slash in it using /etc/fsdb.
-uunet!nff.ncl.omron.co.jp!yang
(Not available on my Sun OS 4.0 system. -AC )
If you have fsdb, use that to fix the file system.
-uunet!pegasus.att.com!hansen (Tony L Hansen)
(ditto -AC)
On suggestions to "quote", backslash (\), wilcard (*), or
other tricks to get the system to ignore the slashes:
First, all the tricks to use "quotes",wildcards, or
"\" escapes only fool the "directory look up" part of
the system calls. Eventually, though, after the filename
expansion, wildcarding, etc., the lookup is still going
to return a filename with slashes in it.
Second, the kernal always assumes a slash means,
"ah, a directory path..." and goes on its merry way descending
to the find the file. This is the problem...almost all
calls (and believe me I tried 'em all) return "no such
file or directory", because the kernal can't resolve
the name 'cause it looks like a directory path.
-AC
Thanks for all the replies....
Someday, somewhere, at a time when you least expect. You'll
get a file with a "/" in its name, then you'll wish you had
saved this....
** / \ **
** ** | | **
** ** ** \___/ ** **
******** ** **
****** __ ** ****
** \_/oo\_/ **** **
........**..........\||/................****.........**...........
Andy Cowan...........||.............cowan at soleil.sps.mot.com......
PS: By the way, Dick Dunn, I agree with you. And I thank everyone
who replied to my desperate plea for help (except those that
followed-up instead of emailing).
-AC
More information about the Comp.unix.questions
mailing list