unlink(inode)? or how to remove file with '/' in its name

Simon J. Gerraty sjg at sun0.melb.bull.oz.au
Thu Oct 18 13:08:32 AEST 1990


We have an interesting situation here.  While investigating the
practicalities of using an Appletalk-NFS gateway (Gatorbox I
think but please don't quote me), one of our users created a
file on one of our Sun's with a '/' in the name.
Unfortunately he forgot to remove the file before returning the
gateway.

Having exhausted all the normal solutions for removing files
with "funny" chars in their names, I was asked to have a look.
Again after quickly trying the above solutions myself, I went
and had a look in the manuals.

It only took five minutes to write a short C programme to print
inode/name pairs from a directory. ls(1) etc weren't any use at
all, though echo '*' would at least show the name.

Ok, I know the inode, all I have to do is get rid of it.  How?
While there are system/library calls to read directory entries,
there appears no way of _writing_ them, not even for root?  So a
simple directory sanitiser is out of the question.

It gets worse though as there appear to be no system/library
calls available to unlink or otherwise operate on an inode.  All
the commands, and system/library calls appear to deal with
pathnames only and naturally vomit when asked to deal with a
fictitious path (since the filename has a '/' in it :-)

So, have I missed something, or do I have to resort to editing
the raw disk file?  

I would also be interested to here how NFS created the stupid
file in the first place.  Perhaps I can write an programme to
ask NFS to remove it?

By the way all of the above applies to SunOS 4.0.3
--
Simon J. Gerraty			<sjg at sun0.melb.bull.oz.au>

#include <disclaimer>             /* imagine something *very* witty here */



More information about the Comp.unix.questions mailing list