Closed mid-kid closed 1 year ago
I see it at Arch. Ran it with gdb
and see following stack trace:
➜ android-tools git:(master) gdb ./build/vendor/lpmake
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/vendor/lpmake...
(gdb) set args --help
(gdb) r
Starting program: /mnt/nvme/sources/android-tools/build/vendor/lpmake --help
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b6ff7d in ?? () from /usr/lib/libc.so.6
=> 0x00007ffff7b6ff7d: c5 fd 74 0f vpcmpeqb (%rdi),%ymm0,%ymm1
(gdb) bt
#0 0x00007ffff7b6ff7d in ?? () from /usr/lib/libc.so.6
#1 0x00005555555607e5 in std::char_traits<char>::length (__s=0x0)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/bits/char_traits.h:395
#2 0x0000555555564e32 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (
this=0x7fffffffdcd0, __s=0x0)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/bits/basic_string.h:1648
#3 0x000055555555f94d in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (
this=0x7fffffffdcd0, __s=0x0)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/bits/basic_string.h:815
#4 0x000055555555d0e2 in main (argc=2, argv=0x7fffffffe078)
at android-tools/vendor/extras/partition_tools/lpmake.cc:259
(gdb)
quit
I looked at the sources and see that --help
incorrectly matched to kOutput
enum value which expects an argument value. Instead "help" should be matched to Option::kHelp
.
With the following patch the tool build and runs with --help
fine:
diff --git a/partition_tools/lpmake.cc b/partition_tools/lpmake.cc
index e6c4e5305..76372daf0 100644
--- a/partition_tools/lpmake.cc
+++ b/partition_tools/lpmake.cc
@@ -182,7 +182,7 @@ int main(int argc, char* argv[]) {
{ "metadata-slots", required_argument, nullptr, (int)Option::kMetadataSlots },
{ "partition", required_argument, nullptr, (int)Option::kPartition },
{ "output", required_argument, nullptr, (int)Option::kOutput },
- { "help", no_argument, nullptr, (int)Option::kOutput },
+ { "help", no_argument, nullptr, (int)Option::kHelp },
{ "alignment-offset", required_argument, nullptr, (int)Option::kAlignmentOffset },
{ "alignment", required_argument, nullptr, (int)Option::kAlignment },
{ "sparse", no_argument, nullptr, (int)Option::kSparse },
So it is an upstream issue.
Bizarre that the first thing I try to make sure the package built correctly, and feels like something that shouldn't crash under any circumstances, is the very thing that has a legitimate upstream bug.
Thanks for helping me figure it out.
https://android-review.googlesource.com/c/platform/system/extras/+/2236654 is the submitted version fwiw :)
Btw should we include this as a patch for now under patches/extras
?
I wonder if this is reproducible on other systems. This happens on gentoo with version 33.0.3. No crazy build options, everything up-to-date. If not, I will eat my farts and dig deeper.