Blame SOURCES/0013-display-ignore-reportformat.patch

429878
From 594c1fec1644fdf291aa0ff23de20db65c4cfadf Mon Sep 17 00:00:00 2001
429878
From: David Teigland <teigland@redhat.com>
429878
Date: Wed, 17 Nov 2021 10:40:27 -0600
429878
Subject: [PATCH 13/23] display: ignore --reportformat
429878
429878
Using the option would do nothing useful but would
429878
print extraneous braces.
429878
---
429878
 tools/command-lines.in | 12 ++++++------
429878
 tools/lvmcmdline.c     | 15 +++++++++++++++
429878
 2 files changed, 21 insertions(+), 6 deletions(-)
429878
429878
diff --git a/tools/command-lines.in b/tools/command-lines.in
429878
index 10b23e75d..00ac08934 100644
429878
--- a/tools/command-lines.in
429878
+++ b/tools/command-lines.in
429878
@@ -1359,10 +1359,10 @@ OO: --aligned, --all, --binary, --colon, --columns,
429878
 --configreport ConfigReport, --foreign, --history, --ignorelockingfailure,
429878
 --logonly, --maps, --noheadings,
429878
 --nosuffix, --options String, --sort String, --readonly,
429878
---reportformat ReportFmt, --segments, --select String, --separator String,
429878
+--segments, --select String, --separator String,
429878
 --shared, --unbuffered, --units Units
429878
 OP: VG|LV|Tag ...
429878
-IO: --partial, --ignoreskippedcluster
429878
+IO: --partial, --ignoreskippedcluster, --reportformat ReportFmt
429878
 ID: lvdisplay_general
429878
 
429878
 ---
429878
@@ -1590,10 +1590,10 @@ pvdisplay
429878
 OO: --aligned, --all, --binary, --colon, --columns, --configreport ConfigReport,
429878
 --foreign, --ignorelockingfailure,
429878
 --logonly, --maps, --noheadings, --nosuffix, --options String,
429878
---readonly, --reportformat ReportFmt, --select String, --separator String, --shared,
429878
+--readonly, --select String, --separator String, --shared,
429878
 --short, --sort String, --unbuffered, --units Units
429878
 OP: PV|Tag ...
429878
-IO: --ignoreskippedcluster
429878
+IO: --ignoreskippedcluster, --reportformat ReportFmt
429878
 ID: pvdisplay_general
429878
 
429878
 ---
429878
@@ -1809,10 +1809,10 @@ vgdisplay
429878
 OO: --activevolumegroups, --aligned, --binary, --colon, --columns,
429878
 --configreport ConfigReport, --foreign, --ignorelockingfailure,
429878
 --logonly, --noheadings, --nosuffix,
429878
---options String, --readonly, --reportformat ReportFmt, --select String,
429878
+--options String, --readonly, --select String,
429878
 --shared, --short, --separator String, --sort String, --unbuffered, --units Units
429878
 OP: VG|Tag ...
429878
-IO: --partial, --ignoreskippedcluster
429878
+IO: --partial, --ignoreskippedcluster, --reportformat ReportFmt
429878
 ID: vgdisplay_general
429878
 
429878
 ---
429878
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
429878
index 1e12bedca..1727ba089 100644
429878
--- a/tools/lvmcmdline.c
429878
+++ b/tools/lvmcmdline.c
429878
@@ -3058,6 +3058,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
429878
 	int i;
429878
 	int skip_hyphens;
429878
 	int refresh_done = 0;
429878
+	int io;
429878
 
429878
 	/* Avoid excessive access to /etc/localtime and set TZ variable for glibc
429878
 	 * so it does not need to check /etc/localtime everytime that needs that info */
429878
@@ -3140,6 +3141,20 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
429878
 	if (!(cmd->command = _find_command(cmd, cmd->name, &argc, argv)))
429878
 		return EINVALID_CMD_LINE;
429878
 
429878
+	/*
429878
+	 * If option --foo is set which is listed in IO (ignore option) in
429878
+	 * command-lines.in, then unset foo.  Commands won't usually use an
429878
+	 * ignored option, but there can be shared code that checks for --foo,
429878
+	 * and should not find it to be set.
429878
+	 */
429878
+	for (io = 0; io < cmd->command->io_count; io++) {
429878
+		int opt = cmd->command->ignore_opt_args[io].opt;
429878
+		if (arg_is_set(cmd, opt)) {
429878
+			log_debug("Ignore opt %d", opt);
429878
+			cmd->opt_arg_values[opt].count = 0;
429878
+		}
429878
+	}
429878
+
429878
 	/*
429878
 	 * Remaining position args after command name and --options are removed.
429878
 	 */
429878
-- 
429878
2.31.1
429878