[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Thu Apr 4 16:18:27 UTC 2024


The branch, master has been updated
       via  2f9b963a Make `--max-alloc=0` safer.
       via  3476caea Convert mnt-excl into python.
       via  6f3c5ecc Fix old stats bug that counted devices as symlinks.
       via  79fda353 A couple more NEWS improvements.
      from  cd769934 Mention updated config files.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2f9b963abaa52e44891180fe6c0d1c2219f6686d
Author: Wayne Davison <wayne at opencoder.net>
Date:   Tue Jun 27 09:01:15 2023 -0700

    Make `--max-alloc=0` safer.
    
    Always do size checking in my_alloc(), even for `--max-alloc=0`.

commit 3476caea3e10ec06b839d0e95b09c145dd3cbfaf
Author: Wayne Davison <wayne at opencoder.net>
Date:   Mon May 22 08:29:15 2023 -0700

    Convert mnt-excl into python.

commit 6f3c5eccee6cf4dead68b9f3fda8fc2ff90dc311
Author: Wayne Davison <wayne at opencoder.net>
Date:   Tue May 16 22:44:54 2023 -0700

    Fix old stats bug that counted devices as symlinks.

commit 79fda353425daba6b23753c8b1b01dc35ecaac7d
Author: Wayne Davison <wayne at opencoder.net>
Date:   Thu May 4 08:56:10 2023 -0700

    A couple more NEWS improvements.

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

Summary of changes:
 NEWS.md          |  9 ++++++---
 delete.c         |  2 +-
 flist.c          |  2 +-
 options.c        |  2 ++
 rsync.1.md       |  3 ++-
 support/mnt-excl | 48 +++++++++++++++++++++++++++++-------------------
 util2.c          |  2 +-
 7 files changed, 42 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/NEWS.md b/NEWS.md
index 2821a990..ca60c32c 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -13,8 +13,9 @@
 - Add a backtick to the list of characters that the filename quoting needs to
   escape using backslashes.
 
-- Fixed a string-comparison issue in the internal file-list code that affected
-  tr_TR.utf-8.
+- Fixed a string-comparison issue in the internal handling of `--progress` (a
+  locale such as tr_TR.utf-8 needed the internal triggering of `--info` options
+  to use upper-case flag names to ensure that they match).
 
 - Make sure that a local transfer marks the sender side as trusted.
 
@@ -25,10 +26,12 @@
   openssl library.
 
 - Fixed a problem in the daemon auth for older protocols (29 and before) if the
-  openssl library is being used to compute md4 checksums.
+  openssl library is being used to compute MD4 checksums.
 
 - Fixed `rsync -VV` on Cygwin -- it needed a flush of stdout.
 
+- Fixed an old stats bug that counted devices as symlinks.
+
 ### ENHANCEMENTS:
 
 - Enhanced rrsync with the `-no-overwrite` option that allows you to ensure
diff --git a/delete.c b/delete.c
index 4a294853..80766164 100644
--- a/delete.c
+++ b/delete.c
@@ -188,7 +188,7 @@ enum delret delete_item(char *fbuf, uint16 mode, uint16 flags)
 				stats.deleted_symlinks++;
 #endif
 			else if (IS_DEVICE(mode))
-				stats.deleted_symlinks++;
+				stats.deleted_devices++;
 			else
 				stats.deleted_specials++;
 		}
diff --git a/flist.c b/flist.c
index 311bbcf1..464d556e 100644
--- a/flist.c
+++ b/flist.c
@@ -2659,7 +2659,7 @@ struct file_list *recv_file_list(int f, int dir_ndx)
 		} else if (S_ISLNK(file->mode))
 			stats.num_symlinks++;
 		else if (IS_DEVICE(file->mode))
-			stats.num_symlinks++;
+			stats.num_devices++;
 		else
 			stats.num_specials++;
 
diff --git a/options.c b/options.c
index 93bbe7b0..fd674754 100644
--- a/options.c
+++ b/options.c
@@ -1946,6 +1946,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 			goto cleanup;
 		max_alloc = size;
 	}
+	if (!max_alloc)
+		max_alloc = SIZE_MAX;
 
 	if (old_style_args < 0) {
 		if (!am_server && protect_args <= 0 && (arg = getenv("RSYNC_OLD_ARGS")) != NULL && *arg) {
diff --git a/rsync.1.md b/rsync.1.md
index 894b3663..2ae6f481 100644
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -2106,7 +2106,8 @@ expand it.
     See the [`--max-size`](#opt) option for a description of how SIZE can be
     specified.  The default suffix if none is given is bytes.
 
-    Beginning in 3.2.3, a value of 0 specifies no limit.
+    Beginning in 3.2.7, a value of 0 is an easy way to specify SIZE_MAX (the
+    largest limit possible).
 
     You can set a default value using the environment variable
     [`RSYNC_MAX_ALLOC`](#) using the same SIZE values as supported by this
diff --git a/support/mnt-excl b/support/mnt-excl
index ed7b49ba..bc8b5bcd 100755
--- a/support/mnt-excl
+++ b/support/mnt-excl
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/bin/env python3
 # This script takes a command-line arg of a source directory
 # that will be passed to rsync, and generates a set of excludes
 # that will exclude all mount points from the list.  This is
@@ -27,23 +27,33 @@
 # awk '{print $2}' /proc/mounts | grep -v '^/$' | \
 #   rsync -avf 'merge,/- -' /dir host:/dest/
 
-use strict;
-use warnings;
-use Cwd 'abs_path';
+import os, argparse
 
-my $file = '/proc/mounts';
-my $dir = shift || '/';
-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 '';
+MNT_FILE = '/proc/mounts';
 
-open(IN, $file) or die "Unable to open $file: $!\n";
-while (<IN>) {
-    $_ = (split)[1];
-    next unless s{^\Q$dir$trailing\E}{}o && $_ ne '';
-    print "- /$trailing$_\n";
-}
-close IN;
+def main():
+    trailing_slash = '/' if args.path.endswith(('/', '/.')) and args.path != '/' else ''
+    args.path = os.path.realpath(args.path) + trailing_slash
+    parent_dir = os.path.dirname(args.path)
+    trailing = os.path.basename(args.path)
+    if not os.path.isdir(args.path):
+        trailing = ''
+    elif trailing != '':
+        trailing += '/'
+    want_path = os.path.join(parent_dir, trailing)
+    wp_len = len(want_path)
+
+    with open(MNT_FILE) as fh:
+        for line in fh:
+            mnt_path = line.split()[1]
+            if mnt_path.startswith(want_path) and mnt_path != want_path:
+                print(f"- /{trailing}{mnt_path[wp_len:]}")
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description="Output mount points as rsync excludes.", add_help=False)
+    parser.add_argument("--help", "-h", action="help", help="Output this help message and exit.")
+    parser.add_argument('path', metavar='PATH', nargs='?', default='/', help="Limit output to those within the PATH hierarchy.")
+    args = parser.parse_args()
+    main()
+
+# vim: sw=4 et
diff --git a/util2.c b/util2.c
index a8609a5d..3b5a8f41 100644
--- a/util2.c
+++ b/util2.c
@@ -72,7 +72,7 @@ int msleep(int t)
 
 void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line)
 {
-	if (max_alloc && num >= max_alloc/size) {
+	if (num >= max_alloc/size) {
 		if (!file)
 			return NULL;
 		rprintf(FERROR, "[%s] exceeded --max-alloc=%s setting (file=%s, line=%d)\n",


-- 
The rsync repository.



More information about the rsync-cvs mailing list