$ man -k blah blah: nothing appropriate $ man -k "blah blah" sh: unsafe: command not found Error executing formatting or display command. System command unsafe exited with status 127. Segmentation fault $ man --version man, version 1.5k
Created attachment 6746 [details, diff] man-1.5k-util_c-segfault.patch 26 Dec 2002; Martin Schlemmer <azarah@gentoo.org> man-1.5k.ebuild, man-1.5k-r1.ebuild : Bugfixes: - Add man-1.5k-util_c-segfault.patch to fix a crash when calling man with: man -k "foo bar" (bug #9761).
The reason for this is that my_xsprintf() in util.c passes NOT_SAFE as the result if the string is not shell safe. When do_appros() (or whatever) then calls 'free(command)', free() tries to free a constant, and segfault. The attached solution are not eligant, but works without breaking the API. Basically we redefine NOT_SAFE as a message that we want to display, prepended with 'echo'. When the command is then executed, our message are displayed, and not the the line containing: sh: line 1: unsafe: command not found Further more, we do not return NOT_SAFE, but rather a string that we malloc, and then fill with the contents of NOT_SAFE, which will solve us trying to free a constant. Alternatively it is possible to redefine what is "shell safe", but that will me a much more comprehensive fix ... ----- $ man -k "blah blah" Cannot run command, as it is not shell safe! Check that you do not quote search strings, etc.
Fixed.