Skip Menu |
 

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 29513
Status: resolved
Priority: 0/
Queue: PathTools

People
Owner: Nobody in particular
Requestors: cpan [...] pjedwards.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 3.25
Fixed in: (no value)



Subject: Should canonpath() return? empty string or undef? (On VMS)
Download (untitled) / with headers
text/plain 3.4k
Hello and thanks for maintaining PathTools. The question/bug I have is: "What should File::Spec->canonpath() return?" On VMS (PathTools 3.17 and 3.25) I get undef: perl -e "use strict;use warnings;use File::Spec;print defined File::Spec->canonpath() ? 'def' : 'undef';" undef On UNIX (PathTools 3.23) I get empty string: perl -e "use strict;use warnings;use File::Spec;print defined File::Spec->canonpath() ? 'def' : 'undef';" def I think this is because of the return from canonpath, UNIX: return "$node$path"; VMS: return $path; I patched version 3.25 on VMS to return "$path" and it passes all it's tests*. Thanks for your thoughts on this. I got to this point from installing DBI 1.59 on VMS, and it calling catdir() with files as arguments and this causing warnings from the undefined value being returned from canonpath, example: perl -we "use strict;use File::Spec;print File::Spec->catdir('a','valid_dir_name');" [.a.valid_dir_name] perl -we "use strict;use File::Spec;print File::Spec->catdir('a','file_not_a_dir.txt');" Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 508. Use of uninitialized value in pattern match (m//) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 39. Use of uninitialized value in transliteration (tr///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 46. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 47. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 48. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 49. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 50. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 51. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 52. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 59. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 69. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 70. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 71. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 72. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 73. Use of uninitialized value in string eq at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 74. Use of uninitialized value in substitution (s///) at /perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 74. Use of uninitialized value in print at -e line 1. I'll post this to vmsperl and see if anyone has any thoughts. Cheers, Peter (Stig) Edwards *after making the following change: PathTools-3.25/t/tmpdir.t 17 local %ENV; 18 File::Spec::Win32->tmpdir; 19 ok scalar keys %ENV, 0, "Win32->tmpdir() shouldn't change the contents of %ENV"; 20 } ****** 17 if($^O eq 'VMS'){ 18 ok 1,1, 'Can not make list assignment to %ENV on this system, will exit if attempt to'; 19 } else { 20 local %ENV; 21 File::Spec::Win32->tmpdir; 22 ok scalar keys %ENV, 0, "Win32->tmpdir() shouldn't change the contents of %ENV"; 23 } 24 } END
Download (untitled) / with headers
text/plain 247b
Hi, Actually have a look at the latest version from SVN ( http://svn.perl.org/modules/PathTools ), which has a couple VMS fixes in there as well. Does that have any impact on what you're seeing? Looks like it's overdue for a release. -Ken
From: cpan [...] pjedwards.co.uk
Download (untitled) / with headers
text/plain 161b
I looked at http://svn.perl.org/modules/PathTools and the code I've been looking at in 3.25 is unchanged. No comments on vmsperl post yet. Peter (Stig) Edwards
Download (untitled) / with headers
text/plain 964b
On Thu Sep 20 17:52:47 2007, cpan@pjedwards.co.uk wrote: Show quoted text
> I looked at http://svn.perl.org/modules/PathTools and the code I've been > looking at in 3.25 is unchanged. > > No comments on vmsperl post yet. > > Peter (Stig) Edwards
So the consensus on vmsperl is that the current behaviour of File::Spec::VMS->canonpath is correct, passing in undef, should return undef, and not empty string. A significant reason is that empty string will result in a valid empty filename on VMS. Here is a quick test that I thought might be useful. (undef values did not work within t/spec.t) Peter (Stig) Edwards t/vms.t #!./perl BEGIN { if ($ENV{PERL_CORE}) { @INC = '../lib'; } } use File::Spec; use lib File::Spec->catdir('t', 'lib'); use Test::More; if( $^O eq 'VMS' ) { plan tests => 1; } else { plan skip_all => 'this is not VMS'; } # RT#29513, and perl.vmsperl 20070920 my $ret_undef = File::Spec->canonpath(undef); ok (!defined $ret_undef);
Download (untitled) / with headers
text/plain 379b
On Mon Sep 24 15:26:40 2007, cpan@pjedwards.co.uk wrote: Show quoted text
> So the consensus on vmsperl is that the current behaviour of > File::Spec::VMS->canonpath is correct, passing in undef, should > return undef, and not empty string.
That's good. I've been thinking that behavior should be extended to the other platforms too, for consistency. I'll do so for the next release. -Ken


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.