tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

fix? for old pd-ksh file completion bug



This bug has existed for many years now (I'm sure I fixed it about 10
years ago ;-)

If you have $HOME/tmp and it is the only thing in $HOME which starts
with tm, then  

echo $HOME/tm<TAB> (or ESC ESC for emacs)

should expand to  /homes/sjg/tmp/
but what you get is /homes/sjg/tm<SPACE>

The reason is that add_glob() in edit.c stops as soon as it hits '$'.
So it ends up returning "$HOME/tm" rather than "$HOME/tm*".
Removing that as per the patch below, fixes this bug, but I can't think
what it might break...

--sjg

Index: edit.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/edit.c,v
retrieving revision 1.21
diff -u -p -r1.21 edit.c
--- edit.c      28 Jan 2007 20:20:25 -0000      1.21
+++ edit.c      3 Jun 2010 21:19:31 -0000
@@ -880,7 +880,7 @@ add_glob(str, slen)
        for (s = toglob; *s; s++) {
                if (*s == '\\' && s[1])
                        s++;
-               else if (*s == '*' || *s == '?' || *s == '$'
+               else if (*s == '*' || *s == '?'
                         || (s[1] == '(' /*)*/ && strchr("*+?@!", *s)))
                        break;
                else if (ISDIRSEP(*s))


Home | Main Index | Thread Index | Old Index