From f0bd826a9a18380ab2206da06fcf9c4cca43f06d Mon Sep 17 00:00:00 2001 From: Rmys Date: Mon, 11 Sep 2023 23:50:00 +0300 Subject: [PATCH] gptfdisk rebuild --- .../files/gentoo/gptfdisk-1.0.9-libuuid.patch | 26 +++++++++ ...h-of-sgdisk-when-compiled-with-lates.patch | 57 +++++++++++++++++++ ...ptfdisk-fix-null-pointer-dereference.patch | 37 ++++++++++++ hardware/disk/gptfdisk/pspec.xml | 14 ++++- 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 hardware/disk/gptfdisk/files/gentoo/gptfdisk-1.0.9-libuuid.patch create mode 100644 hardware/disk/gptfdisk/files/opensuse/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch create mode 100644 hardware/disk/gptfdisk/files/opensuse/gptfdisk-fix-null-pointer-dereference.patch diff --git a/hardware/disk/gptfdisk/files/gentoo/gptfdisk-1.0.9-libuuid.patch b/hardware/disk/gptfdisk/files/gentoo/gptfdisk-1.0.9-libuuid.patch new file mode 100644 index 0000000000..50cbb7c7ef --- /dev/null +++ b/hardware/disk/gptfdisk/files/gentoo/gptfdisk-1.0.9-libuuid.patch @@ -0,0 +1,26 @@ +From e67faca2c0ca955f56cbd22e90941cdcbdc12597 Mon Sep 17 00:00:00 2001 +From: Rod Smith +Date: Sat, 16 Apr 2022 09:32:04 -0400 +Subject: [PATCH] Updated guid.cc to deal with minor change in libuuid + +--- + NEWS | 3 +++ + guid.cc | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/guid.cc b/guid.cc +index 1e73ab7..d3e4fd5 100644 +--- 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); +-- +2.36.1 + diff --git a/hardware/disk/gptfdisk/files/opensuse/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch b/hardware/disk/gptfdisk/files/opensuse/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch new file mode 100644 index 0000000000..74a6bc8e33 --- /dev/null +++ b/hardware/disk/gptfdisk/files/opensuse/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch @@ -0,0 +1,57 @@ +From 5d5e76d369a412bfb3d2cebb5fc0a7509cef878d Mon Sep 17 00:00:00 2001 +From: Rod Smith +Date: Fri, 15 Apr 2022 18:10:14 -0400 +Subject: [PATCH] Fix failure & crash of sgdisk when compiled with latest popt + (commit 740; presumably eventually release 1.19) + +--- + NEWS | 8 ++++++++ + gptcl.cc | 2 +- + support.h | 2 +- + 3 files changed, 10 insertions(+), 2 deletions(-) + +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 + #include + +-#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 +-- +2.36.1 + diff --git a/hardware/disk/gptfdisk/files/opensuse/gptfdisk-fix-null-pointer-dereference.patch b/hardware/disk/gptfdisk/files/opensuse/gptfdisk-fix-null-pointer-dereference.patch new file mode 100644 index 0000000000..3cee7cc359 --- /dev/null +++ b/hardware/disk/gptfdisk/files/opensuse/gptfdisk-fix-null-pointer-dereference.patch @@ -0,0 +1,37 @@ +From f5de3401b974ce103ffd93af8f9d43505a04aaf9 Mon Sep 17 00:00:00 2001 +From: Damian Kurek +Date: Thu, 7 Jul 2022 03:39:16 +0000 +Subject: [PATCH] Fix NULL dereference when duplicating string argument + +poptGetArg can return NULL if there are no additional arguments, which +makes strdup dereference NULL on strlen +--- + gptcl.cc | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +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; diff --git a/hardware/disk/gptfdisk/pspec.xml b/hardware/disk/gptfdisk/pspec.xml index bbe837a847..fa0d036966 100644 --- a/hardware/disk/gptfdisk/pspec.xml +++ b/hardware/disk/gptfdisk/pspec.xml @@ -10,13 +10,18 @@ app:console A text-mode partitioning tool that works on GUID Partition Table (GPT) disks A text-mode partitioning tool that works on GUID Partition Table (GPT) disks + http://sourceforge.net/projects/gptfdisk/files/gptfdisk/1.0.9/gptfdisk-1.0.9.tar.gz util-linux ncurses-devel popt-devel libutil-linux-devel - http://sourceforge.net/projects/gptfdisk/files/gptfdisk/1.0.9/gptfdisk-1.0.9.tar.gz + + opensuse/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch + opensuse/gptfdisk-fix-null-pointer-dereference.patch + gentoo/gptfdisk-1.0.9-libuuid.patch + @@ -35,6 +40,13 @@ + + 2023-09-11 + 1.0.9 + Rebuild. + Mustafa Cinasal + muscnsl@gmail.com + 2022-06-06 1.0.9