Hello,

the function set_mode{} of the file fcopy always change the values time, uid, guid and modes of the target file equal whether the values are different or not. And to change this values although this are equal produce a false alarm in the IDS.

So I have adapted the function and now the script only change the values when one of this are really difficult.

Here is the patch:
--- fcopy.orig    2010-11-03 14:07:57.000000000 +0100
+++ fcopy    2010-11-10 12:44:29.000000000 +0100
@@ -250,9 +250,31 @@
   # use the values from the source file
   my ($sourcefile,$destfile,$class) = @_;
   my ($uid,$gid,$owner,$group,$mode);
+
   # get mtime,uid,gid,mode from source file
   my ($stime,@defmodes) = (stat("$sourcefile/$class"))[9,4,5,2];

+  # get mtime,uid,gid,mode from destination file
+  my ($dtime,@ddefmodes) = (stat("$destfile"))[9,4,5,2];
+
+  # compare time,uid,gid and mode of source file and target file
+  # if different: change the values
+  my $change = "false";
+
+  if ($stime == $dtime) {
+ if (($ddefmodes[0] == $defmodes[0]) && ($ddefmodes[1] == $defmodes[1]) && ($ddefmodes[2] == $defmodes[2])){
+      #  do nothing
+    }
+    else {
+      $change = "true";
+    }
+  }
+  else
+  {
+      $change = "true";
+  }
+
+  if ($change eq "true"){
     if ($modeset) { # use -m values
       ($owner,$group,$mode) = @opt_modes;
     } elsif (-f "$sourcefile/file-modes"){
@@ -267,7 +289,7 @@
chown ($uid,$gid, $destfile) || ewarn("chown $owner $group $destfile failed. $!"); chmod ($mode, $destfile) || ewarn("chmod $mode $destfile failed. $!"); utime ($stime,$stime, $destfile) || ewarn("utime for $destfile failed. $!");
-
+  }
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub check_mopt {

Could you please include this in the file fcopy?

Regards,
Sabine

--

#########################################################################
#
# Sabine Schmidt
# (IT, Systems&  Operations)
#
# Deutsches Elektronen-Synchroton       Tel.: 040/(8998-)2550
# Notkestraße 85                        eMail: sabine.schm...@desy.de
# 22607 Hamburg
#
########################################################################

Reply via email to