From: Eric Bollengier Date: Fri, 4 Sep 2020 11:47:06 +0000 (+0200) Subject: BEE Backport regress/scripts/diff.pl X-Git-Tag: Release-11.3.2~1091 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a63c91a226952627f243c6ad7d5cc06952ef3c74;p=thirdparty%2Fbacula.git BEE Backport regress/scripts/diff.pl This commit is the result of the squash of the following main commits: Author: Alain Spineux Date: Mon Jan 30 12:11:27 2017 +0100 regress: diff.pl check mtimefor symlink on linux Author: Eric Bollengier Date: Sun Oct 18 18:16:44 2015 +0200 regress: Skip special files in diff.pl with -p option --- diff --git a/regress/scripts/diff.pl b/regress/scripts/diff.pl index 4dfeffef9..c485d183d 100755 --- a/regress/scripts/diff.pl +++ b/regress/scripts/diff.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# Copyright (C) 2000-2019 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # @@ -33,6 +33,7 @@ my @exclude; my $hash; my $ret=0; my $notop=0; +my $plain=0; GetOptions("src=s" => \$src, # source directory "dst=s" => \$dst, # dest directory @@ -41,6 +42,7 @@ GetOptions("src=s" => \$src, # source directory "wattr" => \$wattr, # windows attributes "mtime-dir" => \$mtimedir, # check mtime on directories "exclude=s@" => \@exclude, # exclude some files + "plain" => \$plain, # compare plain files "notop" => \$notop, # Exclude top directory "help" => \$help, ) or pod2usage(-verbose => 1, @@ -171,15 +173,21 @@ sub wanted_src return; } if (-l $f) { + if ($plain) { + return; + } my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = lstat($f); - + if ($^O ne 'linux') { + # for any OS that don't support lutimes() + $mtime = 0; + } my $target = readlink($f); $hash->{$File::Find::name} = { nlink => $nlink, uid => $uid, gid => $gid, - mtime => 0, + mtime => $mtime, target => $target, type => 'l', file => $File::Find::name, @@ -218,6 +226,9 @@ sub wanted_src }; } elsif (-b $f or -c $f) { # dev + if ($plain) { + return; + } $hash->{$File::Find::name} = { mode => $mode, uid => $uid, @@ -229,6 +240,9 @@ sub wanted_src }; } elsif (-p $f) { # named pipe + if ($plain) { + return; + } $hash->{$File::Find::name} = { mode => $mode, uid => $uid,