Article View: gnu.bash.bug
Article #737globbing bug in 1.04
From: Ray Nickson
Date: Thu, 16 Nov 1989 01:12
Date: Thu, 16 Nov 1989 01:12
49 lines
1545 bytes
1545 bytes
[ 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++;
Technical Details
Message-ID:
<8911160112.AA20545@comp.vuw.ac.nz>Path:
arc1-ca.pugleaf.net!utzoo!telly!philmtl!atha!aunro!myrias!uunet!tut.cis.ohio-state.edu!comp.vuw.ac.nz!Ray.NicksonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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