Ghost file

Greg Woods woods at gpu.utcs.toronto.edu
Wed Nov 23 14:22:43 AEST 1988


In article <303 at bilver.UUCP> bill at bilver.UUCP (bill vermillion) writes:
> In article <169 at pinn.UUCP+ sysop at pinn.UUCP (Andy Johnson) writes:
> +In article <8430 at alice.UUCP+, debra at alice.UUCP (Paul De Bra) writes:
> ++ In article <17529 at adm.BRL.MIL+ ZAT011%DJUKFA11.BITNET at cunyvm.cuny.edu (Thomas Heil) writes:
> ++ I would suspect that the name of the ghost file contains a non-printable
> +
> +You can also type in rm -i *   That will interactively ask you to delete
> +each file including the ghost file.  
> 
> I tried that (rm -i *) with a ghost file and it did NOT work.  Dumped the
> directory and found that the file name had a printable letter, 0x08, and two
> more letters.  The 0x08 (backspace) effectively masked the first letter.
> rm -i *  would prompt with the name, and then give a file not found error.
> The only way to get rid of one of those is to kill with the
> find . -inum   etc, etc  routine posted earlier.
> 

This has been bantered about quite a bit, but I must say a few words.

Either your rm is broken, or your shell has a bug.

Since rm did prompt with the printed representation of the filename,
either your shell flubbed the filename expansion (and generated a
command line with the printed representation of the filename instead of
the actuall filename.  On the other hand, your rm might have goofed
somewhere between reading the command line, and calling unlink().

I would tend to think the problem is in your shell.  Do you have more
than one shell on your system?  Did you try them all?

Iff your rm is working correctly, a much simpler solution to the problem
is to try 'rm -ri .'.  This way any non-printable characters do not have
to be passed through the command line, and even characters with their
8'th bit set will not get clobbered.  (Many, if not all older shells
will strip the 8'th bit.)  Though I haven't run across one, it is
possible that some versions of rm will also strip 8'th bits.

If rm, or all the shells are broken, you will have to resort to
eliminating the file by its inode number (or by calling unlink() from a
C programme).
-- 
						Greg Woods.

{utgpu,lsuc!gate,ontmoh}!woods, woods@{gpu.utcs.Toronto.EDU,utorgpu.BITNET}
1-416-443-1734 [h], 1-416-595-5425 [w]   LOCATION: Toronto, Ontario, Canada



More information about the Comp.unix.wizards mailing list