sgdisk doesn't parse the device argument with popt-1.19. There is a fix upstream but there is no new version. So sys-apps/gptfdisk-1.0.9 needs to backport the patch: commit f5de3401b974ce103ffd93af8f9d43505a04aaf9 (HEAD -> master, origin/master, origin/HEAD) 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; Reproducible: Always
Could you include a link to the patch source? And thanks!
Nope as links are not allowed by new accounts. try this tho: sourceforge.net/u/starfire24680/gptfdisk/ci/f5de3401b974ce103ffd93af8f9d43505a04aaf9/log/
Also from carbonOS gitlab.com/carbonOS/build-meta/-/issues/104
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dc57d72ada009425ab74d4ff46064a17d477782 commit 2dc57d72ada009425ab74d4ff46064a17d477782 Author: Marek Szuba <marecki@gentoo.org> AuthorDate: 2022-09-22 00:21:53 +0000 Commit: Marek Szuba <marecki@gentoo.org> CommitDate: 2022-09-22 00:32:39 +0000 sys-apps/gptfdisk: fix dev-libs/popt-1.19 incompatibility Without this, starting gdisk linked against popt-1.19 fails with Problem opening (garbage) for reading! Error is 2. The specified file does not exist! (assuming gptfdisk has been emerged without tests; otherwise this does get caught by the test suite) Closes: https://bugs.gentoo.org/872131 Signed-off-by: Marek Szuba <marecki@gentoo.org> .../gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch | 22 ++++++++ sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild | 61 ++++++++++++++++++++++ 2 files changed, 83 insertions(+)