NetBSD-Bugs archive

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

bin/40386: vi(1) filename completion no longer works



>Number:         40386
>Category:       bin
>Synopsis:       vi(1) filename completion no longer works
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 13 12:55:00 +0000 2009
>Originator:     M. Levinson
>Release:        NetBSD 5.99.6 from 2009-01-08
>Organization:
>Environment:
     $NetBSD: ex_argv.c,v 1.2 2008/12/05 22:51:42 christos Exp $
Architecture: x86_64
Machine: amd64
>Description:
        Filename completion in vi no longer works as expected because
        revision 1.2 of dist/nvi/ex/ex_argv.c changed the name of a variable
        in argv_exp2(), probably to avoid shadowing another variable with
        the same name in the same function, but one of the renamed variable's
        three occurrences was left unchanged. As a result the wrong pointer
        is now passed to strdup(3).

>How-To-Repeat:
        Set vi's filec variable, e.g. with :set filec=<some character>.
        Type :e followed by the beginning of a filename, then the filec
        character; vi lists all of the files in its working directory
        (including non-matches, as if no filename prefix had been given).

>Fix:

--- src/dist/nvi/ex/ex_argv.c
+++ src/dist/nvi/ex/ex_argv.c
@@ -220,7 +220,7 @@ argv_exp2(SCR *sp, EXCMD *excp, const CHAR_T *cmd, size_t 
cmdlen)
                        *p = '\0';
                        INT2CHAR(sp, bp + SHELLOFFSET, 
                                 STRLEN(bp + SHELLOFFSET) + 1, np1, nlen);
-                       d = strdup(np);
+                       d = strdup(np1);
                        rval = argv_lexp(sp, excp, d);
                        free (d);
                        break;



Home | Main Index | Thread Index | Old Index