package/gptfdisk: fix bug with util-linux 2.38

Due to a change in util-linux (commit
10f5f79485964ab52272ebe79c3b0047b1f84d82, "libbuid: use
_UL_LIBUUID_UUID_H to cover uuid.h"), gptfdisk no longer detects the
availability of libuuid to generate UUIDs, causing the following
message at runtime:

  Warning! Unable to generate a proper UUID! Creating an improper one as a last
  resort! Windows 7 may crash if you save this partition table!

This issue exists since util-linux was bumped to version 2.38 in
Buildroot
ee978e853a ("package/util-linux: bump
version to 2.38").

This issue has been fixed in upstream gptfdisk, but the fix [0] is not
yet in a new stable release, so we backport it.

Additionally, now that gptfdisk uses libuuid again, the build fails
because passing LDLIBS to make overrides the default value in the
Makefile. To fix this, this patch adds -luuid to GPTFDISK_LDLIBS.

[0] 6a8416cbd1

Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Ben Wolsieffer 2023-09-13 17:20:01 -04:00 committed by Thomas Petazzoni
parent 80e94c7616
commit 58fbfe8706
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,41 @@
From 6a8416cbd12d55f882bb751993b94f72d338d96f Mon Sep 17 00:00:00 2001
From: Rod Smith <rodsmith@rodsbooks.com>
Date: Sat, 16 Apr 2022 09:32:04 -0400
Subject: [PATCH] Updated guid.cc to deal with minor change in libuuid
Upstream: https://sourceforge.net/p/gptfdisk/code/ci/6a8416cbd12d55f882bb751993b94f72d338d96f
Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
---
NEWS | 2 ++
guid.cc | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 9e153fd..9ec7e63 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@
(commit 740, which is pre-release as I type; presumably version 1.19 and
later once released).
+- Updated guid.cc to deal with minor change in libuuid.
+
1.0.9 (4/14/2022):
------------------
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.42.0

View File

@ -14,6 +14,8 @@ GPTFDISK_TARGETS_$(BR2_PACKAGE_GPTFDISK_SGDISK) += sgdisk
GPTFDISK_TARGETS_$(BR2_PACKAGE_GPTFDISK_CGDISK) += cgdisk
GPTFDISK_DEPENDENCIES += util-linux
GPTFDISK_LDLIBS += -luuid
ifeq ($(BR2_PACKAGE_GPTFDISK_SGDISK),y)
GPTFDISK_DEPENDENCIES += host-pkgconf popt
GPTFDISK_SGDISK_LDLIBS += `$(PKG_CONFIG_HOST_BINARY) --libs popt`