[net.unix] funny filenames

phaedrus@eneevax.UUCP (The Sophist) (05/11/85)

By mistake I created a file called ^G (ctl-G) from readnews.  When
went back to the csh, I did an `ls' and it told me that I had file
called `?'.  When I tried to `rm ?' it wouldn't go away.  However,
I tried `rm ^G', that worked.  I think this is kind of strange.

What happens if one (by mistake) creates a file called `ctl-foo' and one
didn't know that this was happening.  The next time they did an `ls'
of that directory they'd get a `?' and it would be impossible to remove
because they don't know the name.

Can someone explain this to me?

-- 
			Pravin Kumar

Don't bother me! I'm on an emergency third rail power trip.

ARPA:   phaedrus!eneevax@maryland
UUCP:   {seismo,allegra,brl-bmd}!umcp-cs!eneevax!phaedrus

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/13/85)

> What happens if one (by mistake) creates a file called `ctl-foo' and one
> didn't know that this was happening.  The next time they did an `ls'
> of that directory they'd get a `?' and it would be impossible to remove
> because they don't know the name.
> 
> Can someone explain this to me?

If "ls" showed the name as what it was, it could put your terminal into
a funny state.  Funny characters are being replaced by `?' to save some
grief.  To remove these things, either remove by inode number or else
try an interactive "rm".

schoch@ucbvax.ARPA (Steve Schoch) (05/13/85)

In article <279@eneevax.UUCP>, phaedrus@eneevax.UUCP (The Sophist) writes:
> What happens if one (by mistake) creates a file called `ctl-foo' and one
> didn't know that this was happening.  The next time they did an `ls'
> of that directory they'd get a `?' and it would be impossible to remove
> because they don't know the name.
> 
> Can someone explain this to me?

You can say "ls | cat -v".  Ls will print the control characters when its
output is not a terminal.
				Steve Schoch

duane@anasazi.UUCP (Duane Morse) (05/14/85)

> By mistake I created a file called ^G (ctl-G) from readnews.  When
> went back to the csh, I did an `ls' and it told me that I had file
> called `?'.  When I tried to `rm ?' it wouldn't go away.  However,
> I tried `rm ^G', that worked.  I think this is kind of strange.
> 
> What happens if one (by mistake) creates a file called `ctl-foo' and one
> didn't know that this was happening.  The next time they did an `ls'
> of that directory they'd get a `?' and it would be impossible to remove
> because they don't know the name.
> 
Most computer systems, large and small, allow one to create bizarre
file names, and all programmers accidentally create a file with a
bad name at some time or another. To see the file names in all
their glory, use "od -c .". You should be able to spot the rotten fish
among the good files. Before removing the file, however, be sure to
do an ls using the funny name to make sure that just typing the
name doesn't result in the shell expanding it to something else.
If that happens, you can either play games with character substitution
using ? or * until only the file you want turns up, or you can delete
the file by its i-node number.
-- 

Duane Morse	...!noao!terak!anasazi!duane
(602) 275-0302

foss@ihuxe.UUCP (foss) (05/15/85)

> By mistake I created a file called ^G (ctl-G) from readnews.  When
> went back to the csh, I did an `ls' and it told me that I had file
> called `?'.  When I tried to `rm ?' it wouldn't go away.  However,
> I tried `rm ^G', that worked.  I think this is kind of strange.
> 
> What happens if one (by mistake) creates a file called `ctl-foo' and one
> didn't know that this was happening.  The next time they did an `ls'
> of that directory they'd get a `?' and it would be impossible to remove
> because they don't know the name.
> 
> Can someone explain this to me?
> 
> -- 

If all else fails, you can always use:

rm -i *

which will interact with the terminal before removing files.

-----------

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/15/85)

> ... make sure that just typing the
> name doesn't result in the shell expanding it to something else.

Most often, using 'quoting' will solve that problem.

era@hao.UUCP (Ed Arnold) (05/20/85)

> By mistake I created a file called ^G (ctl-G) from readnews.  When
> went back to the csh, I did an `ls' and it told me that I had file
> called `?'.  When I tried to `rm ?' it wouldn't go away.  However,
> I tried `rm ^G', that worked.  I think this is kind of strange.
> 
> What happens if one (by mistake) creates a file called `ctl-foo' and one
> didn't know that this was happening.  The next time they did an `ls'
> of that directory they'd get a `?' and it would be impossible to remove
> because they don't know the name.
> 
> Can someone explain this to me?
> 
> -- 
> 			Pravin Kumar
> 
> Don't bother me! I'm on an emergency third rail power trip.
> 
> ARPA:   phaedrus!eneevax@maryland
> UUCP:   {seismo,allegra,brl-bmd}!umcp-cs!eneevax!phaedrus

You can see what those funny files really are by doing something like
"ls | od -c".  If a funny file contains something really awful,
like chars above 177(8), you may have to write a short C program
containing a call to unlink(), to get rid of them.
-- 
Ed Arnold
NCAR/SCD (Nat'l Ctr for Atmospheric Research/Scientific Computing Div.)
USPS: POB 3000, Boulder, CO  80307-3000
BELL: 303-497-1253
UUCP: {hplabs,nbires,brl-bmd,seismo,menlo70}!hao!scd-sa!era
CSNET: era@NCAR
ARPA: era%ncar@CSNET-RELAY

njh@root44.UUCP (Nigel Horne) (05/21/85)

Better than od -c'ing some temporary file I'd

ls | see
or
ls | cat -v

depending on your Un*x flavour.
-- 
--

Nigel Horne	<njh@root44.UUCP>
Root Computers Ltd.
{deccra,edai,glasgow,hrc63,ist,kcl-cs,qmc-cs,rlvd,pmllab,stc,warwick,
	ukc,unisoft}!root44!rootcl!njh

njh@root44.UUCP (Nigel Horne) (05/21/85)

Rather than ls > /tmp/foo, then od -c /tmp/foo,

I'd do either

ls | see

or

ls | cat -v

according to your Un*x flavour.
-- 
--

Nigel Horne	<njh@root44.UUCP>
Root Computers Ltd.
{deccra,edai,glasgow,hrc63,ist,kcl-cs,qmc-cs,rlvd,pmllab,stc,warwick,
	ukc,unisoft}!root44!rootcl!njh

jwp@uwmacc.UUCP (jeffrey w percival) (05/22/85)

Here's a problem that hasn't been covered in this discussion yet.
I have a file (2.9BSD) with a funny name.  I can type "od -c ."
to see the entry in the directory, and it looks like this:

   \t 360 200 035 002 \0 \0 \0 \0 and so on.

"ls" gives me a "    ????" and ll gives "./    ???? not found"
"rm -i *" says "not found" and passes right by this file, not
giving me a chance to remove it interactively.  I even tried a recursive
remove on the whole directory, non-interactively even, and all was
removed BUT this file.  Even unlink(2) needs a file name.  Any ideas?

-- 
	Jeff Percival ...!uwvax!uwmacc!jwp

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/23/85)

> "rm -i *" says "not found" and passes right by this file, ...

Try "rm -ri .".  If that doesn't work, clobber the inode with
whatever filesystem patching tools you have and run "fsck" or
equivalent.

era@hao.UUCP (Ed Arnold) (05/24/85)

> Here's a problem that hasn't been covered in this discussion yet.
> I have a file (2.9BSD) with a funny name.  I can type "od -c ."
> to see the entry in the directory, and it looks like this:
> 
>    \t 360 200 035 002 \0 \0 \0 \0 and so on.
> 
> "ls" gives me a "    ????" and ll gives "./    ???? not found"
> "rm -i *" says "not found" and passes right by this file, not
> giving me a chance to remove it interactively.  I even tried a recursive
> remove on the whole directory, non-interactively even, and all was
> removed BUT this file.  Even unlink(2) needs a file name.  Any ideas?
> 
> -- 
> 	Jeff Percival ...!uwvax!uwmacc!jwp

main()
{
   unlink("\t\360\200\035\002");
}
-- 

Ed Arnold * NCAR (Nat'l Center for Atmospheric Research)
PO Box 3000 * Boulder, CO  80307-3000 * 303-497-1253
era@ncar.csnet * era%ncar@csnet-relay.arpa * ...!hao!scd-sa!era

david@ecr1.UUCP (David Haynes) (05/27/85)

	There seems to be a problem with my previous message
	(or people are not interpreting it correctly). I suggested
	either "rm -i *" OR "rm -i .*" where '.' indicates a
	single character match of ANY sort and '*' indicates matching
	any number of repetitions of ANY character. (Some meta-language
	matching algorithms use '?' instead of '.'.

	As for the "ls | see" or "ls | cat -v" solutions, either
	of these is equally valid.

					David Haynes
					Emerald City Research Inc.
					..!utzoo!ecrhub!ecr1!david

	"Hey, Rocky! Watch me pull a rabbit out of my hat..."

drg@rlvd.UUCP (Duncan Gibson) (06/04/85)

I had a problem on an 11/23 where the /bin had an entry for make, and another
slightly corrupt one where "od -c /bin" gave the name as
	m a k e \0 \0 \0 357 \0 \0 (etc)
Using rm zapped the proper make, and any attempts after that failed because
the dead entry for the proper make had a zero i-number. I even thought about
little prog to unlink the funny name, but since unlink expects a NULL
terminated string as a file name there was nothing to do but clri and fsck!

sr@u1100a.UUCP (Steven Radtke) (06/14/85)

Two years ago, Stephen Uitti posted a small, useful utility called 
"rmfile" designed to remove or rename files with funny names.
I've got the original article and can re-post. I've used it on
UNIX (1100) Systems occassionally- meaning that the V7->SIII->SV
flavors apply.
Mail requests to me and I'll send the article and if a great interest
is displayed, I'll re-post to the appropriate newsgroups and notify
this group.

Hello, Purdue, is Mr. Uitti still there??

Steve Radtke
Bell Communications Research, Piscataway, N.J.
{houxm,ihnp4,bellcore,pyux*}!u1100a!sr