Change 30186 by [EMAIL PROTECTED] on 2007/02/09 23:00:34
Integrate:
[ 26225]
Subject: Re: [perl #37716] Re: File::Compare broken for filenames with
whitespace
From: [EMAIL PROTECTED] (Andreas J. Koenig)
Date: Tue, 29 Nov 2005 08:07:19 +0100
Message-ID: <[EMAIL PROTECTED]>
[ 26245]
Replace ^M by a space in test for bug #37716, to make
Cygwin happy (found by Yitzchak)
[ 26337]
Fix lib/File/Compare.t test failures on Win32
Change 26225, updated by 26245, added a test for another filename with
a trailing space but failed to open the new filehandle in binary mode
To compound matters, creating a file called "foo " on Win32 "succeeds"
but actually creates a file called just "foo", so we have actually
overwritten the original file with this non-binary mode version, and
hence some of the original tests started failing too!
(And because of this the new test doesn't actually add anything new on
Win32 at the moment, but right now I can't think of a filename that
would have failed under 2-arg open but succeeds with 3-arg open, which
was the purpose of this test)
[ 26413]
Subject: [PATCH] make failing cygwin test TODO'd
From: Yitzchak Scott-Thoennes <[EMAIL PROTECTED]>
Date: Mon, 19 Dec 2005 03:41:12 -0800
Message-ID: <[EMAIL PROTECTED]>
[ 26889]
special VMS handling no longer needed since we now close the file
Affected files ...
... //depot/maint-5.8/perl/lib/File/Compare.pm#2 integrate
... //depot/maint-5.8/perl/lib/File/Compare.t#2 integrate
Differences ...
==== //depot/maint-5.8/perl/lib/File/Compare.pm#2 (text) ====
Index: perl/lib/File/Compare.pm
--- perl/lib/File/Compare.pm#1~17645~ 2002-07-19 12:29:57.000000000 -0700
+++ perl/lib/File/Compare.pm 2007-02-09 15:00:34.000000000 -0800
@@ -8,7 +8,7 @@
require Exporter;
use Carp;
-$VERSION = '1.1003';
+$VERSION = '1.1005';
@ISA = qw(Exporter);
@EXPORT = qw(compare);
@EXPORT_OK = qw(cmp compare_text);
@@ -34,7 +34,7 @@
} elsif (ref(\$from) eq 'GLOB') {
*FROM = $from;
} else {
- open(FROM,"<$from") or goto fail_open1;
+ open(FROM,"<",$from) or goto fail_open1;
unless ($text_mode) {
binmode FROM;
$fromsize = -s FROM;
@@ -48,7 +48,7 @@
} elsif (ref(\$to) eq 'GLOB') {
*TO = $to;
} else {
- open(TO,"<$to") or goto fail_open2;
+ open(TO,"<",$to) or goto fail_open2;
binmode TO unless $text_mode;
$closeto = 1;
}
==== //depot/maint-5.8/perl/lib/File/Compare.t#2 (text) ====
Index: perl/lib/File/Compare.t
--- perl/lib/File/Compare.t#1~17645~ 2002-07-19 12:29:57.000000000 -0700
+++ perl/lib/File/Compare.t 2007-02-09 15:00:34.000000000 -0800
@@ -14,7 +14,7 @@
}
}
-print "1..12\n";
+print "1..13\n";
use File::Compare qw(compare compare_text);
@@ -78,6 +78,10 @@
my $template = File::Spec->catfile(File::Spec->tmpdir, 'fcmpXXXX');
my($tfh,$filename) = mkstemp($template);
+ # NB. The trailing space is intentional (see [perl #37716])
+ open my $tfhSP, ">", "$filename "
+ or die "Could not open '$filename ' for writing: $!";
+ binmode($tfhSP);
{
local $/; #slurp
my $fh;
@@ -86,29 +90,28 @@
my $data = <$fh>;
print $tfh $data;
close($fh);
+ print $tfhSP $data;
+ close($tfhSP);
}
seek($tfh,0,0);
$donetests[0] = compare($tfh, 'README');
$donetests[1] = compare($filename, 'README');
unlink0($tfh,$filename);
+ $donetests[2] = compare('README', "$filename ");
+ unlink "$filename ";
};
-print "# problems when testing with a tempory file\n" if $@;
+print "# problem '$@' when testing with a temporary file\n" if $@;
-if (@donetests == 2) {
+if (@donetests == 3) {
print "not " unless $donetests[0] == 0;
- print "ok 11\n";
- if ($^O eq 'VMS') {
- # The open attempt on FROM in File::Compare::compare should fail
- # on this OS since files are not shared by default.
- print "not " unless $donetests[1] == -1;
- print "ok 12\n";
- }
- else {
- print "not " unless $donetests[1] == 0;
- print "ok 12\n";
- }
+ print "ok 11 # fh/file [$donetests[0]]\n";
+ print "not " unless $donetests[1] == 0;
+ print "ok 12 # file/file [$donetests[1]]\n";
+ print "not " unless $donetests[2] == 0;
+ print "ok 13 # ";
+ print "TODO" if $^O eq "cygwin"; # spaces after filename silently trunc'd
+ print " file/fileCR [$donetests[2]]\n";
}
else {
- print "ok 11# Skip\nok 12 # Skip Likely due to File::Temp\n";
+ print "ok 11# Skip\nok 12 # Skip\nok 13 # Skip Likely due to File::Temp\n";
}
-
End of Patch.