app-text/pinfo-0.6.10-r5:0::gentoo crashes on amd64 if a file name to open is given as parameter: $ gdb -q --args pinfo ./doc/find.info Reading symbols from pinfo...Reading symbols from /usr/lib64/debug//usr/bin/pinfo.debug...done. done. (gdb) run Starting program: /usr/bin/pinfo ./doc/find.info Przemek's Info Viewer v0.6.10 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7627bad in __strstr_sse2_unaligned () from /lib64/libc.so.6 (gdb) up #1 0x00000000004061c2 in strip_info_suffix (file=file@entry=0xffffffffffffe186 <error: Cannot access memory at address 0xffffffffffffe186>) at filehandling_functions.c:1249 1249 if ( (found = strstr(file, suffix)) != NULL ) (gdb) #2 0x0000000000406229 in matchfile (buf=buf@entry=0x7fffffffdc38, name=name@entry=0x7fffffffe180 "./doc/find.info") at filehandling_functions.c:79 79 strip_info_suffix(bname); (gdb) p name $1 = 0x7fffffffe180 "./doc/find.info" (gdb) p bname $2 = 0xffffffffffffe186 <error: Cannot access memory at address 0xffffffffffffe186> (gdb) The first 32 bits of the 64 bit pointer returned out of basename() are invalid because the prototype of basename() was not available at compile time (and the return type defaulted to int). Adding the following line at the top of filehandling_functions.c fixes the bug: #include <libgen.h>
string.h in glibc has provided a basename prototype for more than a decade, and that header is included by the source already. i can't say why your system isn't working as you haven't provided any details about it: all bug reports really need emerge info and a full build log attached to them.
Created attachment 430860 [details] pinfo-build.log.gz (In reply to SpanKY from comment #1) > string.h in glibc has provided a basename prototype for more than a decade, > and that header is included by the source already. It could be caused by using gcc-5.3.0 for build I guess. > i can't say why your system isn't working My system works as documented but pinfo does not. See the basename(3) man page. > as you haven't provided any details about it: all bug > reports really need emerge info and a full build log attached to them. I am attaching the build log. emerge info would be confusing because I do not use emerge for build so its configuration could differ.
(In reply to Kamil Dudka from comment #2) i'm using gcc-5.3 and it works fine. your system is *not* working as documented. the glibc manual shows that string.h is sufficient: https://www.gnu.org/software/libc/manual/html_node/Finding-Tokens-in-a-String.html basename() is provided by string.h. if it isn't on your system, something is broken. if you aren't using emerge then you know well enough that every PM has an equiv to `emerge --info` -- so provide it. your build.log shows some misbehavior: checking if ncurses supports extended chars... yes, with -D_XOPEN_SOURCE_EXTENDED checking for wcwidth... with -D_XOPEN_SOURCE=600 those defines shouldn't be there.
Created attachment 430912 [details] cave-info.gz I am attaching the output of 'cave info pinfo'. Note that the -ggdb flag was added by me while attempting to debug it. The crash occurred without that flag, too.