Skip to contentSkip to conversation

blkdiscard: Refuse to proceed if signatures are found

PATCH Applied Lukas Czerner 2 participants 2 messages Jun 18, 2020 – Jun 19, 2020 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 blkdiscard: Refuse to proceed if signatures are found

Currently the blkdiscard has the ability to wipe out entere device in a matter of seconds. This is fine as long as it's intentional, it is potentially catastrophic if it's not.

With this commit blkdiscard will check for existing signatures on the device and refuse to continue if any are found unless the operation is forced with the -f option.

In an attempt to avoid breaking existing automation scripts the force is only required when stdin refers to a terminal.

---
v2: Rename function to probe_device, use switch and free probe if no
signature was found

 sys-utils/Makemodule.am |  2 +-
 sys-utils/blkdiscard.c  | 59 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 2 deletions(-)
sys-utils/Makemodule.am +1 -1
index 5855e1cc1..b5f6c1b1b 100644
@@ -165,7 +165,7 @@ if BUILD_BLKDISCARD
 sbin_PROGRAMS += blkdiscard
 dist_man_MANS += sys-utils/blkdiscard.8
 blkdiscard_SOURCES = sys-utils/blkdiscard.c lib/monotonic.c
-blkdiscard_LDADD = $(LDADD) libcommon.la $(REALTIME_LIBS)
+blkdiscard_LDADD = $(LDADD) libblkid.la libcommon.la $(REALTIME_LIBS)
 endif
 
 if BUILD_BLKZONE
sys-utils/blkdiscard.c +58 -1

83 lines not on this page · raw message

Signature · 1 line
2.21.3
maintainer Applied
#1 lore raw
Quoted 6 lines · Lukas Czerner

v2: Rename function to probe_device, use switch and free probe if no
signature was found

 sys-utils/Makemodule.am |  2 +-
 sys-utils/blkdiscard.c  | 59 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 2 deletions(-)

Applied, thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com