thewalt@RITZ.ce.cmu.edu (Chris Thewalt) (11/21/89)
I seem to have found a file name globbing bug, whenever the string to be expanded starts with a / the / seems to be dissappearing in the attempted expansion. For example, if I am in directory /bin and do ls /t* I get tar tee test time tp true (in the current dir) instead of tmp tp (in /) [bash 1.04 on MicroVAX II running Ultrix 2.2] Chris -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Christopher Robin Thewalt These opinions are not necessarily thewalt@ce.cmu.edu shared by my employer... Carnegie Mellon University
ramey@jello.csc.ti.com (Joe Ramey) (11/23/89)
In article <THEWALT.89Nov21083156@RITZ.ce.cmu.edu> thewalt@RITZ.ce.cmu.edu (Chris Thewalt) writes: I seem to have found a file name globbing bug, whenever the string to be expanded starts with a / the / seems to be dissappearing in the attempted expansion. For example, if I am in directory /bin and do ls /t* I get tar tee test time tp true (in the current dir) instead of tmp tp (in /) [bash 1.04 on MicroVAX II running Ultrix 2.2] Chris -- I came up with this fix for the problem. Note that even with this fix bash still behaves differently than sh and csh. Try echo /tm* //tm* ///tm* and notice that one / is removed from the last two examples. *** glob.c.ORIG Fri Sep 22 23:35:45 1989 --- glob.c Tue Nov 14 10:17:14 1989 *************** *** 415,421 **** } else { ! directory_len = filename - pathname; directory_name = (char *) alloca (directory_len + 1); bcopy (pathname, directory_name, directory_len); directory_name[directory_len] = '\0'; --- 415,424 ---- } else { ! if (filename == pathname) ! directory_len = 1; ! else ! directory_len = filename - pathname; directory_name = (char *) alloca (directory_len + 1); bcopy (pathname, directory_name, directory_len); directory_name[directory_len] = '\0';
chet@cwns1.INS.CWRU.Edu (Chet Ramey) (11/23/89)
In the referenced article, Chris Thewalt reports: > I seem to have found a file name globbing bug, whenever the string to > be expanded starts with a / the / seems to be dissappearing in the > attempted expansion. I have sent a fix for this to Brian. Chet Ramey Network Services Group "Where's my froggie?" Case Western Reserve University chet@ins.CWRU.Edu