lvm2/0002-devices-file-fail-if-devicesfile-filename-doesn-t-ex.patch
heming zhao 819badda28 Accepting request 1000764 from home:hmzhao:branches:Base:System
- Update lvm2 from LVM2.2.03.15 to LVM2.2.03.16
  *** WHATS_NEW for 2.03.16 ***
  Version 2.03.16 - 18th May 2022
  ===============================
    Fix segfault when handling selection with historical LVs.
    Add support --vdosettings with lvcreate, lvconvert, lvchange.
    Filtering multipath devices respects blacklist setting from multipath configuration.
    lvmdevices support for removing by device id using --deviceidtype and --deldev.
    Display writecache block size with lvs -o writecache_block_size.
    Improve cachesettings description in man lvmcache.
    Fix lossing of delete message on thin-pool extension.
- Drop patches that have been merged into upstream
  - 0001-post-release.patch
  - 0002-asan-fix-some-reports-from-libasan.patch
  - 0003-make-generate.patch
  - 0004-tests-udev-pvscan-vgchange-fix-service-wait.patch
  - 0005-devices-file-do-not-clear-PVID-of-unread-devices.patch
  - 0006-tests-skip-vgchange-pvs-online.sh-on-rhel5.patch
  - 0007-dev_manager-fix-dm_task_get_device_list.patch
  - 0008-dev_manager-failing-status-is-not-internal-error.patch
  - 0009-clang-add-extra-check.patch
  - 0010-clang-possible-better-compilation-with-musl-c.patch
  - 0011-dev_manager-do-not-query-for-open_count.patch
  - 0012-dev_manager-use-list-info-for-preset-devs.patch
  - 0013-man-lvmcache-add-more-writecache-cachesettings-info.patch
  - 0014-man-update-cachesettings-option-description.patch
  - 0015-man-lvmcache-mention-writecache-memory-usage.patch
  - 0016-writecache-display-block-size-from-lvs.patch
  - 0017-devices-simplify-dev_cache_get_by_devt.patch
  - 0018-devices-drop-incorrect-paths-from-aliases-list.patch
  - 0019-devices-initial-use-of-existing-option.patch
  - 0020-devices-fix-dev_name-assumptions.patch
  - 0021-devices-use-dev-cache-aliases-handling-from-label-sc.patch
  - 0022-devices-only-close-PVs-on-LVs-when-scan_lvs-is-enabl.patch
  - 0023-writecache-check-memory-usage.patch
  - 0024-pvscan-don-t-use-udev-for-external-device-info.patch
  - 0025-vgchange-monitor-don-t-use-udev-info.patch
- Add upstream patch
  - 0001-devices-file-move-clean-up-after-command-is-run.patch
  - 0002-devices-file-fail-if-devicesfile-filename-doesn-t-ex.patch
  - 0003-filter-mpath-handle-other-wwid-types-in-blacklist.patch
  - 0004-filter-mpath-get-wwids-from-sysfs-vpd_pg83.patch
  - 0005-pvdisplay-restore-reportformat-option.patch
  - 0006-exit-with-error-when-devicesfile-name-doesn-t-exist.patch
  - 0007-report-fix-pe_start-column-type-from-NUM-to-SIZ.patch
  - 0008-_vg_read_raw_area-fix-segfault-caused-by-using-null-.patch
  - 0009-mm-remove-libaio-from-being-skipped.patch
  - 0010-dmsetup-check-also-for-ouf-of-range-value.patch
  - 0011-devices-drop-double-from-sysfs-path.patch
  - 0012-devices-file-fix-pvcreate-uuid-matching-pvid-entry-w.patch
  - 0013-vgimportdevices-change-result-when-devices-are-not-a.patch
  - 0014-vgimportdevices-fix-locking-when-creating-devices-fi.patch
- update lvm2.spec
  - indent some lines for easy read
  - remove config item '--enable-cmirrord'
  - add new man lvm_import_vdo.8
  - add new man dmfilemapd.8

OBS-URL: https://build.opensuse.org/request/show/1000764
OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=312
2022-09-01 23:48:48 +00:00

53 lines
1.9 KiB
Diff

From bfe072e4388b530cbf5369be8a8f1305220198bf Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Fri, 27 May 2022 14:27:03 -0500
Subject: [PATCH] devices file: fail if --devicesfile filename doesn't exist
A typo of the filename after --devicesfile should result in a
command error rather than the command falling back to using no
devices file at all. Exception is vgcreate|pvcreate which
create a new devices file if the file name doesn't exist.
---
lib/device/dev-cache.c | 9 +++++++++
test/shell/devicesfile-basic.sh | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 3aaf6a2e55b8..ed9c726c9748 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1863,6 +1863,15 @@ int setup_devices(struct cmd_context *cmd)
file_exists = devices_file_exists(cmd);
+ /*
+ * Fail if user specifies a file name that doesn't exist and
+ * the command is not creating a new devices file.
+ */
+ if (!file_exists && !cmd->create_edit_devices_file && cmd->devicesfile && strlen(cmd->devicesfile)) {
+ log_error("Devices file not found: %s", cmd->devices_file_path);
+ return 0;
+ }
+
/*
* Removing the devices file is another way of disabling the use of
* a devices file, unless the command creates the devices file.
diff --git a/test/shell/devicesfile-basic.sh b/test/shell/devicesfile-basic.sh
index 9c3455c7678e..77fe265a0c54 100644
--- a/test/shell/devicesfile-basic.sh
+++ b/test/shell/devicesfile-basic.sh
@@ -104,6 +104,10 @@ not ls "$DFDIR/system.devices"
vgs --devicesfile test.devices $vg1
not vgs --devicesfile test.devices $vg2
+# misspelled override name fails
+not vgs --devicesfile doesnotexist $vg1
+not vgs --devicesfile doesnotexist $vg2
+
# devicesfile and devices cannot be used together
not vgs --devicesfile test.devices --devices "$dev1","$dev1" $vg1
--
2.26.2