Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 12 May 2004 16:08:35 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: bash: tab completion failure from (but not at) / Message-ID: <20040512140835.GJ12030@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <200405110629 DOT i4B6TlAX025137 AT mx3 DOT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200405110629.i4B6TlAX025137@mx3.redhat.com> User-Agent: Mutt/1.4.2i 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 > ls /home/ > or > md5sum /usloc > md5sum /usr/local/ > > and so on. > > Now, all I am getting from ls /ho or md5sum /us 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 > cd stash > > or (cf. problem described above) if I actually *move* to / I can press > > ls ho > ls home/ > or > md5sum usloc > 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/