[Vim-vms] RE: Vim 6.2 crash

Coen Engelbarts coen.engelbarts at cmg.nl
Thu Jan 15 20:13:46 CET 2004


Bram Moolenaar wrote on Tuesday 13 January 2004 17:10:

 > Coen Engelbarts wrote:
 >
 >> For the vim-dev readers:
 >> Does the file name expansion use vim's regexp code?
 >> Can you tell me which function or source file does the file name
 >> expansion?
 >
 > Yes, the regexp engine is used for finding matching file names.
 > Except when a machine-specific function should be used.
 > gen_expand_wildcards() is the central function.

 >> In short, the command:
 >>      :n \[.syntax]<CTRL-D>
 >> crashes vim on VMS.


Right, I tried the debugger (with the vim62-106 sources) and the crash 
occurs here, calling mch_expandpath():

gen_expand_wildcards():
     /*
      * If there are wildcards: Expand file names and add each match to
      * the list.  If there is no match, and EW_NOTFOUND is given, add
      * the pattern.
      * If there are no wildcards: Add the file name if it exists or
      * when EW_NOTFOUND is given.
      */
     if (mch_has_exp_wildcard(p))
  add_pat = mch_expandpath(&ga, p, flags);
 }


     int
mch_expandpath(garray_T *gap, char_u *path, int flags)
{
     int  i,cnt = 0;
     char *cp;
     vms_match_num = 0;

<CRASH HERE:>
     cnt = decc$to_vms(decc$translate_vms(vms_fixfilename(path)), 
vms_wproc, 1, 0);
            /* allow wild, no dir */
<CRASHED HERE>
     if (cnt > 0)
             cnt = vms_match_num;
     for (i = 0; i < cnt; i++)
     {
             if (mch_getperm(vms_fmatch[i]) >= 0) /* add existing file */
                addfile(gap, vms_fmatch[i], flags);
     }
     return cnt;
}

The next function in the crash-stack is without sources, so the crash 
must be must be in decc$translate_vms() or decc$to_vms(), not in 
vms_fixfilename() or vms_wproc().

Now I remember why I don't like 4 function calls in a single line... :-(

At the crash:
     path = "\[.syntax]"
     vms_wproc = 1585289
     vms_fixfilename(path) returns "\[.syntax]"
     breakpoint in vms_wproc() is not triggered


"HELP CC Run-time_functions decc$to_vms decc$translate_vms":
     decc$translate_vms

        Translates OpenVMS file specifications to UNIX style file
        specifications.

        Syntax:

             #include <unixlib.h>

             char *decc$translate_vms(const char *vms_filespec);


"HELP CC Run-time_functions decc$to_vms":
     decc$to_vms

        Converts UNIX style file specifications to OpenVMS file
        specifications.

        Syntax:

             #include <unixlib.h>

             int decc$to_vms(const char *unix_style_filespec,
             int (*action_rtn)(char *unix_style_filespec,
             int type_of_file), int allow_wild, int no_directory);


I'm pretty sure that decc$translate_vms() barfs on the escaped "\[", 
because it is not a valid "OpenVMS file specification"
OK, now what?
I could remove the "\" before this call, but I suppose vim will need it 
later on.
I'll try to figure this out later.
Meanwhile, any hints are very welcome.

Coen




More information about the Vim-vms mailing list