Mail Archives: cygwin/2004/05/12/10:09:00
On May 11 07:25, fergus AT bonhard DOT uklinux DOT net wrote:
> Just lately (all recent snapshots including 20040510) I'm noticing a failure
> with tab completion for pathnames beginning /. Thus, I would expect, and in
> the past have achieved
>
> ls /ho<TAB>
> ls /home/
> or
> md5sum /us<TAB>loc<TAB>
> md5sum /usr/local/
>
> and so on.
>
> Now, all I am getting from ls /ho<TAB> or md5sum /us<TAB> is a system beep
> (i.e. "error!" or some kind of uncertainty or ambiguity affecting bash's
> interpretation).
>
> For pathnames starting elsewhere, there's not a problem. E.g. from HOME I
> can press
>
> cd st<TAB>
> cd stash
>
> or (cf. problem described above) if I actually *move* to / I can press
>
> ls ho<TAB>
> ls home/
> or
> md5sum us<TAB>loc<TAB>
> md5sum usr/local/
I've tracked it down. The problem is a combination of a tiny bug in the
new path handling code in Cygwin and a tiny bug in bash.
In bash, the path "/" is accidentally converted to "//" before it tries
to call opendir() on it. On any other POSIX system, that doesn't matter
since "//" has no special meaning. On Cygwin (or better, Windows), "//"
means the start of an SMB path. The old path conversion code in Cygwin
had no problems with it, the new code uncovered both, the bug in Cygwin
and this bug in bash. The Cygwin patch is already applied.
I've attached the patch to bash, which I applied to solve that issue.
Roland, would you mind to create a new bash version and eventually
send the patch upstream?
Corinna
--- bashline.c.ORIG 2004-05-12 16:03:50.821896000 +0200
+++ bashline.c 2004-05-12 15:51:13.906536800 +0200
@@ -2144,7 +2144,10 @@ bash_directory_completion_hook (dirname)
return 1;
}
len1 = strlen (temp1);
- if (temp1[len1 - 1] == '/')
+ /* temp1 is definitely an absolute pathname. So if the length is
+ <= 2 and the path ends in a slash, it's either "/" or "//".
+ In both cases, no further slash must be appended. */
+ if (len1 > 2 && temp1[len1 - 1] == '/')
{
len2 = strlen (temp2);
temp2 = (char *)xrealloc (temp2, len2 + 2);
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Co-Project Leader mailto:cygwin AT cygwin DOT com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -