[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Thu Jan 13 23:59:08 MST 2011


The branch, master has been updated
       via  53e6507 Fix a bug in the trailing-slash handling.
      from  3feece5 Improve the discussion of the absolute-filter alternative.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 53e6507e1411f678ea19cde8133c22c331e396fb
Author: Wayne Davison <wayned at samba.org>
Date:   Thu Jan 13 23:00:30 2011 -0800

    Fix a bug in the trailing-slash handling.

-----------------------------------------------------------------------

Summary of changes:
 support/mnt-excl |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/support/mnt-excl b/support/mnt-excl
index f8aaea7..e741865 100755
--- a/support/mnt-excl
+++ b/support/mnt-excl
@@ -24,7 +24,8 @@
 # can exclude some absolute paths from the transfer based on the mount
 # dirs.  For instance:
 #
-# awk '{print $2}' /proc/mounts | rsync -avf 'merge,/- -' /dir host:/dest/
+# awk '{print $2}' /proc/mounts | grep -v '^/$' | \
+#   rsync -avf 'merge,/- -' /dir host:/dest/
 
 use strict;
 use warnings;
@@ -32,8 +33,9 @@ use Cwd 'abs_path';
 
 my $file = '/proc/mounts';
 my $dir = shift || '/';
-$dir = abs_path($dir);
-$dir =~ s#([^/]*)$##;
+my $trailing_slash = $dir =~ m{./$} ? '/' : '';
+$dir = abs_path($dir) . $trailing_slash;
+$dir =~ s{([^/]*)$}{};
 my $trailing = $1;
 $trailing = '' if $trailing eq '.' || !-d "$dir$trailing";
 $trailing .= '/' if $trailing ne '';
@@ -41,7 +43,7 @@ $trailing .= '/' if $trailing ne '';
 open(IN, $file) or die "Unable to open $file: $!\n";
 while (<IN>) {
     $_ = (split)[1];
-    next unless s#^\Q$dir$trailing\E##o && $_ ne '';
+    next unless s{^\Q$dir$trailing\E}{}o && $_ ne '';
     print "- /$trailing$_\n";
 }
 close IN;


-- 
The rsync repository.


More information about the rsync-cvs mailing list