gptfdisk: 1.0.9 -> 1.0.10 (#297099)

This commit is contained in:
Siddhartha Sahu 2024-05-22 07:12:36 -04:00 committed by GitHub
parent 03fda24206
commit 462eb9cbf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 108 deletions

View File

@ -2,26 +2,15 @@
stdenv.mkDerivation rec {
pname = "gptfdisk";
version = "1.0.9";
version = "1.0.10";
src = fetchurl {
# https://www.rodsbooks.com/gdisk/${name}.tar.gz also works, but the home
# page clearly implies a preference for using SourceForge's bandwidth:
url = "mirror://sourceforge/gptfdisk/${pname}-${version}.tar.gz";
sha256 = "sha256-2v6tJpP6646Ll4MrI0B/btWzIZvBeE9ILdhVd04tUMI=";
sha256 = "sha256-Kr7WG8bSuexJiXPARAuLgEt6ctcUQGm1qSCbKtaTooI=";
};
patches = [
# issues with popt 1.19 (from upstream but not yet released):
# https://github.com/rpm-software-management/popt/issues/80
./popt-1-19.patch
# fix UUID generation (from upstream but not yet released):
# https://sourceforge.net/p/gptfdisk/code/ci/6a8416cbd12d55f882bb751993b94f72d338d96f/
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1853985.html
./uuid.patch
];
postPatch = ''
patchShebangs gdisk_test.sh
'' + lib.optionalString stdenv.isDarwin ''

View File

@ -1,84 +0,0 @@
commit 5d5e76d369a412bfb3d2cebb5fc0a7509cef878d
Author: Rod Smith <rodsmith@rodsbooks.com>
Date: Fri Apr 15 18:10:14 2022 -0400
Fix failure & crash of sgdisk when compiled with latest popt (commit 740; presumably eventually release 1.19)
diff --git a/NEWS b/NEWS
index c7add56..9e153fd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+1.0.10 (?/??/2022):
+-------------------
+
+- Fixed problem that caused sgdisk to crash with errors about being unable
+ to read the disk's partition table when compiled with the latest popt
+ (commit 740, which is pre-release as I type; presumably version 1.19 and
+ later once released).
+
1.0.9 (4/14/2022):
------------------
diff --git a/gptcl.cc b/gptcl.cc
index 34c9421..0d578eb 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -155,7 +155,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
} // while
// Assume first non-option argument is the device filename....
- device = (char*) poptGetArg(poptCon);
+ device = strdup((char*) poptGetArg(poptCon));
poptResetContext(poptCon);
if (device != NULL) {
diff --git a/support.h b/support.h
index 8ba9ad1..f91f1bc 100644
--- a/support.h
+++ b/support.h
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string>
-#define GPTFDISK_VERSION "1.0.9"
+#define GPTFDISK_VERSION "1.0.9.1"
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
commit f5de3401b974ce103ffd93af8f9d43505a04aaf9
Author: Damian Kurek <starfire24680@gmail.com>
Date: Thu Jul 7 03:39:16 2022 +0000
Fix NULL dereference when duplicating string argument
poptGetArg can return NULL if there are no additional arguments, which
makes strdup dereference NULL on strlen
diff --git a/gptcl.cc b/gptcl.cc
index 0d578eb..ab95239 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -155,10 +155,11 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
} // while
// Assume first non-option argument is the device filename....
- device = strdup((char*) poptGetArg(poptCon));
- poptResetContext(poptCon);
+ device = (char*) poptGetArg(poptCon);
if (device != NULL) {
+ device = strdup(device);
+ poptResetContext(poptCon);
JustLooking(); // reset as necessary
BeQuiet(); // Tell called functions to be less verbose & interactive
if (LoadPartitions((string) device)) {
@@ -498,6 +499,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
cerr << "Error encountered; not saving changes.\n";
retval = 4;
} // if
+ free(device);
} // if (device != NULL)
poptFreeContext(poptCon);
return retval;

View File

@ -1,11 +0,0 @@
--- a/guid.cc
+++ b/guid.cc
@@ -141,7 +141,7 @@ void GUIDData::Zero(void) {
void GUIDData::Randomize(void) {
int i, uuidGenerated = 0;
-#ifdef _UUID_UUID_H
+#if defined (_UUID_UUID_H) || defined (_UL_LIBUUID_UUID_H)
uuid_generate(uuidData);
ReverseBytes(&uuidData[0], 4);
ReverseBytes(&uuidData[4], 2);