dcavalca / rpms / util-linux

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