develooper Front page | perl.perl5.porters | Postings from September 2001

[PATCH perl@12180] angle bracket filespec problem on VMS

From:
Craig A. Berry
Date:
September 25, 2001 16:16
Subject:
[PATCH perl@12180] angle bracket filespec problem on VMS
Message ID:
5.1.0.14.0.20010925154848.036887d8@exchi01
Both square and angle brackets are valid delimiters for the directory part 
of a file spec on VMS.  In the (luckily rare) situation where the device 
part of the name is a rooted logical and the directory name is enclosed in 
angle brackets, Perl goes boom, as you can see below.  The patch at the end 
of this message fixes that and addresses one other potential angle bracket 
problem.

$ perl -e "print (-d 'sys$sysroot:[mom$system]' ? 'Y' : 'N');"
Y
$ perl -e "print (-d 'sys$sysroot:<mom$system>' ? 'Y' : 'N');"
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000000000002, PC=FFFFFFFF8055C960, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
  image    module    routine             line      rel PC           abs PC      
                                            0 FFFFFFFF8055C960 FFFFFFFF8055C960
 DBGPERLSHR  VMS  mp_do_fileify_dirspec
                                        79190 000000000000B0C0 000000000010DB30
 DBGPERLSHR  VMS  Perl_flex_stat        82589 0000000000017098 0000000000119B08
 DBGPERLSHR  DOIO  Perl_my_stat         42749 0000000000004D5C 00000000000D94DC
 DBGPERLSHR  PP_SYS  Perl_pp_ftdir      44559 000000000000E47C 00000000001A932C
 DBGPERLSHR  RUN  Perl_runops_debug     41511 0000000000000248 0000000000125448
 DBGPERLSHR  PERL  S_run_body           43115 0000000000003714 00000000000A7934
 DBGPERLSHR  PERL  perl_run             43036 000000000000333C 00000000000A755C
 NDBGPERL  PERLMAIN  main               41534 00000000000001E0 00000000000201E0
 NDBGPERL  PERLMAIN  __main                 0 00000000000000A0 00000000000200A0
                                            0 FFFFFFFF83701414 FFFFFFFF83701414

--- vms/vms.c;-0        Mon Sep 17 13:14:08 2001
+++ vms/vms.c   Tue Sep 25 17:17:18 2001
@@ -2766,6 +2766,10 @@
       dir[--dirlen] = '\0';
       dir[dirlen-1] = ']';
     }
+    if (dirlen >= 2 && !strcmp(dir+dirlen-2,".>")) {
+      dir[--dirlen] = '\0';
+      dir[dirlen-1] = '>';
+    }
 
     if ((cp1 = strrchr(dir,']')) != NULL || (cp1 = strrchr(dir,'>')) != NULL) {
       /* If we've got an explicit filename, we can just shuffle the string. */
@@ -2988,6 +2992,7 @@
           else if (ts) New(1312,retspec,retlen+16,char);
           else retspec = __fileify_retbuf;
           cp1 = strstr(esa,"][");
+          if (!cp1) cp1 = strstr(esa,"]<");
           dirlen = cp1 - esa;
           memcpy(retspec,esa,dirlen);
           if (!strncmp(cp1+2,"000000]",7)) {

[end of patch]




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About