Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File::Spec niggles (5.004_05, 5.005_03, 5.005_57) #137

Closed
p5pRT opened this issue Jul 1, 1999 · 5 comments
Closed

File::Spec niggles (5.004_05, 5.005_03, 5.005_57) #137

p5pRT opened this issue Jul 1, 1999 · 5 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Jul 1, 1999

Migrated from rt.perl.org#942 (status was 'resolved')

Searchable as RT942$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 1, 1999

From mjtg@cus.cam.ac.uk

File​::Spec​::*​::tmpdir doesn't exist in 5.004_05 or 5.005_03.
Is it intended to add it?


File​::Spec​::VMS​::tmpdir is documented (and implemented) as

  Returns a string representation of the first writable directory
  from the following list or '' if none are writable​:

  /sys$scratch
  $ENV{TMPDIR}

This differs from all other File​::Spec​::*, which always put $ENV{TMPDIR}
first. Is there a good reason for this non-portability, in a module
specifically meant to avoid this sort of thing?


In 5.004_05 and 5.005_03, File​::Spec​::* contains the line

@​ISA = qw(File​::Spec​::Unix);

but not

require File​::Spec​::Unix;

(This is OK in 5.005_57.)


File​::Spec​::OS2 says

  See File​::Spec​::Unix for a documentation of the methods provided
  there. This package overrides the implementation of these methods, not
  the semantics.

But the semantics of e.g. tmpdir differ - the list of directories tried
is different.

Mike Guy
--
And here's a mention of 'perl', because perlbugtron incorrectly
claims

  No 'perl' in Body (below) and no 'perlbug' in To(perlbug@​perl.com
  ) or Cc()

But as you can see, To​: does contain 'perlbug'. Sigh.

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 25, 2000

From [Unknown Contact. See original ticket]

All of the issues listed in this bug appear to be fixed in 5.6.0, except
for​:

File​::Spec​::VMS​::tmpdir is documented (and implemented) as

Returns a string representation of the first writable directory
from the following list or '' if none are writable​:

    /sys$scratch
    $ENV\{TMPDIR\}

This differs from all other File​::Spec​::*, which always put $ENV{TMPDIR}
first. Is there a good reason for this non-portability, in a module
specifically meant to avoid this sort of thing?

This patch changes that behaviour to match the others. Is this correct for
VMS? If not, I suggest someone put a note in the documentation explaining
why not.

Inline Patch
diff -uir perl-5.6.0/lib/File/Spec/VMS.pm perl-5.6.work/lib/File/Spec/VMS.pm
--- perl-5.6.0/lib/File/Spec/VMS.pm     Tue Mar 21 03:55:48 2000
+++ perl-5.6.work/lib/File/Spec/VMS.pm  Tue Jul 25 16:02:35 2000
@@ -251,15 +251,15 @@
 Returns a string representation of the first writable directory
 from the following list or '' if none are writable:
 
-    sys$scratch
     $ENV{TMPDIR}
+    sys$scratch
 
 =cut
 
 my $tmpdir;
 sub tmpdir {
     return $tmpdir if defined $tmpdir;
-    foreach ('sys$scratch', $ENV{TMPDIR}) {
+    foreach ($ENV{TMPDIR}, 'sys$scratch') {
        next unless defined && -d && -w _;
        $tmpdir = $_;
        last;


-spp
@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented May 9, 2003

From @cwest

[RT_System - Tue Jul 25 06​:06​:23 2000]​:

Could a VMS knowlegable person please tell me in what order the temp
dirs should be checked? If they should be flip-flopped I'll supply the appropriate
patch to the latest File​::Spec​::VMS. Thanks.

  Casey West (bug patrol)

All of the issues listed in this bug appear to be fixed in 5.6.0, except
for​:

File​::Spec​::VMS​::tmpdir is documented (and implemented) as

Returns a string representation of the first writable directory
from the following list or '' if none are writable​:

    /sys$scratch
    $ENV\{TMPDIR\}

This differs from all other File​::Spec​::*, which always put $ENV{TMPDIR}
first. Is there a good reason for this non-portability, in a module
specifically meant to avoid this sort of thing?

This patch changes that behaviour to match the others. Is this correct for
VMS? If not, I suggest someone put a note in the documentation explaining
why not.

diff -uir perl-5.6.0/lib/File/Spec/VMS.pm perl-5.6.work/lib/File/Spec/VMS.pm
--- perl-5.6.0/lib/File/Spec/VMS.pm Tue Mar 21 03​:55​:48 2000
+++ perl-5.6.work/lib/File/Spec/VMS.pm Tue Jul 25 16​:02​:35 2000
@​@​ -251,15 +251,15 @​@​
Returns a string representation of the first writable directory
from the following list or '' if none are writable​:

- sys$scratch
$ENV{TMPDIR}
+ sys$scratch

=cut

my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- foreach ('sys$scratch', $ENV{TMPDIR}) {
+ foreach ($ENV{TMPDIR}, 'sys$scratch') {
next unless defined && -d && -w _;
$tmpdir = $_;
last;

-spp

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 9, 2004

From guest@guest.guest.xxxxxxxx

[mjtg@​cus.cam.ac.uk - Thu Jul 01 02​:24​:47 1999]​:
File​::Spec​::*​::tmpdir doesn't exist in 5.004_05 or 5.005_03.
Is it intended to add it?

I don't quite understand what this means but tmpdir() exists where
appropriate in 5.8.x.

----------------------------------------

File​::Spec​::VMS​::tmpdir is documented (and implemented) as

Returns a string representation of the first writable directory
from the following list or '' if none are writable​:

    /sys$scratch
    $ENV\{TMPDIR\}

This differs from all other File​::Spec​::*, which always put $ENV{TMPDIR}
first. Is there a good reason for this non-portability, in a module
specifically meant to avoid this sort of thing?

tmpdir() is simply there to give you some sort of usable system temp
directory, there's no guarantee what its going to be and if you're using
File​::Spec->tmpdir correctly it shouldn't matter. Differences in where
it looks should not matter, this is exactly the sort of thing File​::Spec
shields you from.

----------------------------------------

In 5.004_05 and 5.005_03, File​::Spec​::* contains the line

@​ISA = qw(File​::Spec​::Unix);

but not

require File​::Spec​::Unix;

(This is OK in 5.005_57.)

Long since fixed.

----------------------------------------

File​::Spec​::OS2 says

See File​::Spec​::Unix for a documentation of the methods provided
there\. This package overrides the implementation of these methods\, not
the semantics\.

But the semantics of e.g. tmpdir differ - the list of directories tried
is different.

The tmpdir() differences are documented. File​::Spec->tmpdir is
documented that the choice of environment variables to honor and
directories to look in is different per platform so File​::Spec​::OS2 is
not changing the semantics of tmpdir() by changing what it looks at.

@p5pRT p5pRT closed this Jun 25, 2004
@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 25, 2004

@schwern - Status changed from 'open' to 'resolved'

atoomic added a commit to atoomic/perl5 that referenced this issue Nov 7, 2019
References Perl#137

(cherry picked from commit fb6dad1b13facfbcdf834a6b95db2320410d7c78)
Signed-off-by: Nicolas R <atoomic@cpan.org>
atoomic added a commit that referenced this issue Nov 8, 2019
References #137

(cherry picked from commit fb6dad1b13facfbcdf834a6b95db2320410d7c78)
Signed-off-by: Nicolas R <atoomic@cpan.org>
atoomic added a commit that referenced this issue Nov 8, 2019
References #137

(cherry picked from commit fb6dad1b13facfbcdf834a6b95db2320410d7c78)
Signed-off-by: Nicolas R <atoomic@cpan.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.