trailing spaces in 1.7.0

Corinna Vinschen corinna-cygwin@cygwin.com
Sat May 10 19:16:00 GMT 2008


On May 10 20:58, Corinna Vinschen wrote:
> On May 10 09:14, Eric Blake wrote:
> > This regression is interfering with the testsuite of a git checkout of 
> > autoconf, which tries to sanitize special pathnames by first testing if 
> > trailing spaces in directory names are supported (since in 1.5.25, the 
> > trailing space is stripped when the directory occurs in isolation, but not 
> > when used like 'dir /file'; worse, this happened even in managed mounts).  
> > 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
> >
> > Something in the -f codepath caused rm to exit with failure, but without 
> > any error message (if nothing else, coreutils should never exit non-zero 
> > without a message).  I'm still trying to get a debugging build of coreutils 
> > built under 1.7.0 to further investigate which syscall is causing rm to 
> > exit, but Corinna is more familiar with the underlying path name 
> > manipulation that allows the creation of a trailing space in the first 
> > place.
> 
> In theory it should always be possible.  I thought I have removed the
> code path which handles trailing spaces.  From the top of my head I
> have no idea what's causing that, sorry.

I just ran strace on that.

  $ rmdir 'dir '

works fine, apparently.  However, when you run the above

  $ rm -Rf 'dir '

under strace, there's something strange (I tested this in ~/tmp):

    0   65415 [main] rm 3700 chdir: dir '/home/corinna/tmp/dir'

Huh?  Why does rm try to change into 'dir' instead of into 'dir '?
Naturally this fails because 'dir' doesn't exist:

    0   65415 [main] rm 3700 symlink_info::check: 0xC0000034 = NtQueryAttributesFile (\??\C:\cygwin\home\corinna\tmp\dir)


HTH,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list