util-linux/rename-prevent-no-act-from-setting-no-overwrite.patch
2019-09-30 11:19:16 -04:00

59 lines
1.7 KiB
Diff

From 0849ff36605588a7ab7892ab2aae59d73290e225 Mon Sep 17 00:00:00 2001
From: "G.raud Meyer" <graud@gmx.com>
Date: Thu, 29 Mar 2018 12:58:44 +0200
Subject: [PATCH 022/686] rename: prevent --no-act from setting --no-overwrite
This fixes a bug introduced by commit fabb90676 ("Added --no-override
option to rename.", 2017-05-27) where the fallthrough meant to let
--no-act set --verbose was changed to set --no-override (the previous
code was too smart).
Do not let --no-act set --verbose anymore but update the manual to
recommend adding option --verbose. This is to be able to make --no-act
detect only non existing file arguments (in a future commit).
---
misc-utils/rename.1 | 4 +++-
misc-utils/rename.c | 8 ++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/misc-utils/rename.1 b/misc-utils/rename.1
index d476d24..df32946 100644
--- a/misc-utils/rename.1
+++ b/misc-utils/rename.1
@@ -23,7 +23,9 @@ Do not rename a symlink but its target.
Show which files were renamed, if any.
.TP
.BR \-n , " \-\-no\-act"
-Do not make any changes.
+Do not make any changes; add
+.BR \-\-verbose
+to see what would be made.
.TP
.BR \-o , " \-\-no\-overwrite"
Do not overwrite existing files. When
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 1d280ad..147e54f 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -174,13 +174,13 @@ int main(int argc, char **argv)
switch (c) {
case 'n':
noact = 1;
- /* fallthrough */
- case 'o':
- nooverwrite = 1;
- break;
+ break;
case 'v':
verbose = 1;
break;
+ case 'o':
+ nooverwrite = 1;
+ break;
case 's':
do_rename = do_symlink;
break;
--
1.8.3.1