I've been pretty quiet the past week or so...it's mostly been a matter
of giving the piping code a good workout and getting CPAN.pm working
on VMS.

Here's a patch of some *other* fixes that were generated in the process:

    VMS.C
            checks for zero-length strings in mkdir, chdir, etc.
            ...you can get an ACCVIO if you, e.g.:  mkdir('',0777) 
            doesn't happen all the time, just when "string[-1]" isn't
            a valid memory location.

            I'm sure there's more places where we play fast'n'loose
            with indices into strings, but this fixes some of the 
            more obvious examples.

    lib/extutils/MM_VMS.PM

            quiet down the "search for a Perl" routine.

            Change "VMS-safing" of filenames from using separator "_" to
            "-"....this gives the more standard result of (e.g.)
                    HTML-Parser-1_07   (rather than HTML-Parser_1_07)
            (the use of "_" in the version #'s is unchanged) You should
            probably think of the "-"'s as substituting for "::"

            modify a double-use of "my $tmp" to get rid of warning

            add "tardist" DESCRIP.MMS target for generating tar archive

            tar archive creation needs [whatever...]  to include subdirs


--- vms/vms.c-orig      Mon Mar 27 11:15:41 2000
+++ vms/vms.c   Tue Mar 28 06:35:45 2000
@@ -897,6 +898,9 @@
   STRLEN dirlen = strlen(dir);
   dTHX;
 
+  /* zero length string sometimes gives ACCVIO */
+  if (dirlen == 0) return -1;
+
   /* CRTL mkdir() doesn't tolerate trailing /, since that implies
    * null file name/type.  However, it's commonplace under Unix,
    * so we'll allow it for a gain in portability.
@@ -1460,7 +2182,7 @@
       set_errno(EINVAL); set_vaxc_errno(SS$_BADPARAM); return NULL;
     }
     dirlen = strlen(dir);
-    while (dir[dirlen-1] == '/') --dirlen;
+    while (dirlen && dir[dirlen-1] == '/') --dirlen;
     if (!dirlen) { /* We had Unixish '/' -- substitute top of current tree */
       strcpy(trndir,"/sys$disk/000000");
       dir = trndir;
@@ -1486,7 +2208,7 @@
      *    ... do_fileify_dirspec("myroot",buf,1) ...
      * does something useful.
      */
-    if (!strcmp(dir+dirlen-2,".]")) {
+    if (dirlen >= 2 && !strcmp(dir+dirlen-2,".]")) {
       dir[--dirlen] = '\0';
       dir[dirlen-1] = ']';
     }
@@ -1516,7 +2238,7 @@
                  (dir[2] == '\0' || (dir[2] == '/' && dir[3] == '\0')))
           return do_fileify_dirspec("[-]",buf,ts);
       }
-      if (dir[dirlen-1] == '/') {    /* path ends with '/'; just add .dir;1 */
+      if (dirlen && dir[dirlen-1] == '/') {    /* path ends with '/'; just add .dir;1 
+*/
         dirlen -= 1;                 /* to last element */
         lastdir = strrchr(dir,'/');
       }
@@ -1543,7 +2265,7 @@
         } while ((cp1 = strstr(cp1,"/.")) != NULL);
         lastdir = strrchr(dir,'/');
       }
-      else if (!strcmp(&dir[dirlen-7],"/000000")) {
+      else if (dirlen >= 7 && !strcmp(&dir[dirlen-7],"/000000")) {
         /* Ditto for specs that end in an MFD -- let the VMS code
          * figure out whether it's a real device or a rooted logical. */
         dir[dirlen] = '/'; dir[dirlen+1] = '\0';
--- lib/ExtUtils/MM_VMS.pm-orig Mon Mar 27 11:16:34 2000
+++ lib/ExtUtils/MM_VMS.pm      Mon Mar 27 14:08:40 2000
@@ -231,7 +231,9 @@
 sub find_perl {
     my($self, $ver, $names, $dirs, $trace) = @_;
     my($name,$dir,$vmsfile,@sdirs,@snames,@cand);
+    my($rslt);
     my($inabs) = 0;
+    local *TCF;
     # Check in relative directories first, so we pick up the current
     # version of Perl if we're running MakeMaker as part of the main build.
     @sdirs = sort { my($absa) = $self->file_name_is_absolute($a);
@@ -277,15 +279,28 @@
     foreach $name (@cand) {
        print "Checking $name\n" if ($trace >= 2);
        # If it looks like a potential command, try it without the MCR
-       if ($name =~ /^[\w\-\$]+$/ &&
-            `$name -e "require $ver; print ""VER_OK\\n"""` =~ /VER_OK/) {
+        if ($name =~ /^[\w\-\$]+$/) {
+            open(TCF,">temp_mmvms.com") || die('unable to open temp file');
+            print TCF "\$ set message/nofacil/nosever/noident/notext\n";
+            print TCF "\$ $name -e \"require $ver; print \"\"VER_OK\\n\"\"\"\n";
+            close TCF;
+            $rslt = `\@temp_mmvms.com` ;
+            unlink('temp_mmvms.com');
+            if ($rslt =~ /VER_OK/) {
            print "Using PERL=$name\n" if $trace;
            return $name;
        }
+        }
        next unless $vmsfile = $self->maybe_command($name);
        $vmsfile =~ s/;[\d\-]*$//;  # Clip off version number; we can use a newer 
version as well
        print "Executing $vmsfile\n" if ($trace >= 2);
-        if (`MCR $vmsfile -e "require $ver; print ""VER_OK\\n"""` =~ /VER_OK/) {
+        open(TCF,">temp_mmvms.com") || die('unable to open temp file');
+        print TCF "\$ set message/nofacil/nosever/noident/notext\n";
+        print TCF "\$ mcr $vmsfile -e \"require $ver; print \"\"VER_OK\\n\"\"\" \n";
+        close TCF;
+        $rslt = `\@temp_mmvms.com`;
+        unlink('temp_mmvms.com');
+        if ($rslt =~ /VER_OK/) {
            print "Using PERL=MCR $vmsfile\n" if $trace;
            return "MCR $vmsfile";
        }
@@ -1018,7 +1033,7 @@
 
     # Sanitize these for use in $(DISTVNAME) filespec
     $attribs{VERSION} =~ s/[^\w\$]/_/g;
-    $attribs{NAME} =~ s/[^\w\$]/_/g;
+    $attribs{NAME} =~ s/[^\w\$]/-/g;
 
     return ExtUtils::MM_Unix::dist($self,%attribs);
 }
@@ -1194,8 +1209,8 @@
                           s/.*[:>\/\]]//;       # Trim off dir spec
                           $upcase ? uc($_) : $_;
                         } split ' ', $self->eliminate_macros($self->{OBJECT});
-       my($tmp,@lines,$elt) = '';
-       my $tmp = shift @omods;
+        my($tmp, @lines,$elt) = '';
+       $tmp = shift @omods;
        foreach $elt (@omods) {
            $tmp .= ",$elt";
                if (length($tmp) > 80) { push @lines, $tmp;  $tmp = ''; }
@@ -1652,6 +1667,9 @@
 zipdist : $(DISTVNAME).zip
        $(NOECHO) $(NOOP)
 
+tardist : $(DISTVNAME).tar$(SUFFIX)
+       $(NOECHO) $(NOOP)
+
 $(DISTVNAME).zip : distdir
        $(PREOP)
        $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) [.$(DISTVNAME)...]*.*;
@@ -1661,7 +1679,7 @@
 $(DISTVNAME).tar$(SUFFIX) : distdir
        $(PREOP)
        $(TO_UNIX)
-       $(TAR) "$(TARFLAGS)" $(DISTVNAME).tar [.$(DISTVNAME)]
+        $(TAR) "$(TARFLAGS)" $(DISTVNAME).tar [.$(DISTVNAME)...]
        $(RM_RF) $(DISTVNAME)
        $(COMPRESS) $(DISTVNAME).tar
        $(POSTOP)
--
 Drexel University       \V                     --Chuck Lane
----------------->--------*------------<[EMAIL PROTECTED]
     (215) 895-1545      / \  Particle Physics  [EMAIL PROTECTED]
FAX: (215) 895-5934        /~~~~~~~~~~~         [EMAIL PROTECTED]

Reply via email to