bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: avoid new "make distcheck" failure due to newer File::Tem


From: Jim Meyering
Subject: [PATCH] tests: avoid new "make distcheck" failure due to newer File::Temp
Date: Wed, 22 Apr 2009 21:51:45 +0200

After I updated F10 today, pulling in newer perl packages including
perl.x86_64 4:5.10.0-68.fc10, "make distcheck" began failing because
tests/CuTmpdir.pm stopped removing its temporary directories.

Here's the fix.

>From 2ad7da759490a5680844e1e4b6b4ac1d13b95d3b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 22 Apr 2009 21:41:10 +0200
Subject: [PATCH] tests: avoid new "make distcheck" failure due to newer 
File::Temp

With newer perl (e.g., Fedora 10's 4:5.10.0-68.fc10), tests/CuTmpdir.pm
stopped removing its temporary directories, with diagnostics like this:
  cannot remove path when cwd is /c/coreutils/tests/misc/seq.tmp-e2up \
  for /c/coreutils/tests/misc/seq.tmp-e2up: at \
  /usr/lib/perl5/5.10.0/File/Temp.pm line 902
Chdir out of the target directory before that code runs:
* tests/CuTmpdir.pm (END): chdir '..'.
(chmod_tree): Remove explicit "chdir $dir".
---
 tests/CuTmpdir.pm |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/tests/CuTmpdir.pm b/tests/CuTmpdir.pm
index 1e52640..0af5d94 100644
--- a/tests/CuTmpdir.pm
+++ b/tests/CuTmpdir.pm
@@ -49,16 +49,9 @@ sub chmod_tree
   defined $dir
     or return;

-  if (chdir $dir)
-    {
-      # Perform the equivalent of find . -type d -print0|xargs -0 chmod -R 700.
-      my $options = {untaint => 1, wanted => \&chmod_1};
-      find ($options, '.');
-    }
-  else
-    {
-      warn "$ME: failed to chdir to $dir: $!\n";
-    }
+  # Perform the equivalent of find "$dir" -type d -print0|xargs -0 chmod -R 
700.
+  my $options = {untaint => 1, wanted => \&chmod_1};
+  find ($options, $dir);
 }

 sub import {
@@ -105,6 +98,11 @@ sub import {
 }

 END {
+  # Move cwd out of the directory we're about to remove.
+  # This is required on some systems, and by some versions of File::Temp.
+  chdir '..'
+    or warn "$ME: failed to chdir to .. from $dir: $!\n";
+
   my $saved_errno = $?;
   chmod_tree;
   $? = $saved_errno;
--
1.6.3.rc1.205.g37f8




reply via email to

[Prev in Thread] Current Thread [Next in Thread]