From: Charles Bailey Date: Tue, 8 Apr 1997 16:33:56 +0000 (-0400) Subject: Special mkdir() for VMS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ebec1d4b2ca9c08d24035a369c7aa782aa058e66;p=p5sagit%2Fp5-mst-13.2.git Special mkdir() for VMS Subject: Re: Make failures in perl5.003_96 on AXP/VMS 6.2 Henrik Tougaard wrote: > > When I try to build Perl 5.003_96 on my AXP: > DEC C V5.3-006 on OpenVMS Alpha V6.2-1H3 > > I get the following error: . . . > Writing Descrip.MMS for Fcntl > MMS > %MMS-F-GWKNOPRN, There are no known sources for the current target > [--.LIB].EXISTS. > %MMS-F-ABORT, For target [.LIB]FCNTL.PM, CLI returned abort status: > %X10EE8064. That's a bug introduced with the win32 support in _94 -- it assumes dirname($dir) will return the name of $dir's parent, not $dir itself. I've appended a fix for that, and for a problem with the DECCRTL mkdir() (doesn't like trailing '/') that gets me to a clean build for _94. complex.t fails -- runs out of memory after sucking down around 70 MB, but I don't know whether it's a Perl bug or just a pathological test. I haven't got beyond _94 yet -- I've been swamped for the past couple weeks, and it's going to get worse before it gets better :-/ -- but I'll try to pick up the newer patches and test them as soon as I can. In the meantime, reports from other folks, doc updates (especially for the installation instructions), etc. are most welcome. :-) p5p-msgid: 01IHGOXN6MZM0004K3@hmivax.humgen.upenn.edu --- diff --git a/dosish.h b/dosish.h index 58fdb28..088f950 100644 --- a/dosish.h +++ b/dosish.h @@ -78,3 +78,4 @@ void Perl_DJGPP_init(); #define Stat(fname,bufptr) stat((fname),(bufptr)) #define Fstat(fd,bufptr) fstat((fd),(bufptr)) #define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index f4ee44f..395bd8a 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -662,11 +662,17 @@ sub dir_target { # too often :) my($self,@dirs) = @_; - my(@m,$dir); + my(@m,$dir,$targdir); foreach $dir (@dirs) { my($src) = $self->catfile($self->{PERL_INC},'perl.h'); my($targ) = $self->catfile($dir,'.exists'); - my($targdir) = dirname($targ); # Necessary because catfile may have adapted syntax of $dir to target OS + # Necessary because catfile may have adapted syntax of $dir to target OS + if ($Is_VMS) { # Just remove file name; dirspec is often in macro + ($targdir = $targ) =~ s:/?.exists$::; + } + else { # while elsewhere we expect to see the dir separator in $targ + $targdir = dirname($targ); + } next if $self->{DIR_TARGET}{$self}{$targdir}++; push @m, qq{ $targ :: $src @@ -1539,7 +1545,7 @@ usually solves this kind of problem. # all the installation path variables to literally $(PREFIX), so # the user can still say make PREFIX=foo my($configure_prefix) = $Config{'prefix'}; - $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS; + $configure_prefix = VMS::Filespec::unixify($configure_prefix) if $Is_VMS; $self->{PREFIX} ||= $configure_prefix; diff --git a/lib/File/Path.pm b/lib/File/Path.pm index 137e7bb..edec55d 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -113,6 +113,8 @@ sub mkpath { my(@created); foreach $path (@$paths) { next if -d $path; + # Logic wants Unix paths, so go with the flow. + $path = VMS::Filespec::unixify($path) if $Is_VMS; my $parent = dirname($path); push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent); print "mkdir $path\n" if $verbose; diff --git a/os2/os2ish.h b/os2/os2ish.h index 06a92a3..f8064d0 100644 --- a/os2/os2ish.h +++ b/os2/os2ish.h @@ -156,6 +156,7 @@ void *emx_realloc (void *, size_t); #define Stat(fname,bufptr) os2_stat((fname),(bufptr)) #define Fstat(fd,bufptr) fstat((fd),(bufptr)) #define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) #undef S_IFBLK #undef S_ISBLK @@ -167,6 +168,7 @@ void *emx_realloc (void *, size_t); #define Stat(fname,bufptr) stat((fname),(bufptr)) #define Fstat(fd,bufptr) fstat((fd),(bufptr)) #define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) #endif diff --git a/plan9/plan9ish.h b/plan9/plan9ish.h index c225d28..69af22c 100644 --- a/plan9/plan9ish.h +++ b/plan9/plan9ish.h @@ -113,6 +113,7 @@ #define Stat(fname,bufptr) stat((fname),(bufptr)) #define Fstat(fd,bufptr) fstat((fd),(bufptr)) #define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) /* getenv related stuff */ #define my_getenv(var) getenv(var) diff --git a/pp_sys.c b/pp_sys.c index f99bf29..201a376 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2710,7 +2710,7 @@ PP(pp_mkdir) TAINT_PROPER("mkdir"); #ifdef HAS_MKDIR - SETi( mkdir(tmps, mode) >= 0 ); + SETi( Mkdir(tmps, mode) >= 0 ); #else SETi( dooneliner("mkdir", tmps) ); oldumask = umask(0); diff --git a/unixish.h b/unixish.h index c6cb272..1a515cf 100644 --- a/unixish.h +++ b/unixish.h @@ -104,6 +104,7 @@ #define Stat(fname,bufptr) stat((fname),(bufptr)) #define Fstat(fd,bufptr) fstat((fd),(bufptr)) #define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) #ifdef PERL_SCO5 # define PERL_SYS_INIT(c,v) fpsetmask(0) diff --git a/vms/vms.c b/vms/vms.c index 8d957df..e287d86 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -455,6 +455,28 @@ kill_file(char *name) } /* end of kill_file() */ /*}}}*/ + +/*{{{int my_mkdir(char *,mode_t)*/ +int +my_mkdir(char *dir, mode_t mode) +{ + STRLEN dirlen = strlen(dir); + + /* 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. + */ + if (dir[dirlen-1] == '/') { + char *newdir = savepvn(dir,dirlen-1); + int ret = mkdir(newdir,mode); + Safefree(newdir); + return ret; + } + else return mkdir(dir,mode); +} /* end of my_mkdir */ +/*}}}*/ + + static void create_mbx(unsigned short int *chan, struct dsc$descriptor_s *namdsc) { diff --git a/vms/vmsish.h b/vms/vmsish.h index fd4434e..f5ef7a5 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -88,6 +88,7 @@ # define my_gconvert Perl_my_gconvert # define do_rmdir Perl_do_rmdir # define kill_file Perl_kill_file +# define my_mkdir Perl_my_mkdir # define my_utime Perl_my_utime # define rmsexpand Perl_rmsexpand # define rmsexpand_ts Perl_rmsexpand_ts @@ -349,6 +350,9 @@ struct utimbuf { /* Ditto for sys$hash_passwrod() . . . */ #define crypt my_crypt +/* Tweak arg to mkdir first, so we can tolerate trailing /. */ +#define Mkdir(dir,mode) my_mkdir((dir),(mode)) + /* Use our own stat() clones, which handle Unix-style directory names */ #define Stat(name,bufptr) flex_stat(name,bufptr) #define Fstat(fd,bufptr) flex_fstat(fd,bufptr) @@ -506,6 +510,7 @@ Pid_t my_waitpid _((Pid_t, int *, int)); char * my_gconvert _((double, int, int, char *)); int do_rmdir _((char *)); int kill_file _((char *)); +int my_mkdir _((char *, mode_t)); int my_utime _((char *, struct utimbuf *)); char * rmsexpand _((char *, char *, char *, unsigned)); char * rmsexpand_ts _((char *, char *, char *, unsigned)); diff --git a/win32/dosish.h b/win32/dosish.h index 8e423fa..7a312eb 100644 --- a/win32/dosish.h +++ b/win32/dosish.h @@ -78,6 +78,7 @@ void Perl_DJGPP_init(); #define Stat(fname,bufptr) win32_stat((fname),(bufptr)) #define Fstat(fd,bufptr) fstat((fd),(bufptr)) #define Fflush(fp) fflush(fp) +#define Mkdir(path,mode) mkdir((path),(mode)) #define my_getenv(var) getenv(var) /*