From 813e574001eb5b9248c92d2c8c0174d5dd062a26 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 15 Jan 2021 09:14:57 +0100 Subject: [PATCH] Wipe existing signatures when creating partition table As the sfdisk man page says on the option '--wipe' that specifies whether or not to wipe signatures in order to avoid collisions: > When this option is not given, the default is auto, > in which case signatures are wiped only when in interactive mode but sfdisk is not run in interactive mode here, since stdin does not refer to a terminal, and the sfdisk man page says: > It [i.e. sfdisk] runs in interactive mode if executed on terminal > (stdin refers to a terminal). Therefore, explicitly pass the '--wipe=always' option to sfdisk so that old signatures are wiped when a new partition table is created. Bug: 431628 --- src/plugins/sfdisk/sfdiskdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sfdisk/sfdiskdevice.cpp b/src/plugins/sfdisk/sfdiskdevice.cpp index 8e732a1..d787aaf 100644 --- a/src/plugins/sfdisk/sfdiskdevice.cpp +++ b/src/plugins/sfdisk/sfdiskdevice.cpp @@ -60,7 +60,7 @@ bool SfdiskDevice::createPartitionTable(Report& report, const PartitionTable& pt else tableType = ptable.typeName().toLocal8Bit(); - ExternalCommand createCommand(report, QStringLiteral("sfdisk"), { m_device->deviceNode() } ); + ExternalCommand createCommand(report, QStringLiteral("sfdisk"), { QStringLiteral("--wipe=always"), m_device->deviceNode() } ); if ( createCommand.write(QByteArrayLiteral("label: ") + tableType + QByteArrayLiteral("\nwrite\n")) && createCommand.start(-1) ) { return createCommand.output().contains(QStringLiteral("Script header accepted."));