Help! There's a slash '/' in my filename.

The Grey Wolf greywolf at unisoft.UUCP
Tue Feb 5 13:39:57 AEST 1991


In article <1991Feb2.113410.23943 at gpu.utcs.utoronto.ca> jmason at gpu.utcs.utoronto.ca (Jamie Mason) writes:
>In article <43579 at ut-emx.uucp> D.Nash at utexas.edu writes:
>>The interpretation of the / character is wired into namei()'s brain. 
>
>>be on the free list and the won't be allocated to files.  After you run
>>clri, unmount the filesystem and run fsck on it to repair the damage. 
>
>Why go to all that trouble to deal with the file.  Just rename it.  That
>is to say, edit the directory and change the / to something harmless like
>a '_' or a '.' or antything else.

Can't.  The kernel's namei() routine will choke on the '/' and try to make
an absolute path out of it.

>
>I don't remember how hard it is to get around the restriction to writing
>directories as if they were files, but that would seem easier than
>clearing the inode and then picking up the peices of the file system.

Not at all:

go single-user (this scenario constitutes enough concern to warrant this)
ls -i <dir-of-offending-file>
cd /
umount <fs-upon-which-offending-file-resides>
clri filesystem ino

If you have to do this on root, a "reboot -q -n" is necessary.

>Of
>course if writing to the directory was becoming a problem, you could
>always get the directory's sector number from it's Inode and pull out a
>sector editor on the appropriate block /device. :-)

Why go to all the trouble to map the file like that when clri(8) does just
what the user needs to do?  If the user has data in there, he's screwed
if he needs to access it (unless he can hack the filesystem to find the
inode).

It's a good thing that corresponding inode numbers are kept in the 
directories with the files; if 'tweren't so, El User would be skruud (less'n
he did a dump of the fs...).

>
>Jamie  ...  "Who was that Masked Interrupt?"
>Written On  Saturday, February 2, 1991  at  06:31:32am EST

You should be a bit more sure of architectures, of commands and of UNIX
in general before you post something like this.  The problem is NOT trivial
(how a '/' ended up in a filename on disk is beyond me).  The solution, by
comparison, is.

(I, on the other hand, should be a bit more sure that someone else hasn't
already posted the answer to this problem, but, at this point, oh, well...)

Please don't take this as a flame.  It wasn't meant as such.
-- 
thought:  I ain't so damb dumn!	| Your brand new kernel just dump core on you
war: Invalid argument		| And fsck can't find root inode 2
				| Don't worry -- be happy...
...!{ucbvax,acad,uunet,amdahl,pyramid}!unisoft!greywolf



More information about the Comp.unix.wizards mailing list