develooper Front page | perl.perl5.porters | Postings from January 2008

Re: [PATCH] v5.8.8: File::Temp.pm (_gettemp): ignore dir -w test on Cygwin

Thread Previous
From:
Rafael Garcia-Suarez
Date:
January 7, 2008 08:57
Subject:
Re: [PATCH] v5.8.8: File::Temp.pm (_gettemp): ignore dir -w test on Cygwin
Message ID:
b77c1dce0801070857u33c8d326j93947103674014c1@mail.gmail.com
On 05/01/2008, Jari Aalto <jari.aalto@cante.net> wrote:
>
> [Please keep CC]
>
> Installing CPAN modules fails, because of File::Temp runs a -w check on
> directory. Under Cygwin (FAT32), following happens:
>
>     $ echo $CYGWIN
>     server
>
>     $ umask 002; mkdir test; ls -la test
>     dr-xr-xr-x  2 root None 0 Jan  3 21:17 .
>     dr-xr-xr-x 15 root None 0 Jul 25 16:03 ..
>
>     $ chmod 777 test; ls -la test
>     dr-xr-xr-x  2 root None 0 Jan  3 21:17 .
>     dr-xr-xr-x 15 root None 0 Jul 25 16:03 ..
>
>     $ touch test/new.file
>     $ ls -la test
>     dr-xr-xr-x  2 root None 0 Jan  3 21:17 .
>     dr-xr-xr-x 15 root None 0 Jul 25 16:03 ..
>     -rw-r--r--  1 root None 0 Jan  3 21:18 new.file
>
>     $ rm test/new.file ; echo $?
>     0
>
> See patch below,

Thanks, applied to File::Temp in bleadperl as change #32892, with a
small tweak (an "eq" comparison is enough for testing $^O).

Change 32892 by rgs@stcosmo on 2008/01/07 16:55:44

	Subject: [PATCH] v5.8.8: File::Temp.pm (_gettemp): ignore dir -w test on Cygwin
	From: Jari Aalto <jari.aalto@cante.net>
	Date: Sat, 05 Jan 2008 13:22:17 +0200
	Message-ID: <bq8034ba.fsf@blue.sea.net>

Affected files ...

... //depot/perl/lib/File/Temp.pm#38 edit

Differences ...

==== //depot/perl/lib/File/Temp.pm#38 (text) ====

@@ -203,7 +203,7 @@

 # Version number

-$VERSION = '0.20';
+$VERSION = '0.20_01';

 # This is a list of characters that can be used in random filenames

@@ -462,7 +462,13 @@
     ${$options{ErrStr}} = "Parent directory ($parent) is not a directory";
     return ();
   }
-  unless (-w $parent) {
+
+  if ( $^O eq 'cygwin' ) {
+      # No-op special case. Under Windows Cygwin (FAT32) the directory
+      # permissions cannot be trusted. Directories are always
+      # writable.
+  }
+  elsif (not -w $parent) {
     ${$options{ErrStr}} = "Parent directory ($parent) is not writable\n";
       return ();
   }

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