Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/
Date: Thu, 22 Sep 2022 00:32:49
Message-Id: 1663806759.2dc57d72ada009425ab74d4ff46064a17d477782.marecki@gentoo
1 commit: 2dc57d72ada009425ab74d4ff46064a17d477782
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 22 00:21:53 2022 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 22 00:32:39 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dc57d72
7
8 sys-apps/gptfdisk: fix dev-libs/popt-1.19 incompatibility
9
10 Without this, starting gdisk linked against popt-1.19 fails with
11
12 Problem opening (garbage) for reading! Error is 2.
13 The specified file does not exist!
14
15 (assuming gptfdisk has been emerged without tests; otherwise this
16 does get caught by the test suite)
17
18 Closes: https://bugs.gentoo.org/872131
19 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
20
21 .../gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch | 22 ++++++++
22 sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild | 61 ++++++++++++++++++++++
23 2 files changed, 83 insertions(+)
24
25 diff --git a/sys-apps/gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch
26 new file mode 100644
27 index 000000000000..470defd33cf6
28 --- /dev/null
29 +++ b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch
30 @@ -0,0 +1,22 @@
31 +--- a/gptcl.cc
32 ++++ b/gptcl.cc
33 +@@ -156,9 +156,10 @@
34 +
35 + // Assume first non-option argument is the device filename....
36 + device = (char*) poptGetArg(poptCon);
37 +- poptResetContext(poptCon);
38 +
39 + if (device != NULL) {
40 ++ device = strdup(device);
41 ++ poptResetContext(poptCon);
42 + JustLooking(); // reset as necessary
43 + BeQuiet(); // Tell called functions to be less verbose & interactive
44 + if (LoadPartitions((string) device)) {
45 +@@ -498,6 +499,7 @@
46 + cerr << "Error encountered; not saving changes.\n";
47 + retval = 4;
48 + } // if
49 ++ free(device);
50 + } // if (device != NULL)
51 + poptFreeContext(poptCon);
52 + return retval;
53
54 diff --git a/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild b/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
55 new file mode 100644
56 index 000000000000..5ccaa186a5da
57 --- /dev/null
58 +++ b/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
59 @@ -0,0 +1,61 @@
60 +# Copyright 1999-2022 Gentoo Authors
61 +# Distributed under the terms of the GNU General Public License v2
62 +
63 +EAPI=8
64 +
65 +inherit flag-o-matic toolchain-funcs
66 +
67 +DESCRIPTION="GPT partition table manipulator for Linux"
68 +HOMEPAGE="https://www.rodsbooks.com/gdisk/"
69 +SRC_URI="mirror://sourceforge/${PN}/${PN}/${PV}/${P}.tar.gz"
70 +
71 +LICENSE="GPL-2"
72 +SLOT="0"
73 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
74 +IUSE="ncurses static"
75 +
76 +# libuuid from util-linux is required.
77 +RDEPEND="!static? (
78 + dev-libs/popt
79 + ncurses? ( sys-libs/ncurses:=[unicode(+)] )
80 + kernel_linux? ( sys-apps/util-linux )
81 + )"
82 +DEPEND="
83 + ${RDEPEND}
84 + static? (
85 + dev-libs/popt[static-libs(+)]
86 + ncurses? ( sys-libs/ncurses:=[unicode(+),static-libs(+)] )
87 + kernel_linux? ( sys-apps/util-linux[static-libs(+)] )
88 + )
89 + virtual/pkgconfig
90 +"
91 +
92 +PATCHES=(
93 + "${FILESDIR}/${PN}-1.0.9-libuuid.patch" #844073
94 + "${FILESDIR}/${PN}-1.0.9-popt_segv.patch" #872131
95 +)
96 +
97 +src_prepare() {
98 + default
99 +
100 + tc-export CXX PKG_CONFIG
101 +
102 + if ! use ncurses ; then
103 + sed -i \
104 + -e '/^all:/s: cgdisk::' \
105 + Makefile || die
106 + fi
107 +
108 + sed \
109 + -e '/g++/s:=:?=:g' \
110 + -e 's:-lncursesw:$(shell $(PKG_CONFIG) --libs ncursesw):g' \
111 + -i Makefile || die
112 +
113 + use static && append-ldflags -static
114 +}
115 +
116 +src_install() {
117 + dosbin gdisk sgdisk $(usex ncurses cgdisk '') fixparts
118 + doman *.8
119 + dodoc NEWS README
120 +}