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 Cygwin/Win32 case_tolerant improvement #9359
Comments
From @rurbanThis patch is a significant performance improvement of my initial -- |
From @rurbanpl-CYG18-case_tol-511.patchdifforig perl-current/lib/File
2008-06-01 rurban@cpan.org
* File::Spec->case_tolerant performance improvement on cygwin and Win32.
Esp. noticable in Module::Build.
diff -u perl-current/lib/File/Spec.pm.orig
--- perl-current/lib/File/Spec.pm.orig 2008-02-12 16:12:46.000000000 +0100
+++ perl-current/lib/File/Spec.pm 2008-06-01 14:10:03.703125000 +0200
@@ -3,7 +3,7 @@
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.2701';
+$VERSION = '3.2702';
$VERSION = eval $VERSION;
my %module = (MacOS => 'Mac',
@@ -166,6 +166,7 @@
Returns a true or false value indicating, respectively, that alphabetic
case is not or is significant when comparing file specifications.
+Cygwin and Win32 accept an optional drive argument.
$is_case_tolerant = File::Spec->case_tolerant();
diff -u perl-current/lib/File/Spec/Cygwin.pm.orig
--- perl-current/lib/File/Spec/Cygwin.pm.orig 2008-02-12 16:12:46.000000000 +0100
+++ perl-current/lib/File/Spec/Cygwin.pm 2008-06-01 14:08:20.781250000 +0200
@@ -4,7 +4,7 @@
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.2701';
+$VERSION = '3.2702';
@ISA = qw(File::Spec::Unix);
@@ -107,16 +107,23 @@
Override Unix. Cygwin case-tolerance depends on managed mount settings and
as with MsWin32 on GetVolumeInformation() $ouFsFlags == FS_CASE_SENSITIVE,
indicating the case significance when comparing file specifications.
+Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem. (TODO)
+See http://cygwin.com/ml/cygwin/2007-07/msg00891.html
+Accepts on optional drive-mount argument.
Default: 1
=cut
+my %tmp_case_tolerant;
sub case_tolerant () {
return 1 unless $^O eq 'cygwin'
and defined &Cygwin::mount_flags;
my $drive = shift;
+ $drive = shift if $drive =~ /^File::Spec/;
+ my $windrive;
if (! $drive) {
+ $windrive = 'C:';
my @flags = split(/,/, Cygwin::mount_flags('/cygwin'));
my $prefix = pop(@flags);
if (! $prefix || $prefix eq 'cygdrive') {
@@ -126,18 +133,19 @@
} else {
$drive = "$prefix/c";
}
+ } else {
+ $windrive = Cygwin::posix_to_win_path($drive);
}
+ return $tmp_case_tolerant{$drive} if exists $tmp_case_tolerant{$drive};
my $mntopts = Cygwin::mount_flags($drive);
if ($mntopts and ($mntopts =~ /,managed/)) {
+ $tmp_case_tolerant{$drive} = 0;
return 0;
}
- eval { require Win32API::File; } or return 1;
- my $osFsType = "\0"x256;
- my $osVolName = "\0"x256;
- my $ouFsFlags = 0;
- Win32API::File::GetVolumeInformation($drive, $osVolName, 256, [], [], $ouFsFlags, $osFsType, 256 );
- if ($ouFsFlags & Win32API::File::FS_CASE_SENSITIVE()) { return 0; }
- else { return 1; }
+ require File::Spec::Win32;
+ $windrive =~ s/\\$//;
+ $tmp_case_tolerant{$drive} = File::Spec::Win32::case_tolerant($windrive);
+ return $tmp_case_tolerant{$drive};
}
=back
diff -u perl-current/lib/File/Spec/Win32.pm.orig
--- perl-current/lib/File/Spec/Win32.pm.orig 2008-02-12 16:12:47.000000000 +0100
+++ perl-current/lib/File/Spec/Win32.pm 2008-06-01 14:08:57.250000000 +0200
@@ -5,7 +5,7 @@
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.2701';
+$VERSION = '3.2702';
@ISA = qw(File::Spec::Unix);
@@ -83,13 +83,20 @@
indicating the case significance when comparing file specifications.
Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem.
See http://cygwin.com/ml/cygwin/2007-07/msg00891.html
+Accepts on optional drive-letter argument.
Default: 1
=cut
sub case_tolerant () {
+ my @ver = Win32::GetOSVersion();
+ # From XP on this is disabled.
+ if ($ver[4] >= 2 and $ver[1] >= 5 and $ver[2] >= 1) { return 1; }
+ if ($ver[4] < 2) { return 1; } # Win32s,95,ME are always case_tolerant.
eval { require Win32API::File; } or return 1;
- my $drive = shift || "C:";
+ my $drive = shift || "C:";Accepts on optional drive-letter argument.
+
+ $drive = shift if $drive =~ /^File::Spec/;
my $osFsType = "\0"x256;
my $osVolName = "\0"x256;
my $ouFsFlags = 0;
|
From @rurbanpl-CYG18-case_tol-510.patchdifforig perl-5.10.0/lib/File
2008-06-01 rurban@cpan.org
* File::Spec->case_tolerant performance improvement on cygwin and Win32.
Esp. noticable in Module::Build.
diff -u perl-5.10.0/lib/File/Spec.pm.orig
--- perl-5.10.0/lib/File/Spec.pm.orig 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/File/Spec.pm 2008-06-01 14:02:07.687500000 +0200
@@ -3,7 +3,7 @@
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.2501';
+$VERSION = '3.2502';
$VERSION = eval $VERSION;
my %module = (MacOS => 'Mac',
diff -u perl-5.10.0/lib/File/Spec/Cygwin.pm.orig
--- perl-5.10.0/lib/File/Spec/Cygwin.pm.orig 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/File/Spec/Cygwin.pm 2008-06-01 14:02:16.671875000 +0200
@@ -4,7 +4,7 @@
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.2501';
+$VERSION = '3.2502';
@ISA = qw(File::Spec::Unix);
@@ -104,16 +104,23 @@
Override Unix. Cygwin case-tolerance depends on managed mount settings and
as with MsWin32 on GetVolumeInformation() $ouFsFlags == FS_CASE_SENSITIVE,
indicating the case significance when comparing file specifications.
+Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem. (TODO)
+See http://cygwin.com/ml/cygwin/2007-07/msg00891.html
+Accepts on optional drive-mount argument.
Default: 1
=cut
+my %tmp_case_tolerant;
sub case_tolerant () {
if ($^O ne 'cygwin') {
return 1;
}
my $drive = shift;
+ $drive = shift if $drive =~ /^File::Spec/;
+ my $windrive;
if (! $drive) {
+ $windrive = 'C:';
my @flags = split(/,/, Cygwin::mount_flags('/cygwin'));
my $prefix = pop(@flags);
if (! $prefix || $prefix eq 'cygdrive') {
@@ -123,18 +130,19 @@
} else {
$drive = "$prefix/c";
}
+ } else {
+ $windrive = Cygwin::posix_to_win_path($drive);
}
+ return $tmp_case_tolerant{$drive} if exists $tmp_case_tolerant{$drive};
my $mntopts = Cygwin::mount_flags($drive);
if ($mntopts and ($mntopts =~ /,managed/)) {
+ $tmp_case_tolerant{$drive} = 0;
return 0;
}
- eval { require Win32API::File; } or return 1;
- my $osFsType = "\0"x256;
- my $osVolName = "\0"x256;
- my $ouFsFlags = 0;
- Win32API::File::GetVolumeInformation($drive, $osVolName, 256, [], [], $ouFsFlags, $osFsType, 256 );
- if ($ouFsFlags & Win32API::File::FS_CASE_SENSITIVE()) { return 0; }
- else { return 1; }
+ require File::Spec::Win32;
+ $windrive =~ s/\\$//;
+ $tmp_case_tolerant{$drive} = File::Spec::Win32::case_tolerant($windrive);
+ return $tmp_case_tolerant{$drive};
}
=back
diff -u perl-5.10.0/lib/File/Spec/Win32.pm.orig
--- perl-5.10.0/lib/File/Spec/Win32.pm.orig 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/File/Spec/Win32.pm 2008-06-01 14:02:25.312500000 +0200
@@ -5,7 +5,7 @@
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.2501';
+$VERSION = '3.2502';
@ISA = qw(File::Spec::Unix);
@@ -83,13 +83,20 @@
indicating the case significance when comparing file specifications.
Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem.
See http://cygwin.com/ml/cygwin/2007-07/msg00891.html
+Accepts on optional drive-letter argument.
Default: 1
=cut
sub case_tolerant () {
+ my @ver = Win32::GetOSVersion();
+ # From XP on this is disabled.
+ if ($ver[4] >= 2 and $ver[1] >= 5 and $ver[2] >= 1) { return 1; }
+ if ($ver[4] < 2) { return 1; } # Win32s,95,ME are always case_tolerant.
eval { require Win32API::File; } or return 1;
- my $drive = shift || "C:";
+ my $drive = shift || "C:";Accepts on optional drive-letter argument.
+
+ $drive = shift if $drive =~ /^File::Spec/;
my $osFsType = "\0"x256;
my $osVolName = "\0"x256;
my $ouFsFlags = 0;
|
From @tseeI tried to apply the newer patch to PathTools, but the changes don't t/Spec.t ................ 1/598 # Test 68 got: "Undefined subroutine |
The RT System itself - Status changed from 'new' to 'open' |
From @tseeCf. https://rt.cpan.org/Ticket/Display.html?id=48182 When resolving this, please also note that in the CPAN RT instance. |
I'm 99% certain this was fixed in efa159b There are bits of this in that so there's no way these patches will ever apply. |
Migrated from rt.perl.org#55156 (status was 'open')
Searchable as RT55156$
The text was updated successfully, but these errors were encountered: