Path: utzoo!telly!philmtl!atha!aunro!myrias!uunet!tut.cis.ohio-state.edu!comp.vuw.ac.nz!Ray.Nickson From: Ray.Nickson@comp.vuw.ac.nz (Ray Nickson) Newsgroups: gnu.bash.bug Subject: globbing bug in 1.04 Message-ID: <8911160112.AA20545@comp.vuw.ac.nz> Date: 16 Nov 89 01:12:31 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 49 [ The patches in the message about HPUX job control also apply to 1.04; sorry, forgot to say so. ] Globbing doesn't work right: bash$ ls abc abd bbc cbc bash$ echo *[^c] abc abd bbc cbc bash$ I understand that *[^c] should match any sequence of characters followed by a single character which is not a c; only abd should have matched. The problem is that [^c] is matching the null at the end of each filename. The patch below seems to fix this. -rgn -- Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand. Ray.Nickson@comp.vuw.ac.nz + 64 4 721000x8593 *** glob.c.orig Sat Sep 23 16:35:45 1989 --- glob.c Wed Nov 15 16:16:54 1989 *************** *** 144,152 **** case '[': { ! register char c1 = *t++; int invert; invert = ((*p == '!') || (*p == '^')); if (invert) p++; --- 145,157 ---- case '[': { ! register char c1 = *t; int invert; + if (*t++ == '\0') + return 0; + + invert = ((*p == '!') || (*p == '^')); if (invert) p++;