1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dmsetup: fix 'splitname -o' to not fail if used without '-c'

This was a regression introduced with e33fd978a8
(libdm v1.02.68/lvm2 v2.02.89) with the introduction of new output
fields blkdevname and blkdevs_used for ls and deps dmsetup commands.

A new common '_process_options' fn was added with that commit, but the
fn was called prematurely which then broke processing of
'dmsetup splitname -o' which should implicitly use '-c' option
and this was failing after the commit:

  alatyr/~ $ dmsetup splitname -o lv_name /dev/mapper/vg_data-test
  Option not recognised: lv_name
  Couldn't process command line.

The '-c' had to be used for correct operation:

  alatyr/~ $ dmsetup splitname -c -o lv_name /dev/mapper/vg_data-test
  LV
  test

Now fixed to work as it did before:

  alatyr/~ $ dmsetup splitname -o lv_name /dev/mapper/vg_data-test
  LV
  test
This commit is contained in:
Peter Rajnoha 2013-03-12 12:37:24 +01:00
parent cbfb5a98b5
commit 521a0a3323
2 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
Fix 'dmsetup splitname -o' to not fail if used without '-c' switch (1.02.68).
Add dm_config_write_{node_out/one_node_out} for enhanced config output.
Add dm_config_value_is_bool to check for boolean value in supported formats.
Fix config node lookup inside empty sections to not return the section itself.

View File

@ -3749,9 +3749,6 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
return 0;
}
if (!_process_options(_string_args[OPTIONS_ARG]))
return 0;
if (_switches[TABLE_ARG] && _switches[NOTABLE_ARG]) {
fprintf(stderr, "--table and --notable are incompatible.\n");
return 0;
@ -3824,6 +3821,11 @@ int main(int argc, char **argv)
if (!strcmp(cmd->name, "mangle"))
dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
if (!_process_options(_string_args[OPTIONS_ARG])) {
fprintf(stderr, "Couldn't process command line.\n");
goto out;
}
if (_switches[COLS_ARG]) {
if (!_report_init(cmd))
goto out;