diff options
author | 2002-12-26 19:05:31 +0000 | |
---|---|---|
committer | 2002-12-26 19:05:31 +0000 | |
commit | 85b065d83b2a977ad24c55e535f24031efda9bef (patch) | |
tree | e627eb23820b8e3fc3946d798fb4d606001ca779 /sys-apps/man | |
parent | install man pages in correct location (diff) | |
download | historical-85b065d83b2a977ad24c55e535f24031efda9bef.tar.gz historical-85b065d83b2a977ad24c55e535f24031efda9bef.tar.bz2 historical-85b065d83b2a977ad24c55e535f24031efda9bef.zip |
fix segfault; fix debugging info for locale confusing
Diffstat (limited to 'sys-apps/man')
-rw-r--r-- | sys-apps/man/ChangeLog | 13 | ||||
-rw-r--r-- | sys-apps/man/files/man-1.5k-locale-debug-info.patch | 57 | ||||
-rw-r--r-- | sys-apps/man/files/man-1.5k-util_c-segfault.patch | 67 | ||||
-rw-r--r-- | sys-apps/man/man-1.5k-r1.ebuild | 15 | ||||
-rw-r--r-- | sys-apps/man/man-1.5k.ebuild | 26 |
5 files changed, 172 insertions, 6 deletions
diff --git a/sys-apps/man/ChangeLog b/sys-apps/man/ChangeLog index 8123fc530482..0af930adf3d2 100644 --- a/sys-apps/man/ChangeLog +++ b/sys-apps/man/ChangeLog @@ -1,6 +1,17 @@ # ChangeLog for sys-apps/man # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL -# $Header: /var/cvsroot/gentoo-x86/sys-apps/man/ChangeLog,v 1.10 2002/12/26 04:56:01 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/man/ChangeLog,v 1.11 2002/12/26 19:05:31 azarah Exp $ + + 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). + - Add man-1.5k-locale-debug-info.patch to make man not print the + 'man: No such file or directory' error if 'man -d' was called and + the NLS catalogue was not found, as it confuses people, and be + more informative ... (bug #6360) *man-1.5k-r1 (26 Dec 2002) diff --git a/sys-apps/man/files/man-1.5k-locale-debug-info.patch b/sys-apps/man/files/man-1.5k-locale-debug-info.patch new file mode 100644 index 000000000000..bf51f46a9a71 --- /dev/null +++ b/sys-apps/man/files/man-1.5k-locale-debug-info.patch @@ -0,0 +1,57 @@ + Do not print the 'man: No such file or directory' error if + 'man -d' was called and the NLS catalogue was not found, as + it confuses people, and be more informative. More info at: + + http://bugs.gentoo.org/show_bug.cgi?id= + + + Martin Schlemmer <azarah@gentoo.org> (26 Dec 2002). + +--- man-1.5k/catopen/catopen.c.orig 2002-12-26 08:25:07.000000000 +0200 ++++ man-1.5k/catopen/catopen.c 2002-12-26 10:25:06.000000000 +0200 +@@ -10,7 +10,11 @@ + extern char *my_malloc(int); /* in util.c */ + + #ifndef DEFAULT_NLSPATH +-#define DEFAULT_NLSPATH "/usr/lib/locale/%N/%L" ++# if __GLIBC__ >= 2 ++# define DEFAULT_NLSPATH "/usr/share/locale/%L/%N" ++# else ++# define DEFAULT_NLSPATH "/usr/lib/locale/%N/%L" ++# endif + #endif + + static nl_catd my_catopenpath(char *name, char *path); +--- man-1.5k/src/gripes.c.orig 2002-12-26 08:13:53.000000000 +0200 ++++ man-1.5k/src/gripes.c 2002-12-26 10:29:46.000000000 +0200 +@@ -47,14 +47,25 @@ + if (!lg) + lg = getenv("LC_ALL"); + if ((s || lg) && (!lg || strncmp(lg, "en", 2))) { +- perror(mantexts); ++ /* This prints 'man: No such file or directory' which ++ * confuses people. The fprintf message should really ++ * be enouth ... ++ */ ++/* perror(mantexts); */ ++ + fprintf(stderr, +-"Failed to open the message catalog %s on the path NLSPATH=%s\n\n", +- mantexts, s ? s : "<none>"); ++"Failed to open the message catalog \"%s\" for locale \"%s\"\n\ ++(NLSPATH=\"%s\")\n\n", ++ mantexts, lg ? lg : "<none>", ++ s ? s : DEFAULT_NLSPATH); + } else if (debug) { +- perror(mantexts); ++ /* This prints 'man: No such file or directory' which ++ * confuses people. The fprintf message should really ++ * be enouth ... ++ */ ++/* perror(mantexts); */ + fprintf(stderr, +-"Looked whether there exists a message catalog %s, but there is none ++"Looked whether there exists a message catalog \"%s\", but there is none\n\ + (and for English messages none is needed)\n\n", + mantexts); + } diff --git a/sys-apps/man/files/man-1.5k-util_c-segfault.patch b/sys-apps/man/files/man-1.5k-util_c-segfault.patch new file mode 100644 index 000000000000..c5ee207f4572 --- /dev/null +++ b/sys-apps/man/files/man-1.5k-util_c-segfault.patch @@ -0,0 +1,67 @@ + When calling man for instance with: + + $ man -k "foo bar" + + will result in the following crash: + + $ man -k "foo bar" + sh: line 1: unsafe: command not found + Error executing formatting or display command. + System command unsafe exited with status 127. + Segmentation fault + + 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. + + More info can be found at: + + http://bugs.gentoo.org/show_bug.cgi?id=9761 + + Alternatively it is possible to redefine what is "shell safe", + but that will me a much more comprehensive fix ... + + + Martin Schlemmer <azarah@gentoo.org> (26 Dec 2002). + +--- man-1.5k/src/util.c.orig 2002-12-26 07:41:03.000000000 +0200 ++++ man-1.5k/src/util.c 2002-12-26 07:51:48.000000000 +0200 +@@ -261,7 +261,7 @@ + * The %S parameters are checked for being shell safe. + * The %Q parameters are checked for being shell safe inside single quotes. + */ +-#define NOT_SAFE "unsafe" ++#define NOT_SAFE "echo Cannot run command, as it is not shell safe!\necho Check that you do not quote search strings, etc." + + static int + is_shell_safe(const char *ss, int quoted) { +@@ -295,8 +295,14 @@ + case 'Q': + case 'S': /* check and turn into 's' */ + ss = va_arg(p, char *); +- if (!is_shell_safe(ss, (s[1] == 'Q'))) +- return NOT_SAFE; ++ if (!is_shell_safe(ss, (s[1] == 'Q'))) { ++ /* we cannot return NOT_SAFE, as it will cause ++ * free to segfault in trying to free a constant ++ */ ++ s = my_malloc(sizeof(NOT_SAFE) + 1); ++ s = strncpy(s, NOT_SAFE, sizeof(NOT_SAFE)); ++ return s; ++ } + len += strlen(ss); + s[1] = 's'; + break; diff --git a/sys-apps/man/man-1.5k-r1.ebuild b/sys-apps/man/man-1.5k-r1.ebuild index 50c2ae5b333e..58299d1d2bd9 100644 --- a/sys-apps/man/man-1.5k-r1.ebuild +++ b/sys-apps/man/man-1.5k-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/man/man-1.5k-r1.ebuild,v 1.1 2002/12/26 04:51:02 azarah Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/man/man-1.5k-r1.ebuild,v 1.2 2002/12/26 19:05:31 azarah Exp $ IUSE="" @@ -60,6 +60,16 @@ src_unpack() { # Fix wierd failing in rare cases epatch ${FILESDIR}/${P}-wrong-quotes.patch + + # Fix a crash when calling man with: man -k "foo bar" (bug #9761). + # <azarah@gentoo.org> (26 Dec 2002). + epatch ${FILESDIR}/${P}-util_c-segfault.patch + + # Do not print the 'man: No such file or directory' error if + # 'man -d' was called and the NLS catalogue was not found, as + # it confuses people, and be more informative ... (bug #6360) + # <azarah@gentoo.org> (26 Dec 2002). + epatch ${FILESDIR}/${P}-locale-debug-info.patch } src_compile() { @@ -86,6 +96,9 @@ src_install() { chmod 2555 ${D}/usr/bin/man chown root.man ${D}/usr/bin/man + + # Needed for makewhatis + keepdir /var/cache/man insinto /etc cd ${S} diff --git a/sys-apps/man/man-1.5k.ebuild b/sys-apps/man/man-1.5k.ebuild index fb566d6c4e52..cbd4154dcdf3 100644 --- a/sys-apps/man/man-1.5k.ebuild +++ b/sys-apps/man/man-1.5k.ebuild @@ -1,9 +1,13 @@ # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/man/man-1.5k.ebuild,v 1.8 2002/12/15 10:44:23 bjb Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/man/man-1.5k.ebuild,v 1.9 2002/12/26 19:05:31 azarah Exp $ -NV=1.5k -S=${WORKDIR}/${PN}-${NV} +IUSE="" + +inherit eutils + +NV="${PV}" +S="${WORKDIR}/${PN}-${NV}" DESCRIPTION="Standard commands to read man pages" SRC_URI="http://www.kernel.org/pub/linux/utils/man/man-${NV}.tar.gz" HOMEPAGE="http://freshmeat.net/projects/man/" @@ -19,6 +23,7 @@ LICENSE="GPL-2" src_unpack() { unpack ${A} + cd ${S} cp configure configure.orig sed -e 's:/usr/lib/locale:$(prefix)/usr/lib/locale:g' \ @@ -41,6 +46,16 @@ src_unpack() { cp Makefile Makefile.orig sed -e "s:cc -o:gcc -o:" Makefile.orig > Makefile + cd ${S} + # Fix a crash when calling man with: man -k "foo bar" (bug #9761). + # <azarah@gentoo.org> (26 Dec 2002). + epatch ${FILESDIR}/${P}-util_c-segfault.patch + + # Do not print the 'man: No such file or directory' error if + # 'man -d' was called and the NLS catalogue was not found, as + # it confuses people, and be more informative ... (bug #6360) + # <azarah@gentoo.org> (26 Dec 2002). + epatch ${FILESDIR}/${P}-locale-debug-info.patch } src_compile() { @@ -67,7 +82,10 @@ src_install() { chmod 2555 ${D}/usr/bin/man chown root.man ${D}/usr/bin/man - + + # Needed for makewhatis + keepdir /var/cache/man + insinto /etc cd ${S} doins src/man.conf |