dcavalca / rpms / util-linux

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