develooper Front page | perl.perl5.porters | Postings from May 2015

[perl #125112] [PATCH] Fix unixify when beginning with current directory.

Thread Previous
From:
Craig A . Berry
Date:
May 6, 2015 00:10
Subject:
[perl #125112] [PATCH] Fix unixify when beginning with current directory.
Message ID:
rt-4.0.18-4634-1430871034-1267.125112-75-0@perl.org
# New Ticket Created by  Craig A. Berry 
# Please include the string:  [perl #125112]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125112 >


This is a very small, platform-specific fix that I would prefer to see in 5.22 rather than try to remember to apply to blead later and do all the paperwork to get it into 5.22.1.  I can’t argue that it’s a recent regression as it’s apparently been the way it is a long time, but it was easy to fix and easy to test once noticed.  In any case patch follows both inline and attached.

VMS::Filespec::unixify has been truncating its return value and
returning early when the input begins with [] meaning the current
directory.  If there was nothing else, we've been getting the right
answer:

    [] --> ./

but if there was a file portion of the name it's been getting
omitted:

    []foo.txt --> ./

which is now fixed.  Looks like it's been broken since inception
in 5.002, though only with the specific [] case and not if there
was an explicit device or directory name.
---
 ext/VMS-Filespec/t/filespec.t | 3 +++
 vms/vms.c                     | 5 ++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ext/VMS-Filespec/t/filespec.t b/ext/VMS-Filespec/t/filespec.t
index f556703..6d421e1 100644
--- a/ext/VMS-Filespec/t/filespec.t
+++ b/ext/VMS-Filespec/t/filespec.t
@@ -110,6 +110,7 @@ __lyrics_:[__are_.__very_^.__sappy_]__but_^.__rhymes_^.__are_.__true_    unixify
 [.$(macro)]	unixify	$(macro)/ ^
 ^+foo.tmp	unixify +foo.tmp ^
 [-.foo^_^_bar]	unixify ../foo\ \ bar/ ^
+[]foo.tmp	unixify	./foo.tmp ^

 # and back again
 /__some_/__where_/__over_/__the_.__rainbow_    vmsify  __some_:[__where_.__over_]__the_.__rainbow_ ^
@@ -135,6 +136,8 @@ foo-bar-0^.01/	vmsify [.foo-bar-0_01] [.foo-bar-0^.01]
 \ foo.tmp	vmsify ^_foo.tmp ^
 +foo.tmp	vmsify ^+foo.tmp ^
 ../foo\ \ bar/	vmsify [-.foo^_^_bar] ^
+./foo.tmp	vmsify []foo.tmp ^
+
 # Fileifying directory specs
 __down_:[__the_.__garden_.__path_]     fileify __down_:[__the_.__garden_]__path_.dir;1 ^
 [.__down_.__the_.__garden_.__path_]    fileify [.__down_.__the_.__garden_]__path_.dir;1 ^
diff --git a/vms/vms.c b/vms/vms.c
index 0364415..953d8b8 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -7073,9 +7073,8 @@ int_tounixspec(const char *spec, char *rslt, int * utf8_fl)
   else {  /* the VMS spec begins with directories */
     cp2++;
     if (*cp2 == ']' || *cp2 == '>') {
-      *(cp1++) = '.'; *(cp1++) = '/'; *(cp1++) = '\0';
-      PerlMem_free(tmp);
-      return rslt;
+      *(cp1++) = '.';
+      *(cp1++) = '/';
     }
     else if ( *cp2 != '^' && *cp2 != '.' && *cp2 != '-') { /* add the implied device */
       if (getcwd(tmp, VMS_MAXRSS-1 ,1) == NULL) {
—
2.2.1

———————
$ perl -"V"
Summary of my perl5 (revision 5 version 21 subversion 12) configuration:
  Snapshot of: 996de84d864e2452987ceb29dbf56f1ce92846b8
  Platform:
    osname=VMS, osvers=V8.4, archname=VMS_IA64
    uname='VMS alma V8.4 HP rx2600  (1.50GHz/6.0MB)'
    config_args='-"Dusedevel" -"DDEBUGGING" -"Dusevmsdebug" -"des"'
    hint=none, useposix=false, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=undef, bincompat5005=undef
  Compiler:
    cc='CC/DECC', ccflags ='/Include=[]/Standard=Relaxed_ANSI/Prefix=All/Obj=.obj /NOANSI_ALIAS/float=ieee/ieee=denorm/NAMES=(SHORTENED)/Define=_USE_STD_STAT=1',
    optimize='/List/Debug/NoOpt',
    cppflags='undef'
    ccversion='70390020', gccversion='', gccosandvers='undef'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=1
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='Link/nodebug', ldflags ='/Debug/Trace/Map'
    libpth=/sys$share /sys$library
    libs=
    perllibs=
    libc=(DECCRTL), so=exe, useshrplib=true, libperl=undef
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_vms.xs, dlext=exe, d_dlsymun=undef, ccdlflags=''
    cccdlflags='', lddlflags='/Share'


Characteristics of this PERLSHR image:
  Compile-time options: DEBUGGING HAS_TIMES HAVE_INTERP_INTERN PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_EXTERNAL_GLOB
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        PERL_USE_DEVEL USE_IEEE USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO
                        USE_PERL_ATOF VMS_DO_SOCKETS
                        VMS_SHORTEN_LONG_SYMBOLS
  Built under VMS
  Compiled at May  2 2015 11:08:42
  %ENV:
    PERLSHR="perl_root:[000000]perlshr.exe"
    PERL_ROOT="DSA0:[craig.blead.]"
  @INC:
    /perl_root/lib/site_perl/VMS_IA64
    /perl_root/lib/site_perl
    /perl_root/lib/VMS_IA64/5_21_12
    /perl_root/lib
    .

________________________________________
Craig A. Berry
mailto:craigberry@mac.com

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser


Thread Previous


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