bug: cygwin/bash: echo > %ED does wrong thing

Steve Morris sjm@judgement.com
Mon May 31 21:10:00 GMT 1999


"echo >%ED" creates the wrong file. The %E gets expanded to "error 2".

Here are some experiments that bound the behavior:

experiment 1:

bash-2.02$ ls -l
total 0
bash-2.02$ echo > %ED
% ls -l
total 1
-rw-r--r--  1 0               Everyone   1 May 15 13:43 error 2D

experiment 2:

$bash-2.02$ mv "error 2D" %ED
$bash-2.02$ ls -l
total 1
-rw-r--r--  1 0               Everyone   1 May 15 13:43 %ED

experement 3:

$bash-2.02$ cmd
(C) Copyright 1985-1996 Microsoft corp
C:\sjm\tmp> echo >%ED
C:\sjm\tmp> exit
$bash-2.02$ ls -ltr
total 1
-rw-r--r--  1 0               Everyone   5 May 15 13:58 %ED
$bash-2.02$ 

I have tracked this down (see example C program in my earlier post) to
the open function call. With a little investigation I have discovered
that % in the open filename arguement can have other strange
behaviors. %% in a file name causes open to get an error. I can't find any
combination that creates a file with with a % in the name so I can't
figure out how to code a workaround.

Notice that the file can be created other ways, i.e. by renaming the
file. Also cmd.com doesn't have such unexpected behavior.

What exactly in the open command is doing this? I assume this is in
cygwin somewhere. For the life of me I can't think of which package
might want to use % as a quote character.

cygwin 20.1, NT 4

Steve Morris



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list