Accepting request 872678 from home:manfred999:branches:filesystems

- fix regression from version 1.0.6: misleading warning when reading MBR disks,
    upstream commit f063fe08e424c99f133df18bf9dce49c851bcb0a

OBS-URL: https://build.opensuse.org/request/show/872678
OBS-URL: https://build.opensuse.org/package/show/filesystems/gptfdisk?expand=0&rev=18
This commit is contained in:
Jan Engelhardt 2021-02-26 18:19:52 +00:00 committed by Git OBS Bridge
parent 033c5178d2
commit 538e7babd2
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,33 @@
Commit f063fe08e424c99f133df18bf9dce49c851bcb0a:
Fixed bug that caused spurious warnings about the partition table
header claiming an invalid size of partition entries when reading
some MBR disks.
See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=981231
--- a/gpt.cc
+++ b/gpt.cc
@@ -1042,11 +1042,19 @@
*crcOk = CheckHeaderCRC(&tempHeader);
if (tempHeader.sizeOfPartitionEntries != sizeof(GPTPart)) {
- cerr << "Warning: Partition table header claims that the size of partition table\n";
- cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " bytes, but this program ";
- cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
- cerr << "Adjusting accordingly, but partition table may be garbage.\n";
- tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
+ // Print the below warning only if the CRC is OK -- but correct the
+ // problem either way. The warning is printed only on a valid CRC
+ // because otherwise this warning will display inappropriately when
+ // reading MBR disks. If the CRC is invalid, then a warning about
+ // that will be shown later, so the user will still know that
+ // something is wrong.
+ if (*crcOk) {
+ cerr << "Warning: Partition table header claims that the size of partition table\n";
+ cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " bytes, but this program ";
+ cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
+ cerr << "Adjusting accordingly, but partition table may be garbage.\n";
+ }
+ tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
}
if (allOK && (numParts != tempHeader.numParts) && *crcOk) {

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Feb 16 00:22:32 UTC 2021 - Manfred Schwarb <manfred99@gmx.ch>
- fix regression from version 1.0.6: misleading warning when reading MBR disks,
upstream commit f063fe08e424c99f133df18bf9dce49c851bcb0a
-------------------------------------------------------------------
Tue Feb 9 22:56:48 UTC 2021 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@ -25,6 +25,7 @@ Group: System/Base
URL: http://rodsbooks.com/gdisk
Source: https://downloads.sf.net/%name/%name-%version.tar.gz
Patch0: fix-spurious-warnings.patch
BuildRequires: gcc-c++
BuildRequires: ncurses-devel
BuildRequires: pkgconfig(popt)