Subject: [Vim-vms] Vim 6.2 crash

From: "Tomas Stehlik" <[email-masked]>
Date: Wed, 14 Jan 2004 18:56:18 +0000

Hi all,

(sorry previous one, now without Rich text editor)

I had tested reported problem on my OpenVMS 7.3.1 (with latest patches - 
Install rating 1) and it runs well (I can't reproduce crash).

look at

$ prod sho hist
----------------------------------- ----------- ----------- 
--------------------
PRODUCT                                         KIT TYPE    OPERATION   DATE 
AND TIME
----------------------------------- ----------- ----------- 
--------------------
DEC AXPVMS VMS731_ACRTL V3.0      Patch          Install           
08-JAN-2004 18:57:06
DEC AXPVMS VMS731_SYS V5.0          Patch          Install           
08-JAN-2004 18:15:15
DEC AXPVMS VMS731_UPDATE V2.0    Patch          Install           
08-JAN-2004 17:44:41

....

Don't you miss some critical fix? (with description like)

KIT DESCRIPTION:

     2.1  Installation Rating:

     INSTALL_1 :  To be installed by all customers.

Better CRTL library can also help, but now I can't say which one helps.

http://www4.itrc.hp.com/service/patch/mainPage.do

(be sure to use just propper ones for your VMS version)

Tomas

>Hi all,

>
>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?
>
>That's rather direct, but I'm a bit worried that you will all stop reading 
>after the word "VMS" ;-)
>
>
>I think I found a new bug in vim/VMS 6.2.106 (I use the downloaded binary 
>from http://www.polarfox.com/vim/). The following actions consistently 
>crash vim: In the VIM directory, start vim and type:      :n syntax/ For a 
>few moments the prompt will show      :n syntax/... and finally      :n 
>\[.syntax]2html.vim If you now press or , vim will crash:      Vim: Caught 
>deadly signal BUS
>
>      Vim: Finished.
>
>In short, the command:      :n \[.syntax] crashes vim on VMS.
>

_________________________________________________________________
Online hry! Spousta zabavy s MSN Messenger 6.1 
http://www.msn.cz/procmessenger

---

From: Coen Engelbarts <[email-masked]>
Date: Thu, 15 Jan 2004 20:13:46 +0100

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

---

From: Coen Engelbarts <[email-masked]>
Date: Thu, 15 Jan 2004 20:15:52 +0100

Tomas Stehlik wrote on Wednesday 14 January 2004 19:56:

 > I had tested reported problem on my OpenVMS 7.3.1 (with latest
 > patches - Install rating 1) and it runs well (I can't reproduce
 > crash).

I tried to reproduce it on the nearest vim 7.3.1 system. Vim did not 
crash or hang, but the filename-completion did not work either.
However, my user environment on that (new) system is still a bit flakey...

I think I pinned down the problem to a decc$translate_vms("\[.syntax]") 
I want to remove the "\" there.

 > Better CRTL library can also help, but now I can't say which one

Yes, I suppose that your system has a more solid decc$translate_vms().
I'm not sure if I can get "my" system patched though, because it is not 
"my" system. ;-)
I probably need to change the vim code.

Thanks for you help!

Coen

---

From: Bram Moolenaar <[email-masked]>
Date: Thu, 15 Jan 2004 20:19:03 +0100

Coen Engelbarts wrote:

[lots of debugging, crash in mch_expandpath() ]

> I'm pretty sure that decc$translate_vms() barfs on the escaped "\[", because
> it is not a valid "OpenVMS file specification"

OK, this makes sense.  If you look in the Unix version of
mch_expandpath() you will notice that it recognizes backslashes before
wildcard characters.  They are used to make something like "\*" result
in a literal "*", instead of being expanded as a wildcard.

What should probably happen for VMS is to remove the extra backslashes
before characters that are not really wildcard characters for VMS.  The
rem_backslash() or backslash_halve() function can be used for this.  It
may require copying the name into a buffer (probably allocated memory).
The Unix version of the mch_expandpath() function can function as an
example.

> I could remove the "\" before this call, but I suppose vim will need it

If I remember correctly it will be added back automatically for the
resulting list of files.

I hope you can make a patch for this and try it out.

-- 
            ### Hiroshima 45, Chernobyl 86, Windows 95 ###

 /// Bram Moolenaar -- [email-masked] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///

---

From: "Tomas Stehlik" <[email-masked]>
Date: Fri, 16 Jan 2004 14:28:18 +0000

Hi all,

I had reported problems with decc$to_vms to ITRC forum for OpenVMS languages 
on Jun 8, 2003 see:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=54749

decc$to_vms goes to infinite loop on OpenVMS 7.3.1. Try it itself with 
attached test taken directly from docu.

Now I also remind that VMS731_F11X patch help to solve it together with

$define decc$efs_case_preserve ENABLE

for ODS5 format disks.

I hope it is now corrected in last ECO update.

Tomas