fcopy -H bug

Edgar Fuß ef at math.uni-bonn.de
Fri Jul 1 13:48:54 CEST 2016


There's a subtle bug that causes fcopy -H -r to fail to copy a symlink in case it points to an existing directory, i.e.
	files/tmp/etc/CLASS -> /etc
The problem is that when purging non-leaf directories from the list of entries to process, the entry is purged because the class directory entry (files/tmp/etc/CLASS in the example above) is (a symlink to) a directory (/etc in the example above).

The attached patch seems to fix that.
-------------- n?chster Teil --------------
--- /usr/sbin/fcopy	2014-01-08 09:26:05.000000000 +0100
+++ /var/tmp/fcopy	2016-07-01 12:47:02.480376704 +0200
@@ -479,7 +479,7 @@
   my %ignoredirs;
   map $ignoredirs{$_}=1, at ignoredirs;
   File::Find::find({
-    wanted => sub { $has_subdirs{$File::Find::dir} |= -d},
+    wanted => sub { $has_subdirs{$File::Find::dir} |= !($opt_H && -l) && -d},
     preprocess => sub { grep ! (-d and exists($ignoredirs{$_})), at _}}, @ARGV);
 
   foreach (keys %has_subdirs) {


More information about the linux-fai-devel mailing list