From 54726a4950756b8f0c3e19c4c7d5feb6fb838e00 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Fri, 28 Apr 2017 16:43:42 -0500 Subject: [PATCH] fix running commands from a script file Using any arg with a command name in a script file would cause the command to fail. The name of the script file being executed was being passed to lvm_register_commands() and define_commands(), which prevented command defs from being defined (simple commands were still being defined only by name which was enough for those to still work when run trivially with no args). --- WHATS_NEW | 1 + tools/lvmcmdline.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 2db7dc401..846e99839 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.171 - ================================== + Fix running commands from a script file. Add pvcreate prompt when device size doesn't match setphysicalvolumesize. lvconvert - preserve region size on raid1 image count changes Adjust pvresize/pvcreate messages and prompt if underlying dev size differs. diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index c0c81baa4..29ec06bfe 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -3444,6 +3444,10 @@ int lvm2_main(int argc, char **argv) goto_out; } + /* Can be the name of a script file. */ + if (run_name && !find_command_name(run_name)) + run_name = NULL; + if (!lvm_register_commands(run_name)) { ret = ECMD_FAILED; goto out;