Add the --info=NONREG setting.
authorWayne Davison <wayne@opencoder.net>
Wed, 3 Nov 2021 16:35:50 +0000 (09:35 -0700)
committerWayne Davison <wayne@opencoder.net>
Wed, 3 Nov 2021 16:35:50 +0000 (09:35 -0700)
NEWS.md
backup.c
generator.c
options.c
rsync.1.md
rsync.h

diff --git a/NEWS.md b/NEWS.md
index b866e0007360980aab551592ca7c8a07e834fa09..9f9433d20c19c83552dbf5334c0f06febafe4402 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
  - When `--chown`, `--usermap`, or `--groupmap` is used, rsync now implies
    the appropriate `--owner` and/or `--group` option.
 
+ - Added the `--info=NONREG` setting to control if rsync should warn about
+   non-regular files in the transfer.  This is enabled by default (keeping the
+   behavior the same as before), so specifying `--info=nonreg0` can be used to
+   turn the warnings off.
+
  - More ASM optimizations from Shark64.
 
  - Make rrsync handle the latest options.
index be406bef83003e604555d9a1158b80f76778657e..5036c23a43a615007d92b0919fd7a1aa74d98287 100644 (file)
--- a/backup.c
+++ b/backup.c
@@ -304,7 +304,8 @@ int make_backup(const char *fname, BOOL prefer_rename)
 #endif
 
        if (!ret && !S_ISREG(file->mode)) {
-               rprintf(FINFO, "make_bak: skipping non-regular file %s\n", fname);
+               if (INFO_GTE(NONREG, 1))
+                       rprintf(FINFO, "make_bak: skipping non-regular file %s\n", fname);
                unmake_file(file);
 #ifdef SUPPORT_ACLS
                uncache_tmp_acls();
index 4e75ae2e90305f63a3a607e683438fdb4ee551b0..6e1cbe9160f874fc8a099a9ab86f4df43a4e3a89 100644 (file)
@@ -1678,9 +1678,11 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
        }
 
        if (ftype != FT_REG) {
-               if (solo_file)
-                       fname = f_name(file, NULL);
-               rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
+               if (INFO_GTE(NONREG, 1)) {
+                       if (solo_file)
+                               fname = f_name(file, NULL);
+                       rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
+               }
                goto cleanup;
        }
 
index 3f0354624547257c26b5def14e9e0b9970002f25..eb5744a12ad396168b501e1022b51741f1a1d9b1 100644 (file)
--- a/options.c
+++ b/options.c
@@ -230,7 +230,7 @@ static const char *debug_verbosity[] = {
 #define MAX_VERBOSITY ((int)(sizeof debug_verbosity / sizeof debug_verbosity[0]) - 1)
 
 static const char *info_verbosity[1+MAX_VERBOSITY] = {
-       /*0*/ NULL,
+       /*0*/ "NONREG",
        /*1*/ "COPY,DEL,FLIST,MISC,NAME,STATS,SYMSAFE",
        /*2*/ "BACKUP,MISC2,MOUNT,NAME2,REMOVE,SKIP",
 };
@@ -268,9 +268,10 @@ static struct output_struct info_words[COUNT_INFO+1] = {
        INFO_WORD(MISC, W_SND|W_REC, "Mention miscellaneous information (levels 1-2)"),
        INFO_WORD(MOUNT, W_SND|W_REC, "Mention mounts that were found or skipped"),
        INFO_WORD(NAME, W_SND|W_REC, "Mention 1) updated file/dir names, 2) unchanged names"),
+       INFO_WORD(NONREG, W_REC, "Mention skipped non-regular files (default 1, 0 disables)"),
        INFO_WORD(PROGRESS, W_CLI, "Mention 1) per-file progress or 2) total transfer progress"),
        INFO_WORD(REMOVE, W_SND, "Mention files removed on the sending side"),
-       INFO_WORD(SKIP, W_REC, "Mention files that are skipped due to options used (levels 1-2)"),
+       INFO_WORD(SKIP, W_REC, "Mention files skipped due to transfer overrides (levels 1-2)"),
        INFO_WORD(STATS, W_CLI|W_SRV, "Mention statistics at end of run (levels 1-3)"),
        INFO_WORD(SYMSAFE, W_SND|W_REC, "Mention symlinks that are unsafe"),
        { NULL, "--info", 0, 0, 0, 0 }
@@ -488,9 +489,9 @@ static void output_item_help(struct output_struct *words)
 
        rprintf(FINFO, fmt, "HELP", "Output this help message");
        rprintf(FINFO, "\n");
-       rprintf(FINFO, "Options added for each increase in verbose level:\n");
+       rprintf(FINFO, "Options added at each level of verbosity:\n");
 
-       for (j = 1; j <= MAX_VERBOSITY; j++) {
+       for (j = 0; j <= MAX_VERBOSITY; j++) {
                parse_output_words(words, levels, verbosity[j], HELP_PRIORITY);
                opt = make_output_option(words, levels, W_CLI|W_SRV|W_SND|W_REC);
                if (opt) {
@@ -509,7 +510,7 @@ static void set_output_verbosity(int level, uchar priority)
        if (level > MAX_VERBOSITY)
                level = MAX_VERBOSITY;
 
-       for (j = 1; j <= level; j++) {
+       for (j = 0; j <= level; j++) {
                parse_output_words(info_words, info_levels, info_verbosity[j], priority);
                parse_output_words(debug_words, debug_levels, debug_verbosity[j], priority);
        }
@@ -528,7 +529,7 @@ void limit_output_verbosity(int level)
        memset(debug_limits, 0, sizeof debug_limits);
 
        /* Compute the level limits in the above arrays. */
-       for (j = 1; j <= level; j++) {
+       for (j = 0; j <= level; j++) {
                parse_output_words(info_words, info_limits, info_verbosity[j], LIMIT_PRIORITY);
                parse_output_words(debug_words, debug_limits, debug_verbosity[j], LIMIT_PRIORITY);
        }
index d154a98ca5e2cfea98c3c14eef991e9783492fd2..3b463901b10513ab27c1c8f084c6b51efbfce2fb 100644 (file)
@@ -1019,6 +1019,10 @@ your home directory (remove the '=' for that).
 
     When symlinks are encountered, recreate the symlink on the destination.
 
+    By default, rsync generates a "non-regular file" warning for each symlink
+    encountered when this option is not set.  You can silence the warning by
+    specifying ``--info=nonreg0``.
+
 0.  `--copy-links`, `-L`
 
     When symlinks are encountered, the item that they point to (the referent)
@@ -1325,14 +1329,24 @@ your home directory (remove the '=' for that).
 0.  `--devices`
 
     This option causes rsync to transfer character and block device files to
-    the remote system to recreate these devices.  This option has no effect if
-    the receiving rsync is not run as the super-user (see also the `--super`
-    and `--fake-super` options).
+    the remote system to recreate these devices.  If the receiving rsync is not
+    being run as the super-user, rsync silently skips creating the device files
+    (see also the `--super` and `--fake-super` options).
+
+    By default, rsync generates a "non-regular file" warning for each device
+    file encountered when this option is not set.  You can silence the warning
+    by specifying ``--info=nonreg0``.
 
 0.  `--specials`
 
-    This option causes rsync to transfer special files such as named sockets
-    and fifos.
+    This option causes rsync to transfer special files, such as named sockets
+    and fifos.  If the receiving rsync is not being run as the super-user,
+    rsync silently skips creating the special files (see also the `--super` and
+    `--fake-super` options).
+
+    By default, rsync generates a "non-regular file" warning for each special
+    file encountered when this option is not set.  You can silence the warning
+    by specifying ``--info=nonreg0``.
 
 0.  `-D`
 
diff --git a/rsync.h b/rsync.h
index a6c0d1bb31f9dc3920d0edd15673bad8e7f01fdc..86105afe34865da5de7bfe26355a990e5baa0002 100644 (file)
--- a/rsync.h
+++ b/rsync.h
@@ -1416,7 +1416,8 @@ extern short info_levels[], debug_levels[];
 #define INFO_MISC (INFO_FLIST+1)
 #define INFO_MOUNT (INFO_MISC+1)
 #define INFO_NAME (INFO_MOUNT+1)
-#define INFO_PROGRESS (INFO_NAME+1)
+#define INFO_NONREG (INFO_NAME+1)
+#define INFO_PROGRESS (INFO_NONREG+1)
 #define INFO_REMOVE (INFO_PROGRESS+1)
 #define INFO_SKIP (INFO_REMOVE+1)
 #define INFO_STATS (INFO_SKIP+1)