Bug#1020446: gdisk: FTBFS with popt 1.19+dfsg-1~exp1

2022-10-15 Thread Håvard F . Aasen
Control: tags -1 patch


I've attached a small patch to mitigate the issue with popt.


HåvardFrom: =?utf-8?b?IkjDpXZhcmQgRi4gQWFzZW4i?= 
Date: Sat, 15 Oct 2022 18:55:20 +0200
Subject: Handle plugged memory leak from popt

With popt version 1.19, a memory leak was plugged. gdisk (sdisk) assumed
the value returned by poptGetArg() would remain usable forever because
popt has leaked the value for quite a long time.

This patch consist of one incomplete fix, that has been included in the
official repository, and one that of this writing, is still an open PR.

Origin: upstream, https://sourceforge.net/p/gptfdisk/code/ci/5d5e76d369a412bfb3d2cebb5fc0a7509cef878d/
Origin: upstream, https://sourceforge.net/p/gptfdisk/code/merge-requests/28/
Bug-Debian: https://bugs.debian.org/1020446
---
 gptcl.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gptcl.cc b/gptcl.cc
index 34c9421..ab95239 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -156,9 +156,10 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
 
// Assume first non-option argument is the device filename
device = (char*) poptGetArg(poptCon);
-   poptResetContext(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;


Bug#1020446: gdisk: FTBFS with popt 1.19+dfsg-1~exp1

2022-09-21 Thread Håvard F . Aasen
Source: gdisk
Severity: important
Tags: ftbfs

Hi,

gdisk FTBFS and has a failing autopkgtest with popt 1.19+dfsg-1~exp1
from experimental. Build log and log from autopkgtest is attached.

This was reported upstream a while ago [1], and a partial fix was
applied [2]. This was later found insufficient and a new fix has been
proposed [3], as of this mail, the patch has not been merged.
FWIW, Fedora is using this patch [4].

Regards,
Håvard


[1] https://sourceforge.net/p/gptfdisk/mailman/message/37640877/
[2] 
https://sourceforge.net/p/gptfdisk/code/ci/5d5e76d369a412bfb3d2cebb5fc0a7509cef878d/
[3] https://sourceforge.net/p/gptfdisk/code/merge-requests/28/
[4] 
https://src.fedoraproject.org/fork/pmatilai/rpms/gdisk/raw/71100f6fd84dd21f1346917e4fa84a2eccdb70c3/f/gdisk-1.0.9-poptmisuse.patchautopkgtest [17:43:32]: starting date: 2022-09-20
autopkgtest [17:43:32]: version 5.25
autopkgtest [17:43:32]: host ci-worker01; command line: /usr/bin/autopkgtest --no-built-binaries '--setup-commands=echo '"'"'gdisk unstable/amd64'"'"' > /var/tmp/debci.pkg 2>&1 || true' '--setup-commands=echo '"'"'Acquire::Retries "10";'"'"' > /etc/apt/apt.conf.d/75retry 2>&1 || true' --user debci --apt-upgrade --add-apt-release=experimental --pin-packages=experimental=src:popt --output-dir /tmp/debci-worker-26264295-p2XpCgn6gv/autopkgtest-incoming/unstable/amd64/g/gdisk/26264295 gdisk -- lxc --sudo --name ci-263-5ce3cb6a autopkgtest-unstable-amd64
autopkgtest [17:43:36]:  test bed setup
Get:1 http://deb.debian.org/debian experimental InRelease [97.5 kB]
Get:2 http://deb.debian.org/debian experimental/contrib Sources [1,820 B]
Get:3 http://deb.debian.org/debian experimental/non-free Sources [2,512 B]
Get:4 http://deb.debian.org/debian experimental/main Sources [447 kB]
Get:5 http://deb.debian.org/debian experimental/non-free amd64 Packages [7,388 B]
Get:6 http://deb.debian.org/debian experimental/contrib amd64 Packages [6,056 B]
Get:7 http://deb.debian.org/debian experimental/main amd64 Packages [402 kB]
Fetched 964 kB in 1s (1,200 kB/s)
Reading package lists...
Get:1 http://deb.debian.org/debian unstable InRelease [158 kB]
Get:2 http://deb.debian.org/debian-debug unstable-debug InRelease [56.7 kB]
Hit:3 http://deb.debian.org/debian experimental InRelease
Get:4 http://deb.debian.org/debian unstable/main Sources.diff/Index [63.6 kB]
Get:5 http://deb.debian.org/debian unstable/non-free Sources.diff/Index [63.3 kB]
Get:6 http://deb.debian.org/debian unstable/contrib Sources.diff/Index [63.3 kB]
Get:7 http://deb.debian.org/debian unstable/main amd64 Packages.diff/Index [63.6 kB]
Get:8 http://deb.debian.org/debian unstable/non-free amd64 Packages.diff/Index [63.3 kB]
Get:9 http://deb.debian.org/debian-debug unstable-debug/main Sources.diff/Index [63.6 kB]
Get:10 http://deb.debian.org/debian-debug unstable-debug/contrib Sources.diff/Index [63.3 kB]
Get:11 http://deb.debian.org/debian-debug unstable-debug/non-free Sources.diff/Index [63.3 kB]
Get:12 http://deb.debian.org/debian-debug unstable-debug/non-free amd64 Packages.diff/Index [63.3 kB]
Get:13 http://deb.debian.org/debian-debug unstable-debug/main amd64 Packages.diff/Index [63.6 kB]
Get:14 http://deb.debian.org/debian unstable/main Sources T-2022-09-20-1646.49-F-2022-09-20-1106.00.pdiff [22.7 kB]
Get:15 http://deb.debian.org/debian unstable/non-free Sources T-2022-09-20-1646.49-F-2022-09-20-1646.49.pdiff [31 B]
Get:16 http://deb.debian.org/debian unstable/contrib Sources T-2022-09-20-1646.49-F-2022-09-20-1646.49.pdiff [31 B]
Get:17 http://deb.debian.org/debian unstable/main amd64 Packages T-2022-09-20-1646.49-F-2022-09-20-1106.00.pdiff [36.2 kB]
Get:18 http://deb.debian.org/debian unstable/non-free amd64 Packages T-2022-09-20-1106.00-F-2022-09-20-1106.00.pdiff [5,854 B]
Get:14 http://deb.debian.org/debian unstable/main Sources T-2022-09-20-1646.49-F-2022-09-20-1106.00.pdiff [22.7 kB]
Get:16 http://deb.debian.org/debian unstable/contrib Sources T-2022-09-20-1646.49-F-2022-09-20-1646.49.pdiff [31 B]
Get:15 http://deb.debian.org/debian unstable/non-free Sources T-2022-09-20-1646.49-F-2022-09-20-1646.49.pdiff [31 B]
Get:17 http://deb.debian.org/debian unstable/main amd64 Packages T-2022-09-20-1646.49-F-2022-09-20-1106.00.pdiff [36.2 kB]
Get:18 http://deb.debian.org/debian unstable/non-free amd64 Packages T-2022-09-20-1106.00-F-2022-09-20-1106.00.pdiff [5,854 B]
Get:19 http://deb.debian.org/debian-debug unstable-debug/main Sources T-2022-09-20-1646.49-F-2022-09-20-1106.00.pdiff [19.2 kB]
Get:19 http://deb.debian.org/debian-debug unstable-debug/main Sources T-2022-09-20-1646.49-F-2022-09-20-1106.00.pdiff [19.2 kB]
Get:20 http://deb.debian.org/debian-debug unstable-debug/contrib Sources T-2022-09-20-1646.49-F-2022-09-20-1646.49.pdiff [31 B]
Get:21 http://deb.debian.org/debian-debug unstable-debug/non-free Sources T-2022-09-20-1106.00-F-2022-09-20-1106.00.pdiff [887 B]
Get:20 http://deb.debian.org/debian-debug unstable-debug/contrib Sources T-2022-09-20-1646.49-F-2022-09-20-1646