dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0026-partx-document-d-vs.-nr-and-fix-test.patch

22a545
From 5a9269c019f9cb0b2d54444501beb74663670693 Mon Sep 17 00:00:00 2001
22a545
From: Karel Zak <kzak@redhat.com>
22a545
Date: Wed, 21 Aug 2019 13:42:22 +0200
22a545
Subject: [PATCH 26/26] partx: document -d vs. --nr and fix test
22a545
22a545
The commit ab025087f91b66ee8e23a16bc49eb0d9bd421d65 has disabled error
22a545
message, but unfortunately it keeps wrong return code. This has been fixed
22a545
by commit 53ae7d60cfeacd4e87bfe6fcc015b58b78ef4555.
22a545
22a545
This commit add hit about it to docs and fix regression test too.
22a545
22a545
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1739179
22a545
Upstream: http://github.com/karelzak/util-linux/commit/5200aa99d27e084b514e8b035db32f39b49562a3
22a545
Signed-off-by: Karel Zak <kzak@redhat.com>
22a545
---
22a545
 disk-utils/partx.8   | 5 ++++-
22a545
 tests/ts/partx/partx | 9 +++++++--
22a545
 2 files changed, 11 insertions(+), 3 deletions(-)
22a545
22a545
diff --git a/disk-utils/partx.8 b/disk-utils/partx.8
22a545
index af7313cb9..c6bbbae42 100644
22a545
--- a/disk-utils/partx.8
22a545
+++ b/disk-utils/partx.8
22a545
@@ -53,7 +53,10 @@ Add the specified partitions, or read the disk and add all partitions.
22a545
 Print the SIZE column in bytes rather than in human-readable format.
22a545
 .TP
22a545
 .BR \-d , " \-\-delete"
22a545
-Delete the specified partitions or all partitions.
22a545
+Delete the specified partitions or all partitions.  It is not error to
22a545
+remove non-existing partitions, so this option is possible to use together with
22a545
+large \fB\-\-nr\fR ranges without care about the current partitions set on
22a545
+the device.
22a545
 .TP
22a545
 .BR \-g , " \-\-noheadings"
22a545
 Do not print a header line with \fB\-\-show\fR or \fB\-\-raw\fR.
22a545
diff --git a/tests/ts/partx/partx b/tests/ts/partx/partx
22a545
index b21dc44ef..84c286a94 100755
22a545
--- a/tests/ts/partx/partx
22a545
+++ b/tests/ts/partx/partx
22a545
@@ -137,9 +137,14 @@ udevadm settle
22a545
 ts_init_subtest "delete-non-existent"
22a545
 #attempt to remove it again
22a545
 {
22a545
+	# remove non-existing partitions (ENXIO) is not error
22a545
+	#
22a545
+	# see ab025087f91b66ee8e23a16bc49eb0d9bd421d65 and
22a545
+	#     53ae7d60cfeacd4e87bfe6fcc015b58b78ef4555
22a545
+	#
22a545
 	$TS_CMD_PARTX -d --nr $PARTS $TS_DEVICE &&
22a545
-		echo "partx failed: removed non-existing partition" ||
22a545
-		echo "partx: OK"
22a545
+		echo "partx: OK" ||
22a545
+		echo "partx failed: removed non-existing partition"
22a545
 } >$TS_OUTPUT 2>&1
22a545
 ts_finalize_subtest
22a545
 
22a545
-- 
22a545
2.21.0
22a545