Skip Menu |

This queue is for tickets about the File-Remove CPAN distribution.

Report information
The Basics
Id: 13369
Status: resolved
Worked: 10 min
Priority: 0/
Queue: File-Remove

People
Owner: RSOD [...] cpan.org
Requestors: dha [...] panix.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.29
Fixed in: (no value)



Subject: File::Remove test 1_directories.t fails under OS X 10.4.1 (perl 5.8.6)
Download dirfail
application/octet-stream 13.9k

Message body not shown because it is not plain text.

From: Graham
[guest - Wed Jun 22 12:13:32 2005]: Show quoted text
>
Yeah, I've got the same problem. Show quoted text
cpan> install File::Remove
Running install for module File::Remove Running make for R/RS/RSOD/File-Remove-0.29.tar.gz Is already unwrapped into directory /Users/graham/.cpan/build/File-Remove-0.29 Has already been processed within this session Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/ lib', 'blib/arch')" t/*.t t/0_use............ok t/1_directories....ok 178/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 180/0# Failed test (t/1_directories.t at line 120) t/1_directories....ok 182/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 184/0# Failed test (t/1_directories.t at line 120) t/1_directories....ok 186/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 188/0# Failed test (t/1_directories.t at line 120) t/1_directories....ok 190/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 192/0# Failed test (t/1_directories.t at line 120) t/1_directories....ok 194/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 196/0# Failed test (t/1_directories.t at line 120) t/1_directories....ok 198/0# Failed test (t/1_directories.t at line 116) t/1_directories....NOK 199# Failed test (t/1_directories.t at line 120) t/1_directories....ok 202/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 204/0# Failed test (t/1_directories.t at line 120) t/1_directories....ok 206/0# Failed test (t/1_directories.t at line 116) t/1_directories....ok 208/0# Failed test (t/1_directories.t at line 120) # Failed test (t/1_directories.t at line 125) t/1_directories....NOK 209# Failed test (t/1_directories.t at line 125) t/1_directories....ok 211/0# Failed test (t/1_directories.t at line 125) t/1_directories....NOK 213# Failed test (t/1_directories.t at line 125) t/1_directories....ok 215/0# Failed test (t/1_directories.t at line 125) t/1_directories....ok 217/0# Failed test (t/1_directories.t at line 125) t/1_directories....NOK 219# Failed test (t/1_directories.t at line 125) t/1_directories....ok 220/0# Failed test (t/1_directories.t at line 125) t/1_directories....ok 257/0# Failed test (t/1_directories.t at line 147) # Failed test (t/1_directories.t at line 149) t/1_directories....ok 261/0# Failed test (t/1_directories.t at line 147) t/1_directories....NOK 262# Failed test (t/1_directories.t at line 149) t/1_directories....ok 264/0# Failed test (t/1_directories.t at line 147) t/1_directories....NOK 265# Failed test (t/1_directories.t at line 149) t/1_directories....ok 267/0# Failed test (t/1_directories.t at line 147) t/1_directories....NOK 268# Failed test (t/1_directories.t at line 149) t/1_directories....ok 270/0# Failed test (t/1_directories.t at line 147) # Failed test (t/1_directories.t at line 149) t/1_directories....ok 273/0# Failed test (t/1_directories.t at line 147) t/1_directories....NOK 274# Failed test (t/1_directories.t at line 149) t/1_directories....ok 276/0# Failed test (t/1_directories.t at line 147) # Failed test (t/1_directories.t at line 149) t/1_directories....ok 279/0# Failed test (t/1_directories.t at line 147) t/1_directories....NOK 280# Failed test (t/1_directories.t at line 149) # Failed test (t/1_directories.t at line 154) t/1_directories....NOK 282# Failed test (t/1_directories.t at line 154) t/1_directories....ok 283/0# Failed test (t/1_directories.t at line 154) # Failed test (t/1_directories.t at line 154) # Failed test (t/1_directories.t at line 154) # Failed test (t/1_directories.t at line 154) # Failed test (t/1_directories.t at line 154) # Failed test (t/1_directories.t at line 154) t/1_directories....ok 298/0# Looks like you failed 48 tests of 369. t/1_directories....dubious Test returned status 48 (wstat 12288, 0x3000) DIED. FAILED tests 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209-210, 213, 216, 219, 222, 225, 228, 231, 259-260, 262-263, 265-266, 268-269, 271-272, 274-275, 277-278, 280-282, 285, 288, 291, 294, 297, 300, 303 Failed 48/369 tests, 86.99% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------ - t/1_directories.t 48 12288 369 48 13.01% 179 181 183 185 187 189 191 193 195 197 199 201 203 205 207 209-210 213 216 219 222 225 228 231 259-260 262-263 265-266 268-269 271-272 274- 275 277-278 280-282 285 288 291 294 297 300 303 Failed 1/2 test scripts, 50.00% okay. 48/370 subtests failed, 87.03% okay. make: *** [test_dynamic] Error 2 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force
Try this on for size. I found two problems. First, I think I made the call to delete() more robust, by not converting the path to HFS, and just telling delete() these are aliases. Previously it worked mostly by accident. You were sending in a broken path, to delete(): Mac::Glue automatically handles Unix paths, though since this was passed as a string to the Finder, it understands the HFS path you used. What really surprises me though is that it was a broken HFS path, since if it starts with Foo:, then Foo is supposed to be the volume name. But it worked ... however, the new code is more proper. (There's no need for rel2abs since Mac::Glue's call to create the alias handles that on the fly.) And if you tried to send in multiple paths, it would likely have not worked: I think you were only deleting one thing at a time, as delete() would require an arrayref, not an array, as its argument. I also cached the $glue object for a performance enhancement. The more important problem is that directory permissions prevented root from telling the Finder to trash these things. In Panther it was more permissive in that regard, and would ask permission to delete the file with a dialog box, but now in Tiger it won't work at all. So I added a bunch of chmod calls to the test.
--- lib/File/Remove.pm 2004-12-04 16:34:48.000000000 -0800 +++ /Users/pudge/Remove.pm 2005-07-12 15:57:19.000000000 -0700 @@ -106,6 +106,8 @@ $VERSION = '0.29'; +our $glue; + sub expand (@) { my @args; @@ -176,13 +178,14 @@ $unlink = \&Win32::FileOp::Recycle; $rmdir = \&Win32::FileOp::Recycle; } elsif ($^O eq 'darwin') { - our $f; - eval 'use Mac::Glue ();'; - die "Can't load Mac::Glue::Finder to support the Trash Can: \$@ = $@" if length $@; + unless ($glue) { + eval 'use Mac::Glue ();'; + die "Can't load Mac::Glue::Finder to support the Trash Can: \$@ = $@" if length $@; + $glue = Mac::Glue->new('Finder'); + } my $code = sub { - my $f = Mac::Glue->new("Finder"); - my @files = map { s{^:}{}; $_ } map { s{/}{:}g; $_ } map { File::Spec->rel2abs($_) } @_; - $f->delete(@files); + my @files = map { Mac::Glue::param_type(Mac::Glue::typeAlias() => $_) } @_; + $glue->delete(\@files); }; $unlink = $code; $rmdir = $code; --- t/1_directories.t 2004-12-04 16:34:18.000000000 -0800 +++ /Users/pudge/1_directories.t 2005-07-12 15:57:22.000000000 -0700 @@ -29,6 +29,7 @@ "!-e: $path"; ok mkdir($path), "mkdir: $path"; +chmod 0777, $path; ok -e $path, "-e: $path"; } @@ -47,6 +48,7 @@ "!-e: $path"; ok mkdir($path), "mkdir: $path"; +chmod 0777, $path; ok -e $path, "-e: $path"; } @@ -65,6 +67,7 @@ "!-e: $path"; ok mkdir($path), "mkdir: $path"; +chmod 0777, $path; ok -e $path, "-e: $path"; } @@ -106,6 +109,7 @@ "!-e: $path"; ok mkdir($path), "mkdir: $path"; +chmod 0777, $path; ok -e $path, "-e: $path"; } @@ -137,6 +141,7 @@ "!-e: $path"; ok mkdir($path), "mkdir: $path"; +chmod 0777, $path; ok -e $path, "-e: $path"; } @@ -166,6 +171,7 @@ "!-e: $path"; ok mkdir($path), "mkdir: $path"; +chmod 0777, $path; ok -e $path, "-e: $path"; }
RT-Send-CC: CNANDOR
Patch applied with especial gratitude for the explanation. I never did figure out the permissions issue with the Trash can - that resolves it! Thank you so very much. DHA, can you try 0.30 (on CPAN)?