trailing spaces in 1.7.0

Eric Blake
Mon May 12 18:58:00 GMT 2008

According to Corinna Vinschen on 5/10/2008 1:30 PM:
>>>> The problem is probably caused by the fact that 1.7.0 tries to use special 
>>>> path names to work around windows limitations:
>>>> $ mkdir 'dir '
>>>> $ rm -Rf 'dir '; echo $?
>>>> 1
>>>> $ ls -dQ d*
>>>> "dir "
>>>> $ rm -R 'dir '; echo $?
>>>> 0
>>>> $ ls -dQ d*
>>>> ls: cannot access "d*": No such file or directory
> So, when you debug this, you won't see valid trailing ASCII chars,
> but very likely a question mark as replacement char instead.

I still don't know why coreutils compiled under 1.5.x fails when run under 
1.7.0, but that's probably irrelevant, as I am now focusing on building 
coreutils-1.11 under 1.7.0.  I just verified that the 1.7.0 image, using 
openat() and friends, has no problem with "rm -Rf 'tdir '".

However, there definitely is a bug:

$ mkdir 'tdir '

creates 'tdir\uf020', but.

$ mkdir 'tdir /'

creates 'tdir ', and all subsequent attempts to stat() or open() "tdir " 
fail with ENOENT.  It took 'rmdir tdir~1', and relying on the DOS 8.3 
short name, to get rid of it.  So, the code that munges trailing spaces 
and dots needs to strip trailing slashes before doing the munging.

Don't work too hard, make some time for fun as well!

Eric Blake   

More information about the Cygwin-developers mailing list