diff --git a/automake-1.12.patch b/automake-1.12.patch deleted file mode 100644 index a461880..0000000 --- a/automake-1.12.patch +++ /dev/null @@ -1,86 +0,0 @@ -Index: man-db-2.5.2/configure.ac -=================================================================== ---- man-db-2.5.2.orig/configure.ac -+++ man-db-2.5.2/configure.ac -@@ -20,6 +20,8 @@ dnl - AC_PROG_CC - AC_PROG_CPP - AC_GNU_SOURCE -+AM_PROG_AR -+AM_PROG_CC_C_O - dnl - dnl check for system defaults - dnl -diff -urN man-db-2.5.2.orig/aclocal.m4 man-db-2.5.2/aclocal.m4 ---- man-db-2.5.2.orig/aclocal.m4 2012-07-02 05:51:00.699476202 +0800 -+++ man-db-2.5.2/aclocal.m4 2012-07-02 05:51:15.795287476 +0800 -@@ -449,7 +449,7 @@ - AM_MISSING_PROG(MAKEINFO, makeinfo) - AM_PROG_INSTALL_SH - AM_PROG_INSTALL_STRIP --AC_REQUIRE([AM_PROG_MKDIR_P])dnl -+AC_REQUIRE([AC_PROG_MKDIR_P])dnl - # We need awk for the "check" target. The system "awk" is bad on - # some platforms. - AC_REQUIRE([AC_PROG_AWK])dnl -@@ -625,10 +625,10 @@ - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. - --# AM_PROG_MKDIR_P -+# AC_PROG_MKDIR_P - # --------------- - # Check for `mkdir -p'. --AC_DEFUN([AM_PROG_MKDIR_P], -+AC_DEFUN([AC_PROG_MKDIR_P], - [AC_PREREQ([2.60])dnl - AC_REQUIRE([AC_PROG_MKDIR_P])dnl - dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -diff -urN man-db-2.5.2.orig/configure.ac man-db-2.5.2/configure.ac ---- man-db-2.5.2.orig/configure.ac 2012-07-02 05:51:00.679476451 +0800 -+++ man-db-2.5.2/configure.ac 2012-07-02 06:39:30.342100663 +0800 -@@ -4,7 +4,7 @@ - # Initialise and check we're in the correct directory. - AC_INIT([man-db], [2.5.2], [cjwatson@debian.org]) - AC_CONFIG_AUX_DIR(tools) --AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign]) -+AM_INIT_AUTOMAKE([1.10 -Wall foreign]) - AC_PREREQ([2.59]) - AC_CONFIG_SRCDIR(src/man.c) - -diff -urN man-db-2.5.2.orig/gnulib/m4/gnulib-common.m4 man-db-2.5.2/gnulib/m4/gnulib-common.m4 ---- man-db-2.5.2.orig/gnulib/m4/gnulib-common.m4 2012-07-02 05:51:00.657476726 +0800 -+++ man-db-2.5.2/gnulib/m4/gnulib-common.m4 2012-07-02 05:51:15.795287476 +0800 -@@ -36,7 +36,7 @@ - # Remove this macro when we can assume autoconf >= 2.60. - m4_ifdef([AC_PROG_MKDIR_P], [], [ - AC_DEFUN([AC_PROG_MKDIR_P], -- [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake -+ [AC_REQUIRE([AC_PROG_MKDIR_P])dnl defined by automake - MKDIR_P='$(mkdir_p)' - AC_SUBST([MKDIR_P])])]) - -diff -urN man-db-2.5.2.orig/m4/intl.m4 man-db-2.5.2/m4/intl.m4 ---- man-db-2.5.2.orig/m4/intl.m4 2012-07-02 05:51:00.681476426 +0800 -+++ man-db-2.5.2/m4/intl.m4 2012-07-02 05:51:15.796287464 +0800 -@@ -25,7 +25,7 @@ - AC_DEFUN([AM_INTL_SUBDIR], - [ - AC_REQUIRE([AC_PROG_INSTALL])dnl -- AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake -+ AC_REQUIRE([AC_PROG_MKDIR_P])dnl defined by automake - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([gt_GLIBC2])dnl -diff -urN man-db-2.5.2.orig/m4/po.m4 man-db-2.5.2/m4/po.m4 ---- man-db-2.5.2.orig/m4/po.m4 2012-07-02 05:51:00.681476426 +0800 -+++ man-db-2.5.2/m4/po.m4 2012-07-02 05:51:15.796287464 +0800 -@@ -24,7 +24,7 @@ - [ - AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl -- AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake -+ AC_REQUIRE([AC_PROG_MKDIR_P])dnl defined by automake - AC_REQUIRE([AM_NLS])dnl - - dnl Release version of the gettext macros. This is used to ensure that diff --git a/man-db-2.5.1-globbing.dif b/man-db-2.5.1-globbing.dif deleted file mode 100644 index ccc41c2..0000000 --- a/man-db-2.5.1-globbing.dif +++ /dev/null @@ -1,31 +0,0 @@ ---- src/globbing.c -+++ src/globbing.c 2007-09-19 13:35:04.128822519 +0200 -@@ -340,13 +340,22 @@ char **look_for_file (const char *unesc_ - /* allow lookups like "3x foo" to match "../man3/foo.3x" */ - - if ((layout & LAYOUT_GNU) && CTYPE (isdigit, *sec) && sec[1] != '\0') { -- path = appendstr (path, hier, cat ? "/cat" : "/man", "\t", -- NULL); -- *strrchr (path, '\t') = *sec; -- pattern = end_pattern (appendstr (pattern, name, NULL), sec); -+ off_t nptr, nsec; - -- status = match_in_directory (path, pattern, !match_case, -- &gbuf); -+ path = appendstr (path, hier, cat ? "/cat" : "/man", NULL); -+ nptr = strlen(path); -+ path = appendstr (path, sec, NULL); -+ nsec = nptr + strlen(sec); -+ -+ while (nsec > nptr) { -+ *(path + nsec--) = '\0'; -+ if (pattern) -+ *pattern = '\0'; -+ pattern = end_pattern (appendstr (pattern, name, NULL), sec); -+ status = match_in_directory (path, pattern, !match_case, &gbuf); -+ if ((status == 0) && (gbuf.gl_pathc != 0)) -+ break; -+ } - } - - /* AIX glob.h doesn't define GLOB_NOMATCH and the manpage is vague diff --git a/man-db-2.5.1-security4.dif b/man-db-2.5.1-security4.dif deleted file mode 100644 index d35f18f..0000000 --- a/man-db-2.5.1-security4.dif +++ /dev/null @@ -1,32 +0,0 @@ ---- src/mandb.c -+++ src/mandb.c 2008-04-21 13:06:01.440910914 +0200 -@@ -36,6 +36,7 @@ - #include - #include - #include /* for chmod() */ -+#include /* for open () */ - #include - #include - -@@ -414,11 +415,20 @@ static short mandb (const char *catpath, - char pid[23]; - short amount; - char *dbname; -+ int fd; - - dbname = mkdbname (catpath); - sprintf (pid, "%d", getpid ()); - database = appendstr (NULL, catpath, "/", pid, NULL); -- -+ -+ /* Just for the case that catpath isn't a system catpath */ -+ drop_effective_privs (); -+ fd = open (database, O_WRONLY | O_CREAT | O_EXCL, 0644); -+ regain_effective_privs (); -+ if (fd < 0) -+ error (FATAL, errno, _("can't create a temporary filename")); -+ close(fd); -+ - if (!quiet) - printf (_("Processing manual pages under %s...\n"), manpath); - #ifdef NDBM diff --git a/man-db-2.5.1-zio.dif b/man-db-2.5.1-zio.dif deleted file mode 100644 index eb005cc..0000000 --- a/man-db-2.5.1-zio.dif +++ /dev/null @@ -1,305 +0,0 @@ ---- config.h.in -+++ config.h.in 2007-12-07 15:50:23.000000000 +0100 -@@ -454,6 +454,9 @@ - /* Define to 1 if you have the `z' library (-lz). */ - #undef HAVE_LIBZ - -+/* Define to 1 if you have libzio for opening compressed manuals */ -+#undef HAVE_ZIO -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_LIMITS_H - ---- configure.ac -+++ configure.ac 2008-04-21 13:18:38.854059561 +0200 -@@ -94,7 +94,18 @@ AC_ARG_WITH(sections, - sections="$withval" - fi], - [: ${sections=1 n l 8 3 2 5 4 9 6 7}]) -- -+AC_ARG_WITH(zio, -+[AS_HELP_STRING([--with-zio=LIBRARY], [use zlib/libbz2 wrapper library LIBRARY (libzio)])], -+ [if test -z "$withval" -o "$withval" = "yes" -+ then -+ zio=libzio -+ elif test "$withval" = "no" -+ then -+ AC_MSG_ERROR(--with-zio requires an argument) -+ else -+ zio=$withval -+ fi], -+ : ${zio=no}) - # Finish the argument parsing. - AC_SUBST(man_owner)dnl - AC_SUBST(man_mode)dnl -@@ -294,6 +305,29 @@ AC_SUBST(gunzip) - AC_SUBST(uncompress) - AC_SUBST(bunzip2) - MAN_COMPRESS_LIB([z], [gzopen]) -+dnl Check for zlib and libbz2 libraries to use this together -+dnl with SuSE's libzio to open compressed info files. -+dnl -+if test "$zio" = "no" || test -n "$zio" -+then -+ AC_CHECK_HEADER(zio.h,[ -+ for lib in ${zio#lib} zio -+ do -+ AC_CHECK_LIB($lib, fzopen, [LIBS="-l$lib $LIBS" -+ AC_DEFINE([COMP_SRC],[],[Define if you have compressors and want to support compressed cat files.]) -+ AC_DEFINE([HAVE_ZIO],[],[Define to 1 if you have libzio for opening compressed manuals])]) -+ done]) -+ AC_CHECK_HEADER(zlib.h,[ -+ for lib in z gz -+ do -+ AC_CHECK_LIB($lib, gzopen, [LIBS="$LIBS -Wl,--no-as-needed -l$lib" ; break]) -+ done]) -+ AC_CHECK_HEADER(bzlib.h,[ -+ for lib in bz2 bzip2 -+ do -+ AC_CHECK_LIB($lib, BZ2_bzopen, [LIBS="$LIBS -Wl,--no-as-needed -l$lib" ; break]) -+ done]) -+fi - dnl To add more decompressors just follow the scheme above. - - # Work out which manual page hierarchy scheme might be in use. ---- lib/decompress.c -+++ lib/decompress.c 2008-04-23 10:48:04.431353342 +0000 -@@ -36,6 +36,10 @@ - # include "zlib.h" - #endif /* HAVE_LIBZ */ - -+#ifdef HAVE_ZIO -+# include "zio.h" -+#endif /* HAVE_ZIO */ -+ - #include "manconfig.h" - #include "comp_src.h" - #include "pipeline.h" -@@ -66,6 +70,32 @@ static void decompress_zlib (void *data - - #endif /* HAVE_LIBZ */ - -+#ifdef HAVE_ZIO -+ -+static void decompress_zio (void *data) -+{ -+ const char *what = (const char*)data; -+ FILE *file; -+ -+ file = fdzopen(dup (fileno (stdin)), "r", what); -+ if (!file) -+ return; -+ -+ for (;;) { -+ char buffer[4096]; -+ int r = fread(buffer, sizeof(char), sizeof(buffer), file); -+ if (r <= 0) -+ break; -+ if (fwrite (buffer, 1, (size_t) r, stdout) < (size_t) r) -+ break; -+ } -+ -+ fclose(file); -+ return; -+} -+ -+#endif /* HAVE_ZIO */ -+ - pipeline *decompress_open (const char *filename) - { - command *cmd; -@@ -77,9 +107,53 @@ pipeline *decompress_open (const char *f - char *ext; - struct compression *comp; - -- if (stat (filename, &st) < 0 && !S_ISDIR (st.st_mode)) -+ if (stat (filename, &st) < 0 || S_ISDIR (st.st_mode)) - return NULL; - -+#ifdef HAVE_ZIO -+ ext = strrchr(filename, '.'); -+ if (ext && STREQ (ext, ".gz")) { -+ /* informational only; no shell quoting concerns */ -+ char *name = appendstr (NULL, "zcat < ", filename, NULL); -+ cmd = command_new_function (name, &decompress_zio, "g"); -+ free (name); -+ p = pipeline_new_commands (cmd, NULL); -+ if (strcmp(program_name, "mandb") == 0) -+ p->libzio = 1; -+ goto got_pipeline; -+ } -+ if (ext && STREQ (ext, ".z")) { -+ /* informational only; no shell quoting concerns */ -+ char *name = appendstr (NULL, "zcat < ", filename, NULL); -+ cmd = command_new_function (name, &decompress_zio, "z"); -+ free (name); -+ p = pipeline_new_commands (cmd, NULL); -+ if (strcmp(program_name, "mandb") == 0) -+ p->libzio = 1; -+ goto got_pipeline; -+ } -+ if (ext && STREQ (ext, ".bz2")) { -+ /* informational only; no shell quoting concerns */ -+ char *name = appendstr (NULL, "bzcat < ", filename, NULL); -+ cmd = command_new_function (name, &decompress_zio, "b"); -+ free (name); -+ p = pipeline_new_commands (cmd, NULL); -+ if (strcmp(program_name, "mandb") == 0) -+ p->libzio = 1; -+ goto got_pipeline; -+ } -+ if (ext && STREQ (ext, ".Z")) { -+ /* informational only; no shell quoting concerns */ -+ char *name = appendstr (NULL, "zcat < ", filename, NULL); -+ cmd = command_new_function (name, &decompress_zio, "Z"); -+ free (name); -+ p = pipeline_new_commands (cmd, NULL); -+ if (strcmp(program_name, "mandb") == 0) -+ p->libzio = 1; -+ goto got_pipeline; -+ } -+#endif /* HAVE_ZIO */ -+ - #ifdef HAVE_LIBZ - filename_len = strlen (filename); - if (filename_len > 3 && STREQ (filename + filename_len - 3, ".gz")) { ---- lib/pipeline.c -+++ lib/pipeline.c 2008-04-23 10:52:16.655715088 +0000 -@@ -50,6 +50,10 @@ - #include "error.h" - #include "pipeline.h" - -+#ifdef HAVE_ZIO -+# include "zio.h" -+#endif /* HAVE_ZIO */ -+ - /* ---------------------------------------------------------------------- */ - - /* Functions to build individual commands. */ -@@ -441,6 +445,9 @@ pipeline *pipeline_new (void) - p->commands = xnmalloc (p->commands_max, sizeof *p->commands); - p->pids = NULL; - p->statuses = NULL; -+#ifdef HAVE_ZIO -+ p->libzio = 0; -+#endif - p->want_in = p->want_out = 0; - p->want_infile = p->want_outfile = NULL; - p->infd = p->outfd = -1; -@@ -479,6 +486,9 @@ pipeline *pipeline_join (pipeline *p1, p - pipeline *p = XMALLOC (pipeline); - int i; - -+#ifdef HAVE_ZIO -+ assert (p->libzio); -+#endif - assert (!p1->pids); - assert (!p2->pids); - assert (!p1->statuses); -@@ -614,6 +624,9 @@ void pipeline_commands (pipeline *p, ... - - FILE *pipeline_get_infile (pipeline *p) - { -+#ifdef HAVE_ZIO -+ assert (!p->libzio); -+#endif - assert (p->pids); /* pipeline started */ - assert (p->statuses); - if (p->infile) -@@ -627,6 +640,12 @@ FILE *pipeline_get_infile (pipeline *p) - - FILE *pipeline_get_outfile (pipeline *p) - { -+#ifdef HAVE_ZIO -+ if (p->libzio) { -+ assert (p->outfile != (FILE*)0); -+ return p->outfile; -+ } -+#endif - assert (p->pids); /* pipeline started */ - assert (p->statuses); - if (p->outfile) -@@ -707,6 +726,24 @@ void pipeline_start (pipeline *p) - int infd[2]; - sigset_t set, oset; - -+#ifdef HAVE_ZIO -+ if (p->ncommands != 1) /* A pipe to the following commands required */ -+ p->libzio = 0; -+ -+ if (p->libzio) { -+ struct command_function *cmdf; -+ -+ assert (p->ncommands == 1); -+ assert (p->commands[0]->tag == COMMAND_FUNCTION); -+ assert (p->want_infile != NULL); -+ -+ cmdf = &p->commands[0]->u.function; -+ -+ p->outfile = fzopen(p->want_infile, "r"); -+ -+ return; -+ } -+#endif - /* Flush all pending output so that subprocesses don't inherit it. */ - fflush (NULL); - -@@ -1009,6 +1046,19 @@ int pipeline_wait (pipeline *p) - pipeline_dump (p, stderr); - } - -+#ifdef HAVE_ZIO -+ if (p->libzio) { -+ assert (p->outfile != (FILE*)0); -+ if (fclose (p->outfile)) { -+ error (0, errno, _("closing pipeline output stream failed")); -+ ret = 1; -+ } -+ p->outfile = (FILE*)0; -+ p->outfd = -1; -+ return ret; -+ } -+#endif -+ - assert (p->pids); /* pipeline started */ - assert (p->statuses); - -@@ -1549,11 +1599,20 @@ static const char *get_block (pipeline * - - if (!peek) - p->peek_offset = 0; -- -+#ifdef HAVE_ZIO -+ if (p->libzio) { -+ assert (p->outfile != (FILE*)0); -+ r = fread (p->buffer + readstart, sizeof(char), toread, p->outfile); -+ goto out; -+ } -+#endif - assert (p->outfd != -1); - r = read (p->outfd, p->buffer + readstart, toread); - if (r == -1) - return NULL; -+#ifdef HAVE_ZIO -+out: -+#endif - p->buflen = readstart + r; - if (peek) - p->peek_offset += r; ---- lib/pipeline.h -+++ lib/pipeline.h 2008-04-22 13:52:44.846881571 +0000 -@@ -60,6 +60,14 @@ typedef struct pipeline { - pid_t *pids; - int *statuses; /* -1 until command exits */ - -+#ifdef HAVE_ZIO -+ /* -+ * Uses for e.g. simple decompression the help of libzio. -+ * Do not fork in this case but open the compressed files. -+ */ -+ int libzio; -+#endif -+ - /* To be set by the caller. If positive, these contain - * caller-supplied file descriptors for the input and output of the - * whole pipeline. If negative, pipeline_start() will create pipes diff --git a/man-db-2.5.2-catp.dif b/man-db-2.5.2-catp.dif deleted file mode 100644 index b3e07e6..0000000 --- a/man-db-2.5.2-catp.dif +++ /dev/null @@ -1,168 +0,0 @@ ---- include/manconfig.h.in -+++ include/manconfig.h.in 2008-04-21 13:32:56.000000000 +0200 -@@ -375,8 +375,10 @@ extern char *program_name; /* the basena - #define NOT_FOUND 16 /* No action was taken */ - - /* System or user catpaths? Allow bitwise disjunctions of these. */ --#define SYSTEM_CAT 1 --#define USER_CAT 2 -+#define SYSTEM_CATP 1 -+#define USER_CATP 2 -+#define FILE_CATP 4 -+#define WHATIS_CATP 8 - - /* string macros */ - #define STREQ(a,b) (strcmp(a,b) == 0) ---- src/catman.c -+++ src/catman.c 2008-01-30 12:02:21.000000000 +0100 -@@ -450,7 +450,7 @@ int main (int argc, char *argv[]) - char *catpath; - size_t len; - -- catpath = get_catpath (*mp, SYSTEM_CAT | USER_CAT); -+ catpath = get_catpath (*mp, SYSTEM_CATP|USER_CATP); - - if (catpath) { - if (is_directory (catpath) != 1) { ---- src/man.c -+++ src/man.c 2008-04-21 17:53:02.000000000 +0200 -@@ -1249,8 +1304,7 @@ static pipeline *make_roff_command (cons - #ifdef ALT_EXT_FORMAT - /* Check both external formatter locations */ - if (dir && !recode) { -- char *catpath = get_catpath -- (dir, global_manpath ? SYSTEM_CAT : USER_CAT); -+ char *catpath = get_catpath (dir, global_manpath ? SYSTEM_CATP : USER_CATP); - - /* If we have an alternate catpath */ - if (catpath) { -@@ -2366,8 +2450,7 @@ static char *find_cat_file (const char * - */ - if (!STREQ (man_file, original)) { - global_manpath = is_global_mandir (man_file); -- cat_path = get_catpath -- (man_file, global_manpath ? SYSTEM_CAT : USER_CAT); -+ cat_path = get_catpath (man_file, (global_manpath ? SYSTEM_CATP : USER_CATP)|FILE_CATP); - - if (cat_path) { - cat_file = convert_name (cat_path, 0); -@@ -2394,8 +2477,7 @@ static char *find_cat_file (const char * - } - - global_manpath = is_global_mandir (original); -- cat_path = get_catpath -- (original, global_manpath ? SYSTEM_CAT : USER_CAT); -+ cat_path = get_catpath (original, (global_manpath ? SYSTEM_CATP : USER_CATP)|FILE_CATP); - - if (cat_path) { - cat_file = convert_name (cat_path, 0); -@@ -2884,9 +2966,7 @@ static int display_database (struct cand - - if (access (file, R_OK) != 0) { - char *catpath; -- catpath = get_catpath (candp->path, -- global_manpath ? SYSTEM_CAT -- : USER_CAT); -+ catpath = get_catpath (candp->path, global_manpath ? SYSTEM_CATP : USER_CATP); - - if (catpath && strcmp (catpath, candp->path) != 0) { - file = make_filename (catpath, name, -@@ -3001,7 +3081,7 @@ static int try_db (const char *manpath, - - /* find out where our db for this manpath should be */ - -- catpath = get_catpath (manpath, global_manpath ? SYSTEM_CAT : USER_CAT); -+ catpath = get_catpath (manpath, (global_manpath ? SYSTEM_CATP : USER_CATP)|FILE_CATP); - if (catpath) { - database = mkdbname (catpath); - free (catpath); ---- src/mandb.c -+++ src/mandb.c 2008-01-30 12:01:40.000000000 +0100 -@@ -484,10 +486,13 @@ static short process_manpath (const char - short amount = 0; - - if (global_manpath) { /* system db */ -- catpath = get_catpath (manpath, SYSTEM_CAT); -- assert (catpath); -+ catpath = get_catpath (manpath, SYSTEM_CATP); -+ if (!catpath) { -+ error (0, 0, _("warning: no system cat path for man path %s"), manpath); -+ return amount; -+ } - } else { /* user db */ -- catpath = get_catpath (manpath, USER_CAT); -+ catpath = get_catpath (manpath, USER_CATP); - if (!catpath) - catpath = xstrdup (manpath); - } ---- src/manp.c -+++ src/manp.c 2008-01-30 12:01:03.000000000 +0100 -@@ -1134,8 +1145,8 @@ char *get_catpath (const char *name, int - struct list *list; - - for (list = namestore; list; list = list->next) -- if (((cattype & SYSTEM_CAT) && list->flag == MANDB_MAP) || -- ((cattype & USER_CAT) && list->flag == MANDB_MAP_USER)) { -+ if (((cattype & SYSTEM_CATP) && list->flag == MANDB_MAP) || -+ ((cattype & USER_CATP) && list->flag == MANDB_MAP_USER)) { - size_t manlen = strlen (list->key); - if (STRNEQ (name, list->key, manlen)) { - const char *suffix = name + manlen; -@@ -1143,16 +1154,30 @@ char *get_catpath (const char *name, int - - if (*suffix == '/') { - ++suffix; -- catpath = appendstr (catpath, "/", -- NULL); -+ catpath = appendstr (catpath, "/", NULL); - } - if (STRNEQ (suffix, "man", 3)) { - suffix += 3; -- catpath = appendstr (catpath, "cat", -- NULL); -+ catpath = appendstr (catpath, "cat", NULL); - } - catpath = appendstr (catpath, suffix, NULL); -- return catpath; -+ if (cattype & FILE_CATP) -+ return catpath; -+ if (is_directory (catpath) == 1) -+ return catpath; -+ if ((cattype & WHATIS_CATP) == 0) { -+ const char locale_delims[] = "_@,."; -+ const char *delim; -+ for (delim = locale_delims; *delim != '\0'; ++delim) { -+ char * tmp = strrchr (catpath, *delim); -+ if (!tmp) -+ continue; -+ *tmp = '\0'; -+ if (is_directory (catpath) == 1) -+ return catpath; -+ } -+ } -+ free (catpath); - } - } - ---- src/whatis.c -+++ src/whatis.c 2008-04-21 13:21:57.000000000 +0200 -@@ -651,7 +651,7 @@ static int search (char *page) - debug ("lower(%s) = \"%s\"\n", page, lowpage); - - for (mp = manpathlist; *mp; mp++) { -- catpath = get_catpath (*mp, SYSTEM_CAT | USER_CAT); -+ catpath = get_catpath (*mp, SYSTEM_CATP|USER_CATP|WHATIS_CATP); - - if (catpath) { - database = mkdbname (catpath); ---- src/straycats.c -+++ src/straycats.c 2008-04-21 15:47:04.000000000 +0200 -@@ -338,7 +343,7 @@ int straycats (const char *manpath) - return 0; - } - -- catpath = get_catpath (manpath, SYSTEM_CAT | USER_CAT); -+ catpath = get_catpath (manpath, SYSTEM_CATP|USER_CATP); - - /* look in the usual catpath location */ - mandir = xstrdup (manpath); diff --git a/man-db-2.5.2-chinese.dif b/man-db-2.5.2-chinese.dif deleted file mode 100644 index 364f7ea..0000000 --- a/man-db-2.5.2-chinese.dif +++ /dev/null @@ -1,62 +0,0 @@ ---- src/encodings.c -+++ src/encodings.c 2008-08-12 15:26:22.959763175 +0200 -@@ -106,6 +106,11 @@ static struct directory_entry directory_ - { "cs", "ISO-8859-2", "ISO-8859-2" }, /* Czech */ - { "hr", "ISO-8859-2", "ISO-8859-2" }, /* Croatian */ - { "hu", "ISO-8859-2", "ISO-8859-2" }, /* Hungarian */ -+ { "zh_TW", "BIG5", "BIG5" }, /* Traditional Chinese */ -+ { "zh_HK", "BIG5HKSCS", "BIG5HKSCS" }, /* Traditional Chinese */ -+ { "zh_CN", "GB18030", "GB18030" }, /* Simplified Chinese */ -+ { "zh_SG", "GB18030", "GB18030" }, /* Simplified Chinese */ -+ { "zh", "GB18030", "GB18030" }, /* Simplified Chinese */ - { "ja", "EUC-JP", "EUC-JP" }, /* Japanese */ - { "ko", "EUC-KR", "EUC-KR" }, /* Korean */ - { "pl", "ISO-8859-2", "ISO-8859-2" }, /* Polish */ -@@ -208,6 +213,7 @@ static struct charset_entry charset_tabl - { "EUC-CN", "nippon" }, - { "EUC-JP", "nippon" }, - { "EUC-TW", "nippon" }, -+ { "GB18030", "nippon" }, - { "GBK", "nippon" }, - #endif /* MULTIBYTE_GROFF */ - -@@ -281,6 +287,7 @@ static struct less_charset_entry less_ch - { "UTF-8", "utf-8", NULL }, - - #ifdef MULTIBYTE_GROFF -+ { "GB18030", "zh", NULL }, - { "EUC-JP", "iso8859", "japanese-ujis" }, - { "KOI8-R", "koi8-r", NULL }, - #endif /* MULTIBYTE_GROFF */ -@@ -405,6 +412,13 @@ char *get_page_encoding (const char *lan - * roff encoding = UTF-8 - * output encoding = UTF-8 - * EUC-JP -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 -+ * -+ * /usr/share/man/zh_CN.GB18030, locale zh_CN.UTF-8 -+ * page encoding = GB18030 -+ * source encoding = GB18030 -+ * roff encoding = UTF-8 -+ * output encoding = UTF-8 -+ * GB18030 -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 - */ - const char *get_source_encoding (const char *lang) - { -@@ -545,7 +559,7 @@ static int compatible_encodings (const c - */ - if ((STREQ (input, "BIG5") || STREQ (input, "BIG5HKSCS") || - STREQ (input, "EUC-JP") || -- STREQ (input, "EUC-CN") || STREQ (input, "GBK") || -+ STREQ (input, "EUC-CN") || STREQ (input, "GB18030") || STREQ (input, "GBK") || - STREQ (input, "EUC-KR") || - STREQ (input, "EUC-TW")) && - STREQ (output, "UTF-8")) -@@ -639,7 +653,7 @@ const char *get_roff_encoding (const cha - STRNEQ (ctype, "zh_HK", 5) || - STRNEQ (ctype, "zh_SG", 5) || - STRNEQ (ctype, "zh_TW", 5)) -- roff_encoding = "UTF-8"; -+ roff_encoding = source_encoding; /* "UTF-8"; */ - } - #endif /* MULTIBYTE_GROFF */ - diff --git a/man-db-2.5.2-fastpipe.dif b/man-db-2.5.2-fastpipe.dif deleted file mode 100644 index 144b112..0000000 --- a/man-db-2.5.2-fastpipe.dif +++ /dev/null @@ -1,23 +0,0 @@ ---- lib/pipeline.c -+++ lib/pipeline.c 2008-11-21 10:53:20.554776039 +0000 -@@ -54,6 +54,20 @@ - # include "zio.h" - #endif /* HAVE_ZIO */ - -+#ifdef __linux__ -+# include -+# include -+# include -+# ifndef SHUT_RD -+# define SHUT_RD 0 -+# endif -+# ifndef SHUT_WR -+# define SHUT_WR 1 -+# endif -+# define pipe(v) (((socketpair(AF_UNIX,SOCK_STREAM,0,v) < 0) || \ -+ (shutdown((v)[1],SHUT_RD) < 0) || (shutdown((v)[0],SHUT_WR) < 0)) ? -1 : 0) -+#endif -+ - /* ---------------------------------------------------------------------- */ - - /* Functions to build individual commands. */ diff --git a/man-db-2.5.2-fhs.dif b/man-db-2.5.2-fhs.dif deleted file mode 100644 index 5da121f..0000000 --- a/man-db-2.5.2-fhs.dif +++ /dev/null @@ -1,108 +0,0 @@ ---- manual/files.me -+++ manual/files.me 2009-01-15 01:02:11.000000000 +0100 -@@ -135,9 +135,11 @@ manpath. - However, if the element is not mentioned in the config file, a man directory - relative to it will be sought. - The subdirectories --.i ../man -+.i ../man , -+.i man , -+.i ../share/man , - or --.i man -+.i share/man - relative to the path component are appended to the internal manpath if they - exist. - Finally, the internal manpath is stripped of duplicate paths before ---- src/manp.c -+++ src/manp.c 2009-01-15 01:02:11.000000000 +0100 -@@ -58,6 +58,7 @@ - #include - - #include "xgetcwd.h" -+#include "xvasprintf.h" - - #include "gettext.h" - #define _(String) gettext (String) -@@ -886,7 +887,8 @@ static char *def_path (int flag) - * directories listed in the man_db.config file. If so, and it is - * not already in the manpath, add it. If the directory is not listed - * in the man_db.config file, see if there is a subdirectory `../man' or -- * `man'. If so, and it is not already in the manpath, add it. -+ * `man', or, for FHS-compliance, `../share/man' or `share/man'. If so, -+ * and it is not already in the manpath, add it. - * Example: user has $HOME/bin in his path and the directory - * $HOME/man exists -- the directory $HOME/man will be added - * to the manpath. -@@ -941,13 +943,15 @@ static inline char *get_manpath_from_pat - - t = has_mandir (p); - if (t) { -- debug ("but does have a ../man or man " -+ debug ("but does have a ../man, man, " -+ "../share/man, or share/man " - "subdirectory\n"); - - add_dir_to_list (tmplist, t); - free (t); - } else -- debug ("and doesn't have ../man or man " -+ debug ("and doesn't have ../man, man, " -+ "../share/man, or share/man " - "subdirectories\n"); - } - } -@@ -1022,34 +1026,41 @@ static void add_dir_to_list (char **lp, - } - } - --/* path does not exist in config file: check to see if path/../man or -- path/man exist. If so return it, if not return NULL. */ -+/* path does not exist in config file: check to see if path/../man, -+ path/man, path/../share/man, or path/share/man exist. If so return -+ it, if not return NULL. */ - static inline char *has_mandir (const char *path) - { -- char *newpath = NULL; -+ char *newpath; - - /* don't assume anything about path, especially that it ends in - "bin" or even has a '/' in it! */ - - char *subdir = strrchr (path, '/'); - if (subdir) { -- const int prefix_len = subdir + 1 - path; -- newpath = xmalloc (prefix_len + sizeof ("man") + 1); -- strncpy (newpath, path, prefix_len); -- strcpy (newpath + prefix_len, "man"); -- -+ newpath = xasprintf ("%.*s/man", subdir - path, path); - if (is_directory (newpath) == 1) - return newpath; -- else -- *newpath = '\0'; -+ free (newpath); - } - -- newpath = appendstr (newpath, path, "/man", NULL); -- -+ newpath = appendstr (NULL, path, "/man", NULL); - if (is_directory (newpath) == 1) - return newpath; -+ free (newpath); -+ -+ if (subdir) { -+ newpath = xasprintf ("%.*s/share/man", subdir - path, path); -+ if (is_directory (newpath) == 1) -+ return newpath; -+ free (newpath); -+ } - -+ newpath = appendstr (NULL, path, "/share/man", NULL); -+ if (is_directory (newpath) == 1) -+ return newpath; - free (newpath); -+ - return NULL; - } - diff --git a/man-db-2.5.2.tar.bz2 b/man-db-2.5.2.tar.bz2 deleted file mode 100644 index 6617d32..0000000 --- a/man-db-2.5.2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3da6a5983a3dd1233b45d66cfcc44e787f8cd6cfc77d5b97cb154414ea70a4ca -size 1315763 diff --git a/man-db-2.6.3-chinese.dif b/man-db-2.6.3-chinese.dif new file mode 100644 index 0000000..95b99db --- /dev/null +++ b/man-db-2.6.3-chinese.dif @@ -0,0 +1,50 @@ +--- lib/encodings.c ++++ lib/encodings.c 2012-10-01 14:42:07.895867558 +0000 +@@ -224,6 +224,7 @@ static struct charset_entry charset_tabl + { "EUC-CN", "nippon" }, + { "EUC-JP", "nippon" }, + { "EUC-TW", "nippon" }, ++ { "GB18030", "nippon" }, + { "GBK", "nippon" }, + # else /* !MULTIBYTE_GROFF */ + /* If we have a smarter version of groff, this is better dealt with +@@ -311,6 +312,7 @@ static struct less_charset_entry less_ch + + #ifdef MULTIBYTE_GROFF + { "CP1251", "windows", NULL }, ++ { "GB18030", "zh", NULL }, + { "EUC-JP", "iso8859", "japanese-ujis" }, + { "KOI8-R", "koi8-r", NULL }, + /* close enough? */ +@@ -502,6 +504,13 @@ char *get_page_encoding (const char *lan + * roff encoding = ISO-8859-15 + * output encoding = ISO-8859-15 + * ISO-8859-15 -> groff -Tascii8 -> ISO-8859-15 -> iconv -> UTF-8 ++ * ++ * /usr/share/man/zh_CN.GB18030, locale zh_CN.UTF-8 ++ * page encoding = GB18030 ++ * source encoding = GB18030 ++ * roff encoding = UTF-8 ++ * output encoding = UTF-8 ++ * GB18030 -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 + */ + const char *get_source_encoding (const char *lang) + { +@@ -654,7 +663,7 @@ static int compatible_encodings (const c + */ + if ((STREQ (input, "BIG5") || STREQ (input, "BIG5HKSCS") || + STREQ (input, "EUC-JP") || +- STREQ (input, "EUC-CN") || STREQ (input, "GBK") || ++ STREQ (input, "EUC-CN") || STREQ (input, "GB18030") || STREQ (input, "GBK") || + STREQ (input, "EUC-KR") || + STREQ (input, "EUC-TW")) && + STREQ (output, "UTF-8")) +@@ -758,7 +767,7 @@ const char *get_roff_encoding (const cha + STRNEQ (ctype, "zh_HK", 5) || + STRNEQ (ctype, "zh_SG", 5) || + STRNEQ (ctype, "zh_TW", 5)) +- roff_encoding = "UTF-8"; ++ roff_encoding = source_encoding; /* "UTF-8"; */ + } + #endif /* MULTIBYTE_GROFF */ + diff --git a/man-db-2.4.3-firefox.dif b/man-db-2.6.3-firefox.dif similarity index 81% rename from man-db-2.4.3-firefox.dif rename to man-db-2.6.3-firefox.dif index 677b0b4..153729c 100644 --- a/man-db-2.4.3-firefox.dif +++ b/man-db-2.6.3-firefox.dif @@ -1,6 +1,6 @@ --- src/man.c -+++ src/man.c 2007-07-18 12:45:24.091833039 +0000 -@@ -2031,21 +2031,23 @@ static void format_display (pipeline *de ++++ src/man.c 2012-10-01 14:34:29.003506558 +0000 +@@ -2312,21 +2312,23 @@ static void format_display (pipeline *de if (!status) break; } @@ -16,7 +16,7 @@ } + if (!status) + sleep(5); /* firefox runs into background to fast */ - if (remove_directory (htmldir) == -1) + if (remove_directory (htmldir, 0) == -1) error (0, errno, _("can't remove directory %s"), htmldir); free (htmlfile); diff --git a/man-db-2.5.1-listall.dif b/man-db-2.6.3-listall.dif similarity index 96% rename from man-db-2.5.1-listall.dif rename to man-db-2.6.3-listall.dif index bbec3d3..692ef60 100644 --- a/man-db-2.5.1-listall.dif +++ b/man-db-2.6.3-listall.dif @@ -1,6 +1,6 @@ --- src/man.c -+++ src/man.c 2008-11-28 13:12:22.171541000 +0100 -@@ -3223,12 +3223,132 @@ static int locate_page (const char *manp ++++ src/man.c 2008-11-28 12:12:22.000000000 +0000 +@@ -3712,12 +3712,132 @@ static int locate_page (const char *manp return found; } @@ -133,7 +133,7 @@ global_manpath = is_global_mandir (candp->path); if (!global_manpath) drop_effective_privs (); -@@ -3250,9 +3370,51 @@ static int display_pages (struct candida +@@ -3739,9 +3859,51 @@ static int display_pages (struct candida regain_effective_privs (); if (found && !findall) diff --git a/man-db-2.6.3-man0.dif b/man-db-2.6.3-man0.dif new file mode 100644 index 0000000..972cdae --- /dev/null +++ b/man-db-2.6.3-man0.dif @@ -0,0 +1,50 @@ +--- man/de/man1/man.man1 ++++ man/de/man1/man.man1 2008-04-21 13:41:49.000000000 +0200 +@@ -97,6 +97,7 @@ der Manualseiten gefolgt vom Typ der dor + .TS + tab (@); + l l. ++0@Dateiheader (gewöhnlich in \fI/usr/include\fR) + 1@Ausführbare Programme oder Shellbefehle + 2@Systemaufrufe (Kernelfunktionen) + 3@Bibliotheksaufrufe (Funktionen in System-Bibliotheken) +--- man/es/man1/man.man1 ++++ man/es/man1/man.man1 2008-04-21 13:41:57.000000000 +0200 +@@ -101,6 +101,7 @@ del manual y los tipos de páginas que c + .TS + tab (@); + l l. ++0@Ficheros (se encuentran generalmente en \fI/usr/include\fR) + 1@Programas ejecutables y guiones del intérprete de + @órdenes + 2@Llamadas del sistema (funciones servidas por el núcleo) +--- man/it/man1/man.man1 ++++ man/it/man1/man.man1 2008-04-21 13:42:02.000000000 +0200 +@@ -124,6 +124,7 @@ del manuale seguiti dai tipi di pagine c + .TS + tab (@); + l l. ++0@File (di solito trovabili in \fI/usr/include\fR) + 1@Programmi eseguibili e comandi della shell + 2@Chiamate al sistema (funzioni fornite dal kernel) + 3@Chiamate alle librerie (funzioni all'interno delle +--- man/ja/man1/man.man1 ++++ man/ja/man1/man.man1 2008-04-21 13:42:05.000000000 +0200 +@@ -104,6 +104,7 @@ + .TS + tab (@); + l l. ++0@ + 1@実行プログラムまたはシェルのコマンド + 2@システムコール (カーネルが提供する関数) + 3@ライブラリコール (システムライブラリに含まれる関数) +--- man/man1/man.man1 ++++ man/man1/man.man1 2007-12-10 12:53:31.000000000 +0100 +@@ -119,6 +119,7 @@ numbers of the manual followed by the ty + .TS + tab (@); + l l. ++0@Header files (usually found in \fI/usr/include\fR) + 1@Executable programs or shell commands + 2@System calls (functions provided by the kernel) + 3@Library calls (functions within program libraries) diff --git a/man-db-2.4.3-section.dif b/man-db-2.6.3-section.dif similarity index 61% rename from man-db-2.4.3-section.dif rename to man-db-2.6.3-section.dif index 0e47369..0d06c66 100644 --- a/man-db-2.4.3-section.dif +++ b/man-db-2.6.3-section.dif @@ -1,6 +1,6 @@ --- src/man.c -+++ src/man.c 2006-06-13 14:01:19.000000000 +0000 -@@ -1142,7 +1142,7 @@ static inline const char *is_section (co ++++ src/man.c 2012-10-01 14:24:23.251006952 +0000 +@@ -1368,7 +1368,7 @@ static inline const char *is_section (co { const char **vs; @@ -9,17 +9,16 @@ if (STREQ (*vs, name)) return name; /* allow e.g. 3perl but disallow 8139too and libfoo */ -@@ -2565,7 +2565,8 @@ static int compare_candidates (const str +@@ -2943,7 +2943,7 @@ static int compare_candidates (const str + /* Find out whether lsource->ext is ahead of rsource->ext in * section_list. */ - const char **sp; - for (sp = section_list; *sp; ++sp) { -+ + for (sp = section_list; sp && *sp; ++sp) { if (!*(*sp + 1)) { /* No extension */ - if (!sec_left && **sp == *(left->ext)) -@@ -3209,7 +3210,7 @@ static int man (const char *name, int *f + if (!sec_left && **sp == *(lsource->ext)) +@@ -3918,7 +3918,7 @@ static int man (const char *name, int *f } else { const char **sp; diff --git a/man-db-2.6.3-security4.dif b/man-db-2.6.3-security4.dif new file mode 100644 index 0000000..bab6216 --- /dev/null +++ b/man-db-2.6.3-security4.dif @@ -0,0 +1,48 @@ +--- src/mandb.c ++++ src/mandb.c 2012-10-01 14:30:11.619507260 +0000 +@@ -37,6 +37,7 @@ + #include + #include + #include /* for chmod() */ ++#include /* for open () */ + #include + #include + #include +@@ -420,11 +421,20 @@ static int mandb (const char *catpath, c + char *dbname; + char *cachedir_tag; + struct stat st; ++ int fd; + + dbname = mkdbname (catpath); + sprintf (pid, "%d", getpid ()); + database = appendstr (NULL, catpath, "/", pid, NULL); +- ++ ++ /* Just for the case that catpath isn't a system catpath */ ++ drop_effective_privs (); ++ fd = open (database, O_WRONLY | O_CREAT | O_EXCL, 0644); ++ regain_effective_privs (); ++ if (fd < 0) ++ error (FATAL, errno, _("can't create a temporary filename")); ++ close(fd); ++ + if (!quiet) + printf (_("Processing manual pages under %s...\n"), manpath); + +@@ -432,6 +442,7 @@ static int mandb (const char *catpath, c + if (stat (cachedir_tag, &st) == -1 && errno == ENOENT) { + FILE *cachedir_tag_file; + ++ drop_effective_privs (); + cachedir_tag_file = fopen (cachedir_tag, "w"); + if (cachedir_tag_file) { + fputs ("Signature: 8a477f597d28d172789f06886806bc55\n" +@@ -443,6 +454,7 @@ static int mandb (const char *catpath, c + cachedir_tag_file); + fclose (cachedir_tag_file); + } ++ regain_effective_privs (); + } + free (cachedir_tag); + diff --git a/man-db-2.6.3-zio.dif b/man-db-2.6.3-zio.dif new file mode 100644 index 0000000..f2e9058 --- /dev/null +++ b/man-db-2.6.3-zio.dif @@ -0,0 +1,170 @@ +--- config.h.in ++++ config.h.in 2012-10-02 09:06:48.591006953 +0000 +@@ -674,6 +674,9 @@ + /* Define to 1 if you have the `z' library (-lz). */ + #undef HAVE_LIBZ + ++/* Define to 1 if you have libzio for opening compressed manuals */ ++#undef HAVE_ZIO ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_LINEWRAP_H + +--- configure.ac ++++ configure.ac 2012-10-02 09:55:06.783914808 +0000 +@@ -98,6 +98,18 @@ AC_ARG_WITH([sections], + sections="$withval" + fi], + [: ${sections=1 n l 8 3 2 5 4 9 6 7}]) ++AC_ARG_WITH([zio], ++[AS_HELP_STRING([--with-zio=LIBRARY], [use zlib/libbz2 wrapper library LIBRARY (libzio)])], ++ [if test -z "$withval" -o "$withval" = "yes" ++ then ++ zio=libzio ++ elif test "$withval" = "no" ++ then ++ AC_MSG_ERROR(--with-zio requires an argument) ++ else ++ zio=$withval ++ fi], ++ [: ${zio=no}]) + AC_ARG_ENABLE([automatic-create], + [AS_HELP_STRING([--enable-automatic-create], [allow man to create user databases on the fly])], + [if test "$enableval" = "yes" +@@ -375,6 +387,40 @@ AC_SUBST([unlzma]) + AC_SUBST([unxz]) + AC_SUBST([unlzip]) + MAN_COMPRESS_LIB([z], [gzopen]) ++dnl Check for zlib and libbz2 libraries to use this together ++dnl with SuSE's libzio to open compressed info files. ++dnl ++if test "$zio" = "no" || test -n "$zio" ++then ++ AC_CHECK_HEADER(zio.h,[ ++ for lib in ${zio#lib} zio ++ do ++ AC_CHECK_LIB($lib, fzopen, [LIBS="-l$lib $LIBS"; am_cv_libzio=yes]) ++ done ++ ]) ++ if test "$am_cv_libzio" = yes; then ++ AC_DEFINE([COMP_SRC],[],[Define if you have compressors and want to support compressed cat files.]) ++ AC_DEFINE([HAVE_ZIO],[],[Define to 1 if you have libzio for opening compressed manuals]) ++ AC_CHECK_HEADER(zlib.h,[ ++ for lib in z gz ++ do ++ AC_CHECK_LIB($lib, gzopen, [LIBS="$LIBS -Wl,--no-as-needed -l$lib"; break]) ++ done ++ ]) ++ AC_CHECK_HEADER(bzlib.h,[ ++ for lib in bz2 bzip2 ++ do ++ AC_CHECK_LIB($lib, BZ2_bzopen, [LIBS="$LIBS -Wl,--no-as-needed -l$lib"; break]) ++ done ++ ]) ++ AC_CHECK_HEADER(lzma.h, [ ++ for lib in lzma lzmadec ++ do ++ AC_CHECK_LIB($lib, lzmadec_open, [LIBS="$LIBS -Wl,--no-as-needed -l$lib"; break]) ++ done ++ ]) ++ fi ++fi + dnl To add more decompressors just follow the scheme above. + + # Work out which manual page hierarchy scheme might be in use. +--- lib/decompress.c ++++ lib/decompress.c 2012-10-02 09:05:43.787007258 +0000 +@@ -36,6 +36,10 @@ + # include "zlib.h" + #endif /* HAVE_LIBZ */ + ++#ifdef HAVE_ZIO ++# include "zio.h" ++#endif /* HAVE_ZIO */ ++ + #include "manconfig.h" + #include "comp_src.h" + #include "pipeline.h" +@@ -66,6 +70,32 @@ static void decompress_zlib (void *data + + #endif /* HAVE_LIBZ */ + ++#ifdef HAVE_ZIO ++ ++static void decompress_zio (void *data) ++{ ++ const char *what = (const char*)data; ++ FILE *file; ++ ++ file = fdzopen(dup (fileno (stdin)), "r", what); ++ if (!file) ++ return; ++ ++ for (;;) { ++ char buffer[4096]; ++ int r = fread(buffer, sizeof(char), sizeof(buffer), file); ++ if (r <= 0) ++ break; ++ if (fwrite (buffer, 1, (size_t) r, stdout) < (size_t) r) ++ break; ++ } ++ ++ fclose(file); ++ return; ++} ++ ++#endif /* HAVE_ZIO */ ++ + pipeline *decompress_open (const char *filename) + { + pipecmd *cmd; +@@ -80,6 +110,37 @@ pipeline *decompress_open (const char *f + if (stat (filename, &st) < 0 || S_ISDIR (st.st_mode)) + return NULL; + ++#ifdef HAVE_ZIO ++ ext = strrchr (filename, '.'); ++ if (ext) { ++ char opt[2] = {'\0', '\0'}; ++ char *name; ++ ++ if (STREQ (ext, ".gz")) ++ *opt = 'g'; ++ else if (STREQ (ext, ".z")) ++ *opt = 'z'; ++ else if (STREQ (ext, ".bz2")) ++ *opt = 'b'; ++ else if (STREQ (ext, ".xz")) ++ *opt = 'x'; ++ else if (STREQ (ext, ".lzma")) ++ *opt = 'l'; ++ else if (STREQ (ext, ".Z")) ++ *opt = 'Z'; ++ else ++ goto nozio; ++ ++ /* informational only; no shell quoting concerns */ ++ name = appendstr (NULL, "libzio < ", filename, NULL); ++ cmd = pipecmd_new_function (name, &decompress_zio, NULL, ++ opt); ++ free (name); ++ p = pipeline_new_commands (cmd, NULL); ++ goto got_pipeline; ++ } ++#endif /* HAVE_ZIO */ ++ + #ifdef HAVE_LIBZ + filename_len = strlen (filename); + if (filename_len > 3 && STREQ (filename + filename_len - 3, ".gz")) { +@@ -93,7 +154,11 @@ pipeline *decompress_open (const char *f + } + #endif /* HAVE_LIBZ */ + ++#ifdef HAVE_ZIO ++nozio: ++#else + ext = strrchr (filename, '.'); ++#endif /* HAVE_LIBZ */ + if (ext) { + ++ext; + diff --git a/man-db-2.5.2.dif b/man-db-2.6.3.dif similarity index 53% rename from man-db-2.5.2.dif rename to man-db-2.6.3.dif index 736dc5f..23f4819 100644 --- a/man-db-2.5.2.dif +++ b/man-db-2.6.3.dif @@ -1,82 +1,6 @@ ---- .pkgextract -+++ .pkgextract 2008-04-21 13:24:22.000000000 +0200 -@@ -0,0 +1,10 @@ -+bzcat ../man-db_2.5.2-2.diff.bz2 | patch -p1 -s --suffix=.debian -+patch -p0 -s --suffix=.groff < ../man-db-2.3.19deb4.0-groff.dif -+patch -p0 -s --suffix=.sect < ../man-db-2.4.3-section.dif -+patch -p0 -s --suffix=.secu4 < ../man-db-2.5.1-security4.dif -+patch -p0 -s --suffix=.firefox< ../man-db-2.4.3-firefox.dif -+patch -p0 -s --suffix=.chinese< ../man-db-2.5.2-chinese.dif -+patch -p0 -s --suffix=.glob < ../man-db-2.5.1-globbing.dif -+patch -p0 -s --suffix=.zio < ../man-db-2.5.1-zio.dif -+patch -p0 -s --suffix=.listall< ../man-db-2.5.1-listall.dif -+patch -p0 -s --suffix=.catp < ../man-db-2.5.2-catp.dif --- configure.ac -+++ configure.ac 2008-08-12 15:32:24.000000000 +0200 -@@ -14,13 +14,26 @@ fi - - AC_CONFIG_HEADER(config.h) - AC_CANONICAL_HOST -- -+dnl -+dnl Check $PATH for the following progs and append suitable options. -+dnl -+AC_PROG_CC -+AC_PROG_CPP -+AC_GNU_SOURCE -+dnl -+dnl check for system defaults -+dnl -+AC_AIX -+AC_MINIX -+AC_ISC_POSIX -+dnl - # Define below date and version information to be put into man pages etc. - datemark=20080505 - date=`LANG=C date -d $datemark +'%Y-%m-%d'` - AC_SUBST(date)dnl - roff_version=`echo AC_PACKAGE_VERSION | sed 's/-/\\-/g'` - AC_SUBST(roff_version)dnl -+m4_pattern_allow([AC_DEFINE_UNQUOTED]) - - # We have to be a bit naughty here and supply options. - # The autoconf literature states that only features that can be separately -@@ -41,12 +54,12 @@ AS_HELP_STRING([--disable-setuid], [don' - man_owner=$enableval - man_mode="4755" - AC_MSG_NOTICE([Man will be installed setuid $enableval]) -- AC_DEFINE_UNQUOTED(SECURE_MAN_UID, "$man_owner", -+ AC_DEFINE_UNQUOTED([SECURE_MAN_UID], "$man_owner", - [Define as the setuid owner of man or undefine if not installing setuid.]) - fi], - [man_owner=man - man_mode="4755" -- AC_DEFINE_UNQUOTED(SECURE_MAN_UID, "$man_owner")]) -+ AC_DEFINE_UNQUOTED([SECURE_MAN_UID], "$man_owner")]) - AC_ARG_ENABLE(undoc, - [AS_HELP_STRING([--enable-undoc=COMMAND], [suggest COMMAND for missing manual pages])], - [if test "$enableval" = "yes" || test "$enableval" = "no" -@@ -54,7 +67,7 @@ AC_ARG_ENABLE(undoc, - AC_MSG_ERROR(--enable-undoc requires an argument) - else - AC_MSG_NOTICE([Suggesting '$enableval' for missing manual pages]) -- AC_DEFINE_UNQUOTED(UNDOC_COMMAND, "$enableval", -+ AC_DEFINE_UNQUOTED([UNDOC_COMMAND], "$enableval", - [Define as the name of a command you want to suggest when a non-existent page is requested.]) - fi]) - AC_ARG_WITH(device, -@@ -115,10 +128,7 @@ AC_SUBST(config_file_dirname)dnl - AC_SUBST(sections)dnl - - # Check $PATH for the following programs and append suitable options. --AC_GNU_SOURCE --AC_PROG_CC - gl_EARLY --AC_PROG_CPP - CFLAGS="$CFLAGS -Wall" - if test "$GCC" = yes - then -@@ -255,6 +265,14 @@ then ++++ configure.ac 2008-08-12 13:32:24.000000000 +0000 +@@ -316,6 +316,14 @@ then fi MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn]) @@ -91,7 +15,7 @@ MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn]) # If we fail to find an neqn, use eqn and try to force it to output for an # ascii device. As this is only relevant for equations (?), not using latin1 -@@ -280,9 +298,15 @@ then +@@ -341,9 +349,15 @@ then compress_ext="gz" fi MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress]) @@ -109,43 +33,8 @@ if test -z "$gzip" then compressor="$compress -c" -@@ -334,7 +358,7 @@ dnl To add more decompressors just follo - AC_ARG_ENABLE(mandirs, - [AS_HELP_STRING([--enable-mandirs=OS], [select manual page hierarchy organization (GNU, HPUX, IRIX, Solaris, BSD)])], - [AC_MSG_NOTICE([Using $enableval hierarchy organization(s)]) -- AC_DEFINE_UNQUOTED(MANDIR_LAYOUT, "$enableval", -+ AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], "$enableval", - [Define to the manual page hierarchy organization(s) in use.])], - [case $host in - *-gnu) mandirs=GNU;; -@@ -346,7 +370,7 @@ AC_ARG_ENABLE(mandirs, - esac - if test -n "$mandirs"; then - AC_MSG_NOTICE([Using $mandirs hierarchy organization]) -- AC_DEFINE_UNQUOTED(MANDIR_LAYOUT, "$mandirs") -+ AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], "$mandirs") - else - AC_MSG_NOTICE([Allowing any hierarchy organization]) - AC_DEFINE(MANDIR_LAYOUT, "") -@@ -362,8 +386,7 @@ AC_HEADER_DIRENT - AC_CHECK_HEADERS(fcntl.h sys/file.h) - - # Internationalization support. --AM_GNU_GETTEXT --AM_GNU_GETTEXT_VERSION([0.17]) -+AM_GNU_GETTEXT([external]) - AC_SUBST(LINGUAS) - AM_ICONV - AM_CONDITIONAL([NLS], [test "$USE_NLS" = yes]) -@@ -491,6 +514,5 @@ AC_CONFIG_FILES(Makefile - tools/Makefile - include/comp_src.h - include/manconfig.h -- intl/Makefile - po/Makefile.in) - AC_OUTPUT --- mk_catdirs -+++ mk_catdirs 2009-08-03 13:22:19.201901113 +0200 ++++ mk_catdirs 2009-08-03 11:22:19.000000000 +0000 @@ -0,0 +1,30 @@ +#!/bin/sh + @@ -178,7 +67,7 @@ + +test "$(id -u)" -ne 0 || chown man:man -R ${CACHE} --- include/comp_src.h.in -+++ include/comp_src.h.in 2007-12-10 12:51:50.000000000 +0100 ++++ include/comp_src.h.in 2007-12-10 11:51:50.000000000 +0000 @@ -53,7 +53,7 @@ struct compression comp_list[] = { #endif /* HAVE_GZIP */ @@ -186,93 +75,96 @@ -#ifdef HAVE_COMPRESS +#if defined(HAVE_COMPRESS) || defined(HAVE_GZIP) {UNCOMPRESS, "Z", NULL}, - #endif /* HAVE_COMPRESS */ + /* Else if we have gzip, incorporate the following */ + #elif defined (HAVE_GZIP) +--- lib/security.c ++++ lib/security.c 2012-10-02 14:06:34.011008327 +0000 +@@ -60,7 +60,10 @@ ---- include/manconfig.h.in -+++ include/manconfig.h.in 2008-08-12 16:59:18.600458442 +0200 -@@ -73,7 +73,7 @@ + uid_t ruid; /* initial real user id */ + uid_t euid; /* initial effective user id */ ++gid_t rgid; /* initial real group id */ ++gid_t egid; /* initial effective group id */ + uid_t uid; /* current euid */ ++gid_t gid; /* current egid */ - #undef MAN_DB_CREATES - #define MAN_DB_UPDATES --#define MAN_CATS -+#undef MAN_CATS + static struct passwd *man_owner; - /* By default, man-db will store a whatis referenced manual page in favour - of a stray cat page when they both share identical namespace. If you ---- intl/Makefile.in -+++ intl/Makefile.in 2007-12-10 12:51:51.000000000 +0100 -@@ -181,7 +181,7 @@ libgnuintl.h.msvc-shared Makefile.msvc +@@ -74,10 +77,17 @@ static inline void gripe_set_euid (void) + error (FATAL, errno, _("can't set effective uid")); + } - all: all-@USE_INCLUDED_LIBINTL@ - all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed --all-no: all-no-@BUILD_INCLUDED_LIBINTL@ -+all-no: all-no-@USE_INCLUDED_LIBINTL@ - all-no-yes: libgnuintl.$la - all-no-no: ++static inline void gripe_set_egid (void) ++{ ++ error (FATAL, errno, _("can't set effective gid")); ++} ++ + void init_security (void) + { + ruid = getuid (); ++ rgid = getgid (); + uid = euid = geteuid (); ++ gid = egid = getegid (); + debug ("ruid=%d, euid=%d\n", (int) ruid, (int) euid); + priv_drop_count = 0; + drop_effective_privs (); +@@ -147,6 +157,32 @@ void regain_effective_privs (void) ---- libdb/db_storage.h -+++ libdb/db_storage.h 2008-04-21 15:18:56.000000000 +0200 -@@ -70,10 +70,10 @@ struct mandata { - }; + uid = euid; + } ++ ++ if (gid != rgid) { ++# if defined(HAVE_SETRESGID) ++ if (setresgid (rgid, egid, -1) < 0) ++# elif defined(HAVE_SETREGID) ++ if (setregid (rgid, egid) < 0) ++# elif defined(HAVE_SETEGID) ++ if (setegid (rgid) < 0) ++# endif ++ gripe_set_egid(); ++ ++ gid = rgid; ++ } ++ ++ if (gid != egid) { ++# if defined(HAVE_SETRESGID) ++ if (setresgid (egid, rgid, -1)) ++# elif defined(HAVE_SETREGID) ++ if (setregid (egid, rgid) < 0) ++# elif defined(HAVE_SETEGID) ++ if (setegid (egid)) ++# endif ++ gripe_set_egid(); ++ ++ gid = egid; ++ } + #endif /* SECURE_MAN_UID */ + } - /* used by the world */ --extern inline struct mandata *dblookup_all (const char *page, -+extern struct mandata *dblookup_all (const char *page, - const char *section, - int match_case); --extern inline struct mandata *dblookup_exact (const char *page, -+extern struct mandata *dblookup_exact (const char *page, - const char *section, - int match_case); - extern int dbstore (struct mandata *in, const char *base); -@@ -85,10 +85,10 @@ extern void split_content (char *cont_pt - extern int compare_ids (char a, char b); +--- lib/util.c ++++ lib/util.c 2007-12-10 12:24:30.000000000 +0000 +@@ -46,6 +46,9 @@ - /* local to db routines */ --extern inline void gripe_lock (char *filename); --extern inline void gripe_corrupt_data (void); -+extern void gripe_lock (char *filename); -+extern void gripe_corrupt_data (void); - extern datum make_multi_key (const char *page, const char *ext); --extern inline struct mandata *infoalloc (void); -+extern struct mandata *infoalloc (void); - extern char *name_to_key (const char *name); - extern char **split_data (char *content, char *start[]); - extern datum make_content (struct mandata *in); + #include "gettext.h" + ++#include ++#define _(String) gettext (String) ++ + #include "manconfig.h" + + #include "error.h" --- libdb/mydbm.h -+++ libdb/mydbm.h 2008-04-21 15:20:08.000000000 +0200 ++++ libdb/mydbm.h 2012-10-02 10:58:42.259008074 +0000 @@ -42,7 +42,7 @@ # include # ifndef HAVE_GDBM_EXISTS --extern inline int gdbm_exists(GDBM_FILE dbf, datum key); -+extern int gdbm_exists(GDBM_FILE dbf, datum key); +-extern inline int gdbm_exists(GDBM_FILE db, datum key); ++extern int gdbm_exists(GDBM_FILE db, datum key); # endif /* !HAVE_GDBM_EXISTS */ /* gdbm_nextkey() is not lexicographically sorted, so we need to keep the -@@ -133,14 +133,14 @@ extern int ndbm_flclose(DBM *dbf); - typedef DBT datum; - - extern DB *btree_flopen(char *filename, int flags, int mode); --extern inline int btree_close(DB *db); --extern inline int btree_exists(DB *db, datum key); --extern inline datum btree_fetch(DB *db, datum key); -+extern int btree_close(DB *db); -+extern int btree_exists(DB *db, datum key); -+extern datum btree_fetch(DB *db, datum key); - extern int btree_insert(DB *db, datum key, datum cont); --extern inline datum btree_firstkey(DB *db); --extern inline datum btree_nextkey(DB *db); --extern inline int btree_replace(DB *db, datum key, datum content); --extern inline int btree_nextkeydata(DB *db, datum *key, datum *cont); -+extern datum btree_firstkey(DB *db); -+extern datum btree_nextkey(DB *db); -+extern int btree_replace(DB *db, datum key, datum content); -+extern int btree_nextkeydata(DB *db, datum *key, datum *cont); - - # define DB_EXT ".bt" - # define MYDBM_FILE DB* -@@ -148,7 +148,7 @@ extern inline int btree_nextkeydata(DB * +@@ -144,7 +144,7 @@ extern int btree_nextkeydata(DB *db, dat # define MYDBM_SET_DPTR(d, value) ((d).data = (char *) (value)) # define MYDBM_DSIZE(d) ((d).size) # define MYDBM_CTRWOPEN(file) btree_flopen(file, O_TRUNC|O_CREAT|O_RDWR, DBMODE) @@ -281,59 +173,9 @@ # define MYDBM_RWOPEN(file) btree_flopen(file, O_RDWR, DBMODE) # define MYDBM_RDOPEN(file) btree_flopen(file, O_RDONLY, DBMODE) # define MYDBM_INSERT(db, key, cont) btree_insert(db, key, cont) ---- man/de/man1/man.man1 -+++ man/de/man1/man.man1 2008-04-21 13:41:49.000000000 +0200 -@@ -97,6 +97,7 @@ der Manualseiten gefolgt vom Typ der dor - .TS - tab (@); - l l. -+0@Dateiheader (gewöhnlich in \fI/usr/include\fR) - 1@Ausführbare Programme oder Shellbefehle - 2@Systemaufrufe (Kernelfunktionen) - 3@Bibliotheksaufrufe (Funktionen in System-Bibliotheken) ---- man/es/man1/man.man1 -+++ man/es/man1/man.man1 2008-04-21 13:41:57.000000000 +0200 -@@ -101,6 +101,7 @@ del manual y los tipos de páginas que c - .TS - tab (@); - l l. -+0@Ficheros (se encuentran generalmente en \fI/usr/include\fR) - 1@Programas ejecutables y guiones del intérprete de - @órdenes - 2@Llamadas del sistema (funciones servidas por el núcleo) ---- man/it/man1/man.man1 -+++ man/it/man1/man.man1 2008-04-21 13:42:02.000000000 +0200 -@@ -124,6 +124,7 @@ del manuale seguiti dai tipi di pagine c - .TS - tab (@); - l l. -+0@File (di solito trovabili in \fI/usr/include\fR) - 1@Programmi eseguibili e comandi della shell - 2@Chiamate al sistema (funzioni fornite dal kernel) - 3@Chiamate alle librerie (funzioni all'interno delle ---- man/ja/man1/man.man1 -+++ man/ja/man1/man.man1 2008-04-21 13:42:05.000000000 +0200 -@@ -104,6 +104,7 @@ - .TS - tab (@); - l l. -+0@ - 1@実行プログラムまたはシェルのコマンド - 2@システムコール (カーネルが提供する関数) - 3@ライブラリコール (システムライブラリに含まれる関数) ---- man/man1/man.man1 -+++ man/man1/man.man1 2007-12-10 12:53:31.000000000 +0100 -@@ -119,6 +119,7 @@ numbers of the manual followed by the ty - .TS - tab (@); - l l. -+0@Header files (usually found in \fI/usr/include\fR) - 1@Executable programs or shell commands - 2@System calls (functions provided by the kernel) - 3@Library calls (functions within program libraries) --- src/Makefile.am -+++ src/Makefile.am 2008-04-21 16:44:47.000000000 +0200 -@@ -170,15 +170,11 @@ apropos$(EXEEXT): whatis$(EXEEXT) ++++ src/Makefile.am 2012-10-02 15:19:49.371507288 +0000 +@@ -167,15 +167,9 @@ apropos$(EXEEXT): whatis$(EXEEXT) all-am: apropos$(EXEEXT) install-exec-hook: @@ -348,27 +190,88 @@ - $(LN_S) $(TRANS_WHATIS)$(EXEEXT) $(TRANS_APROPOS)$(EXEEXT) + $(INSTALL_PROGRAM) $(TRANS_MAN) $(DESTDIR)$(pkglibexecdir)/$(TRANS_MAN) + $(INSTALL_PROGRAM) $(TRANS_MANDB) $(DESTDIR)$(pkglibexecdir)/$(TRANS_MANDB) -+ $(INSTALL_PROGRAM) wrapper $(DESTDIR)$(bindir)/$(TRANS_MANDB) -+ ln -f $(DESTDIR)$(bindir)/$(TRANS_MANDB) $(DESTDIR)$(bindir)/$(TRANS_MAN) + $(LN_S) $(TRANS_WHATIS) $(DESTDIR)$(bindir)/$(TRANS_APROPOS) install-data-hook: @if test -f $(DESTDIR)$(config_file); then \ --- src/check_mandirs.c -+++ src/check_mandirs.c 2007-12-10 13:15:49.000000000 +0100 -@@ -379,10 +379,10 @@ static short testmandirs (const char *pa ++++ src/check_mandirs.c 2012-10-02 15:24:45.411047275 +0000 +@@ -354,10 +354,13 @@ static inline void add_dir_entries (cons + + #ifdef SECURE_MAN_UID + extern uid_t ruid; /* initial real user id */ ++extern uid_t euid; /* initial effective user id */ ++extern gid_t rgid; /* initial real group id */ ++extern gid_t egid; /* initial effective group id */ + #endif /* SECURE_MAN_UID */ + + /* create the catman hierarchy if it doesn't exist */ +-static void mkcatdirs (const char *mandir, const char *catdir) ++void mkcatdirs (const char *mandir, const char *catdir) + { + char *manname, *catname; + #ifdef SECURE_MAN_UID +@@ -381,6 +384,8 @@ static void mkcatdirs (const char *mandi + #ifdef SECURE_MAN_UID + if (ruid == 0) + chown (catdir, man_owner->pw_uid, 0); ++ if (rgid == 0) ++ chown (catdir, -1, man_owner->pw_gid); + #endif /* SECURE_MAN_UID */ + drop_effective_privs (); + } +@@ -391,9 +396,14 @@ static void mkcatdirs (const char *mandi + int j; + regain_effective_privs (); + debug ("creating catdir hierarchy %s ", catdir); +- for (j = 1; j <= 9; j++) { +- catname[strlen (catname) - 1] = '0' + j; +- manname[strlen (manname) - 1] = '0' + j; ++ for (j = 0; j <= 10; j++) { ++ unsigned int c; ++ if (j < 10) ++ c = '0' + j; ++ else ++ c = 'n'; ++ catname[strlen (catname) - 1] = c; ++ manname[strlen (manname) - 1] = c; + if ((is_directory (manname) == 1) + && (is_directory (catname) != 1)) { + if (mkdir (catname, +@@ -402,11 +412,12 @@ static void mkcatdirs (const char *mandi + error (0, 0, _("warning: cannot create catdir %s"), catname); + debug ("warning: cannot create catdir %s\n", catname); + } else +- debug (" cat%d", j); ++ debug (" cat%d", c); + #ifdef SECURE_MAN_UID + if (ruid == 0) +- chown (catname, +- man_owner->pw_uid, 0); ++ chown (catname, man_owner->pw_uid, 0); ++ if (rgid == 0) ++ chown (catname, -1, man_owner->pw_gid); + #endif /* SECURE_MAN_UID */ + } + } +@@ -498,15 +509,10 @@ static int testmandirs (const char *path } if (!quiet) { -- fprintf (stderr, "\r"); +- int tty = isatty (STDERR_FILENO); +- +- if (tty) +- fprintf (stderr, "\r"); fprintf (stderr, _("Updating index cache for path " "`%s/%s'. Wait..."), path, mandir->d_name); -+ putc ('\n', stderr); +- if (!tty) +- fprintf (stderr, "\n"); ++ fprintf (stderr, "\n"); } add_dir_entries (path, mandir->d_name); MYDBM_CLOSE (dbf); -@@ -571,7 +571,7 @@ short update_db (const char *manpath) +@@ -674,7 +680,7 @@ int update_db (const char *manpath, cons return new; } @@ -377,7 +280,7 @@ return EOF; } -@@ -747,6 +747,7 @@ static short purge_whatis (const char *p +@@ -856,6 +862,7 @@ static int purge_whatis (const char *pat "would delete\n", name, info->ext); return 1; } @@ -385,7 +288,7 @@ } /* Check that multi keys are correctly constructed. */ -@@ -809,6 +810,11 @@ short purge_missing (const char *manpath +@@ -919,6 +926,11 @@ int purge_missing (const char *manpath, gripe_rwopen_failed (); return 0; } @@ -395,12 +298,13 @@ + return 0; + } + /* Extract the database mtime. */ key = MYDBM_FIRSTKEY (dbf); - -@@ -827,6 +833,14 @@ short purge_missing (const char *manpath +@@ -959,6 +971,14 @@ int purge_missing (const char *manpath, + key = nextkey; continue; } - ++ + /* Ignore db identifier keys. */ + if (*key.dptr == '.' && *(key.dptr+1) == 0) { + nextkey = MYDBM_NEXTKEY (dbf, key); @@ -408,47 +312,57 @@ + key = nextkey; + continue; + } -+ + content = MYDBM_FETCH (dbf, key); if (!MYDBM_DPTR (content)) { - nextkey = MYDBM_NEXTKEY (dbf, key); ---- src/fake_security.c -+++ src/fake_security.c 2007-12-10 12:53:31.000000000 +0100 -@@ -43,6 +43,7 @@ - #include "security.h" +--- src/descriptions_store.c ++++ src/descriptions_store.c 2012-10-02 12:54:25.459006524 +0000 +@@ -71,7 +71,7 @@ void store_descriptions (const struct pa - uid_t ruid, euid, uid; -+gid_t rgid, egid; + if (trace) { + for (i = 0; i < trace->len; ++i) +- debug ("trace->names[%d] = '%s'\n", ++ debug ("trace->names[%zu] = '%s'\n", + i, trace->names[i]); + } - #ifdef SECURE_MAN_UID - static struct passwd *man_owner; --- src/lexgrog.l -+++ src/lexgrog.l 2008-08-12 15:33:28.000000000 +0200 -@@ -51,7 +51,7 @@ - #include "security.h" - #include "encodings.h" ++++ src/lexgrog.l 2012-10-02 11:15:05.159007312 +0000 +@@ -56,7 +56,7 @@ + + #include "manconv_client.h" -#define YY_READ_BUF_SIZE 1024 +#define YY_READ_BUF_SIZE YY_BUF_SIZE - #define MAX_NAME 2048 + #define MAX_NAME 8192 #ifdef PROFILE -@@ -59,10 +59,10 @@ static int ctr[YY_NUM_RULES]; - # define YY_USER_ACTION ++ctr[yy_act]; - #endif +@@ -207,15 +207,15 @@ static const struct macro perldocs[] = { + { "R\"", "\"" } + }; -static void add_str_to_whatis (const char *string, size_t length); -static void add_char_to_whatis (unsigned char c); -static void add_separator_to_whatis (void); +-static void add_wordn_to_whatis (const char *string, size_t length); +-static void add_word_to_whatis (const char *string); +-static void add_glyph_to_whatis (const char *string, size_t length); +-static void add_perldoc_to_whatis (const char *string, size_t length); +-static void mdoc_text (const char *string); -static void newline_found (void); +static __inline__ void add_str_to_whatis (const char *string, size_t length); +static __inline__ void add_char_to_whatis (unsigned char c); +static __inline__ void add_separator_to_whatis (const char *, size_t); ++static __inline__ void add_wordn_to_whatis (const char *string, size_t length); ++static __inline__ void add_word_to_whatis (const char *string); ++static __inline__ void add_glyph_to_whatis (const char *string, size_t length); ++static __inline__ void add_perldoc_to_whatis (const char *string, size_t length); ++static __inline__ void mdoc_text (const char *string); +static __inline__ void newline_found (void); static char newname[MAX_NAME]; static char *p_name; -@@ -71,6 +71,7 @@ static char filters[MAX_FILTERS]; +@@ -224,6 +224,7 @@ static char filters[MAX_FILTERS]; static int fill_mode; static int waiting_for_quote; @@ -456,7 +370,7 @@ static pipeline *decomp; -@@ -87,7 +88,7 @@ static pipeline *decomp; +@@ -240,7 +241,7 @@ static pipeline *decomp; %} %option ecs meta-ecs @@ -465,10 +379,10 @@ %option nostdinit %option warn %option noyywrap nounput -@@ -116,8 +117,9 @@ font_change \\f([[:upper:]1-4]|\({upper} +@@ -278,8 +279,9 @@ font_change \\f([[:upper:]1-4]|\({upper} size_change \\s[+-]?{digit} style_change ({font_change}{size_change}?|{size_change}{font_change}?) - typeface \.(B[IR]?|I[BR]?|R[BI]) + typeface \.(B[IR]?|I[BR]?|R[BI]|S[BM]) +paragr \.[PITLH][Pp] sec_request \.[Ss][HhYySs] -comment ['.]\\{dbl_quote} @@ -476,10 +390,10 @@ /* Please add to this list if you know how. */ /* Note that, since flex only supports UTF-8 by accident, character classes -@@ -150,7 +152,26 @@ vi_name TÊN - zh_CN_name 名{blank}?称{blank}?.* - zh_TW_name (名{blank}?稱|命令名){blank}?.* - name ({bg_name}|{cs_name}|{da_name}|{de_name}|{en_name}|{es_name}|{fi_name}|{fr_name}|{hu_name}|{id_name}|{it_name}|{ja_name}|{ko_name}|{latin_name}|{nl_name}|{pl_name}|{ru_name}|{sk_name}|{sr_name}|{sv_name}|{tr_name}|{vi_name}|{zh_CN_name}|{zh_TW_name}) +@@ -314,7 +316,26 @@ vi_name TÊN + zh_CN_name 名{blank}?(称|字){blank}?.* + zh_TW_name (名{blank}?(稱|字)|命令名){blank}?.* + name ({bg_name}|{cs_name}|{da_name}|{de_name}|{en_name}|{es_name}|{fi_name}|{fr_name}|{hu_name}|{id_name}|{it_name}|{ja_name}|{ko_name}|{latin_name}|{lt_name}|{nl_name}|{pl_name}|{ru_name}|{sk_name}|{sr_name}|{srlatin_name}|{sv_name}|{tr_name}|{vi_name}|{zh_CN_name}|{zh_TW_name}) -name_sec {dbl_quote}?{style_change}?{name}{style_change}?({blank}*{dbl_quote})? +name_sec {dbl_quote}?{style_change}?{name}{style_change}?({blank}*{dbl_quote})?\r? +start {sec_request}{blank_eol}+{name_sec} @@ -504,7 +418,7 @@ /* eptgrv : eqn, pic, tbl, grap, refer, vgrind */ tbl_request \.TS -@@ -164,8 +185,13 @@ vgrind_request \.vS +@@ -328,8 +349,13 @@ vgrind_request \.vS %% /* begin NAME section processing */ @@ -520,7 +434,7 @@ /* general text matching */ \.[^Ss\r\n].* | -@@ -216,6 +242,7 @@ vgrind_request \.vS +@@ -397,6 +423,7 @@ vgrind_request \.vS {bol}\.sp{blank}* | /* vertical spacing */ {bol}\.ig{blank}* | /* block comment */ {bol}\.de[1i]?{blank}* | /* macro definition */ @@ -528,15 +442,7 @@ {bol}\.i[ef]{blank}* | /* conditional */ {empty}{bol}.+ | <> { /* terminate the string */ -@@ -242,28 +269,31 @@ vgrind_request \.vS - {bol}{typeface}{blank}+ | /* type face commands */ - {bol}\.ft{blank}.* | /* font change */ - {bol}\.V[be]{blank}.* | /* pod2man, verbatim mode */ -- {bol}\.IX{blank}.* | /* .IX line */ -+ {bol}\.IX{blank}.* | /* index request */ - {next}{comment}.* { /* per line comments */ - newline_found (); - } +@@ -434,21 +461,24 @@ vgrind_request \.vS } /* No-op requests */ @@ -555,7 +461,7 @@ /* convert to DASH */ {next}{blank}*\\\((mi|hy|em){blank}* | -+{bol}\.sp{bol}{blank}+\\-{blank}* | /* strange spacing in NAME section */ ++{bol}\.sp{bol}{blank}+\\-{blank}* | /* strange spacing in NAME section * +{blank}+[-\\]?-{bol} | /* dash at end of line */ +{next}{blank_eol}+(\\?-){2}{blank}+ | /* some man pages use -- as dash */ {next}{blank_eol}+[-\\]-{blank}* | @@ -566,15 +472,15 @@ /* escape sequences and special characters */ { -@@ -279,6 +309,7 @@ vgrind_request \.vS +@@ -464,6 +494,7 @@ vgrind_request \.vS {next}\\[|^&!%acdpruz{}\r\n] /* various useless control chars */ {next}\\[bhlLvx]{blank}*'[^']+' /* various inline functions */ + {next}\\\\\$[1-9] /* roff macro argument */ {next}\\\$[1-9] /* interpolate arg */ - {next}\\\*(\({alpha})?{alpha} /* interpolate string */ -@@ -307,11 +338,8 @@ vgrind_request \.vS + /* roff named glyphs */ +@@ -626,11 +657,8 @@ vgrind_request \.vS for later processing */ { {bol}\.br{blank}* | @@ -587,7 +493,7 @@ {bol}\.RS{blank}.* | {bol}\.RE{blank}.* add_char_to_whatis ((char) 0x11); } -@@ -324,7 +352,7 @@ vgrind_request \.vS +@@ -645,7 +673,7 @@ vgrind_request \.vS [[:alnum:]]* add_str_to_whatis (yytext, yyleng); /* normalise the period (,) separators */ @@ -596,16 +502,16 @@ {blank}*,{blank}* add_str_to_whatis (", ", 2); {bol}. { -@@ -340,7 +368,7 @@ vgrind_request \.vS +@@ -661,7 +689,7 @@ vgrind_request \.vS %% /* print warning and force scanner to terminate */ -static void too_big (void) +static __inline__ void too_big (void) { - error (0, 0, - _("warning: whatis for %s exceeds %d bytes, truncating."), -@@ -350,7 +378,7 @@ static void too_big (void) + /* Even though MAX_NAME is a macro expanding to a constant, we + * translate it using ngettext anyway because that will make it +@@ -678,7 +706,7 @@ static void too_big (void) } /* append a string to newname if enough room */ @@ -614,7 +520,7 @@ { if (p_name - newname + length >= MAX_NAME) too_big (); -@@ -361,8 +389,10 @@ static void add_str_to_whatis (const cha +@@ -689,8 +717,10 @@ static void add_str_to_whatis (const cha } /* append a char to newname if enough room */ @@ -626,17 +532,17 @@ if (p_name - newname + 1 >= MAX_NAME) too_big (); else if (waiting_for_quote && c == '"') -@@ -374,14 +404,30 @@ static void add_char_to_whatis (unsigned +@@ -702,8 +732,24 @@ static void add_char_to_whatis (unsigned /* append the " - " separator to newname, trimming the first space if one's * already there */ -static void add_separator_to_whatis (void) -+static __inline__ void add_separator_to_whatis (const char *string, size_t len) ++static __inline__ void add_separator_to_whatis (const char *, size_t) { + if (have_separator) { + unsigned int n; + unsigned char c; -+ ++ + for (n = 0; (n < len) && (c = string[n]); n++) { + switch (c) { + case '-': @@ -652,6 +558,63 @@ if (p_name != newname && *(p_name - 1) != ' ') add_char_to_whatis (' '); add_str_to_whatis ("- ", 2); +@@ -711,7 +757,7 @@ static void add_separator_to_whatis (voi + + /* append a word to newname if enough room, ensuring only necessary + surrounding space */ +-static void add_wordn_to_whatis (const char *string, size_t length) ++static __inline__ void add_wordn_to_whatis (const char *string, size_t length) + { + if (p_name != newname && *(p_name - 1) != ' ') + add_char_to_whatis (' '); +@@ -721,7 +767,7 @@ static void add_wordn_to_whatis (const c + add_str_to_whatis (string, length); + } + +-static void add_word_to_whatis (const char *string) ++static __inline__ void add_word_to_whatis (const char *string) + { + add_wordn_to_whatis (string, strlen (string)); + } +@@ -731,7 +777,7 @@ struct compare_macro_key { + size_t length; + }; + +-static int compare_macro (const void *left, const void *right) ++static __inline__ int compare_macro (const void *left, const void *right) + { + const struct compare_macro_key *key = left; + const struct macro *value = right; +@@ -749,7 +795,7 @@ static int compare_macro (const void *le + return 0; + } + +-static void add_macro_to_whatis (const struct macro *macros, size_t n_macros, ++static __inline__ void add_macro_to_whatis (const struct macro *macros, size_t n_macros, + const char *string, size_t length) + { + struct compare_macro_key key; +@@ -763,23 +809,23 @@ static void add_macro_to_whatis (const s + add_str_to_whatis (macro->value, strlen (macro->value)); + } + +-static void add_glyph_to_whatis (const char *string, size_t length) ++static __inline__ void add_glyph_to_whatis (const char *string, size_t length) + { + add_macro_to_whatis (glyphs, ARRAY_SIZE (glyphs), string, length); + } + +-static void add_perldoc_to_whatis (const char *string, size_t length) ++static __inline__ void add_perldoc_to_whatis (const char *string, size_t length) + { + add_macro_to_whatis (perldocs, ARRAY_SIZE (perldocs), string, length); + } + +-static void mdoc_text (const char *string) ++static __inline__ void mdoc_text (const char *string) + { + add_word_to_whatis (string); + BEGIN (MAN_NAME); } -static void newline_found (void) @@ -659,7 +622,7 @@ { /* If we are mid p_name and the last added char was not a space, * best add one. -@@ -457,6 +503,7 @@ int find_name_decompressed (pipeline *p, +@@ -855,6 +901,7 @@ int find_name_decompressed (pipeline *p, fill_mode = 1; waiting_for_quote = 0; @@ -668,8 +631,8 @@ if (p_lg->type) BEGIN (CAT_FILE); --- src/man.c -+++ src/man.c 2008-08-12 16:59:18.640462210 +0200 -@@ -66,6 +66,7 @@ static char *cwd; ++++ src/man.c 2012-10-02 13:39:15.135007300 +0000 +@@ -68,6 +68,7 @@ static char *cwd; #include #include #include @@ -677,7 +640,7 @@ #include "argp.h" #include "dirname.h" -@@ -104,6 +105,8 @@ static char *cwd; +@@ -110,6 +111,8 @@ static char *cwd; #ifdef SECURE_MAN_UID extern uid_t ruid; extern uid_t euid; @@ -686,7 +649,7 @@ #endif /* SECURE_MAN_UID */ /* the default preprocessor sequence */ -@@ -134,6 +137,10 @@ const char *lang; +@@ -140,6 +143,10 @@ char *lang; static int global_manpath = -1; /* global or user manual page hierarchy? */ static int skip; /* page exists but has been skipped */ @@ -697,23 +660,18 @@ #if defined _AIX || defined __sgi char **global_argv; -@@ -224,12 +231,12 @@ static char *tmp_cat_file; /* for open_c - static int tmp_cat_fd; +@@ -244,9 +251,9 @@ static int found_a_stray; /* found a st + #ifdef MAN_CATS + static char *tmp_cat_file; /* for open_cat_stream(), close_cat_stream() */ static int created_tmp_cat; /* dto. */ - static int man_modtime; /* modtime of man page, for commit_tmp_cat() */ -#endif + static int tmp_cat_fd; + static int man_modtime; /* modtime of man page, for commit_tmp_cat() */ +#endif /* MAN_CATS */ # ifdef TROFF_IS_GROFF --static int ditroff; -+static int ditroff = 0; - static const char *gxditview; --static int htmlout; -+static int htmlout = 0; - static const char *html_pager; - # endif /* TROFF_IS_GROFF */ - -@@ -537,25 +544,6 @@ static void gripe_no_name (const char *s + static int ditroff; +@@ -607,25 +614,6 @@ static void gripe_no_name (const char *s exit (FAIL); } @@ -736,24 +694,10 @@ - } -} - + #if defined(TROFF_IS_GROFF) || defined(HEIRLOOM_NROFF) static int get_roff_line_length (void) { - int line_length = get_line_length (); -@@ -640,11 +628,11 @@ static inline char **manopt_to_env (int - { - char *manopt, *opt_start, **argv; - -- manopt = getenv ("MANOPT"); -+ opt_start = manopt = getenv ("MANOPT"); - if (manopt == NULL || *manopt == '\0') - return NULL; - -- opt_start = manopt = xstrdup (manopt); -+ manopt = xstrdup (manopt); - - /* allocate space for the program name */ - *argc = 0; -@@ -760,30 +748,43 @@ static int local_man_loop (const char *a +@@ -912,30 +900,43 @@ static int local_man_loop (const char *a display (NULL, "", NULL, "(stdin)", NULL); else { struct stat st; @@ -802,7 +746,7 @@ return NOT_FOUND; } -@@ -801,8 +802,10 @@ static int local_man_loop (const char *a +@@ -1000,8 +1001,10 @@ executable_out: argv_abs = xstrdup (argv); } lang = lang_dir (argv_abs); @@ -814,9 +758,9 @@ if (local_mf) error (0, errno, "%s", argv); exit_status = NOT_FOUND; -@@ -834,7 +837,16 @@ int main (int argc, char *argv[]) - bindtextdomain (PACKAGE "-gnulib", LOCALEDIR); - textdomain (PACKAGE); +@@ -1030,7 +1033,16 @@ int main (int argc, char *argv[]) + umask (022); + init_locale (); - internal_locale = setlocale (LC_MESSAGES, NULL); + internal_locale = setlocale (LC_MESSAGES, ""); @@ -832,7 +776,7 @@ /* Use LANGUAGE only when LC_MESSAGES locale category is * neither "C" nor "POSIX". */ if (internal_locale && strcmp (internal_locale, "C") && -@@ -904,9 +916,13 @@ int main (int argc, char *argv[]) +@@ -1095,9 +1107,13 @@ int main (int argc, char *argv[]) if (external) do_extern (argc, argv); @@ -847,55 +791,7 @@ #endif /* SECURE_MAN_UID */ /* close this locale and reinitialise if a new locale was -@@ -924,6 +940,7 @@ int main (int argc, char *argv[]) - setenv ("LANGUAGE", internal_locale, 1); - ++_nl_msg_cat_cntr; - multiple_locale = NULL; -+#define MULTIPLE_LOCALE_IS_NULL 1 - } - } - -@@ -978,6 +995,22 @@ int main (int argc, char *argv[]) - } - - if (manp == NULL) { -+#if MULTIPLE_LOCALE_IS_NULL -+ char * tmp_locale = xstrdup(internal_locale); -+ char * ptr; -+ -+ manp = get_manpath (alt_system_name); -+ -+ /* -+ * Use strsep () to not intermix with strtok () -+ */ -+ for (ptr = strsep (&tmp_locale, ":"); ptr; ptr = strsep (&tmp_locale, ":")) { -+ if (debug_level) -+ fprintf (stderr, "checking for locale %s\n", ptr); -+ manp = add_nls_manpath (manp, ptr); -+ } -+ free(tmp_locale); -+#else - char tmp_locale[3]; - int idx; - -@@ -999,6 +1032,7 @@ int main (int argc, char *argv[]) - debug ("checking for locale %s\n", tmp_locale); - manp = add_nls_manpath (manp, tmp_locale); - } -+#endif - } else - free (get_manpath (NULL)); - -@@ -1155,7 +1189,7 @@ static inline const char *is_section (co - } - - /* Snarf pre-processors from file, return (static) string or NULL on failure */ --static const char *get_preprocessors_from_file (pipeline *decomp) -+static const char *get_preprocessors_from_file (pipeline *decomp, char * pp_encoding) - { - static char *directive = NULL; - -@@ -1174,7 +1208,8 @@ static const char *get_preprocessors_fro +@@ -1400,7 +1416,8 @@ static const char *get_preprocessors_fro if (!line) return NULL; @@ -905,83 +801,7 @@ const char *newline = strchr (line, '\n'); if (newline) directive = xstrndup (line + 4, newline - (line + 4)); -@@ -1182,6 +1217,25 @@ static const char *get_preprocessors_fro - directive = xstrdup (line + 4); - } - -+ if (directive && strstr (directive, "-*-")) { -+ const char *pp_search = strstr (directive, "-*-") + 3; -+ while (*pp_search == ' ') -+ ++pp_search; -+ if (STRNEQ (pp_search, "coding:", 7)) { -+ const char *pp_encoding_end; -+ pp_search += 7; -+ while (*pp_search == ' ') -+ ++pp_search; -+ pp_encoding_end = strchr (pp_search, ' '); -+ if (pp_encoding_end) { -+ size_t len = pp_encoding_end - pp_search; -+ pp_encoding = xstrndup (pp_search, len); -+ } else -+ pp_encoding = xstrdup (pp_search); -+ debug ("preprocessor encoding: %s\n", pp_encoding); -+ } -+ } -+ - /* if we didn't find PP_COOKIE, then directive == NULL */ - #endif - return directive; -@@ -1190,7 +1244,7 @@ static const char *get_preprocessors_fro - - /* Determine pre-processors, set save_cat and return - (static) string */ --static const char *get_preprocessors (pipeline *decomp, const char *dbfilters) -+static const char *get_preprocessors (pipeline *decomp, const char *dbfilters, char * pp_encoding) - { - const char *pp_string; - const char *pp_source; -@@ -1204,7 +1258,7 @@ static const char *get_preprocessors (pi - } else if ((pp_string = preprocessors)) { - pp_source = "command line"; - save_cat = 0; -- } else if ((pp_string = get_preprocessors_from_file (decomp))) { -+ } else if ((pp_string = get_preprocessors_from_file (decomp, pp_encoding))) { - pp_source = "file"; - save_cat = 1; - } else if ((pp_string = getenv ("MANROFFSEQ"))) { -@@ -1230,6 +1284,7 @@ static pipeline *make_roff_command (cons - { - const char *pp_string; - const char *roff_opt; -+ const char *pp_encoding; - char *fmt_prog; - pipeline *p = pipeline_new (); - command *cmd; -@@ -1239,8 +1294,8 @@ static pipeline *make_roff_command (cons - #ifndef ALT_EXT_FORMAT - dir = dir; /* not used unless looking for formatters in catdir */ - #endif -- -- pp_string = get_preprocessors (decomp, dbfilters); -+ pp_encoding = (char*)0; -+ pp_string = get_preprocessors (decomp, dbfilters, pp_encoding); - - roff_opt = getenv ("MANROFFOPT"); - if (!roff_opt) -@@ -1295,8 +1350,10 @@ static pipeline *make_roff_command (cons - if (!recode) - pipeline_command_argstr (p, get_def ("soelim", - SOELIM)); -- -- page_encoding = get_page_encoding (lang); -+ if (pp_encoding) -+ page_encoding = pp_encoding; -+ else -+ page_encoding = get_page_encoding (lang); - source_encoding = get_source_encoding (lang); - debug ("page_encoding = %s\n", page_encoding); - debug ("source_encoding = %s\n", source_encoding); -@@ -1652,6 +1709,18 @@ static void setenv_less (const char *tit +@@ -1917,6 +1934,18 @@ static void setenv_less (pipecmd *cmd, c free (less_opts); } @@ -997,20 +817,19 @@ + } +} + - /* Return pipeline to display file. NULL means stdin. - * - * TODO: htmlout case is pretty weird now. I'd like the intelligence to be -@@ -1664,6 +1733,9 @@ static pipeline *make_display_command (c + static void add_output_iconv (pipeline *p, + const char *source, const char *target) + { +@@ -1972,6 +2001,8 @@ static pipeline *make_display_command (c - setenv_less (title); - -+ if (!htmlout) -+ disable_x(); -+ - if (file) { - if (ascii) { - p = pipeline_new (); -@@ -1706,7 +1778,7 @@ static pipeline *make_display_command (c + if (pager_cmd) { + setenv_less (pager_cmd, title); ++ if (!htmlout) ++ disable_x(); + pipeline_command (p, pager_cmd); + } + pipeline_ignore_signals (p, 1); +@@ -1982,7 +2013,7 @@ static pipeline *make_display_command (c return p; } @@ -1019,32 +838,23 @@ /* return a (malloced) temporary name in cat_file's directory */ static char *tmp_cat_filename (const char *cat_file) { -@@ -1809,8 +1881,6 @@ static int commit_tmp_cat (const char *c - return status; - } +@@ -2084,6 +2115,7 @@ static int commit_tmp_cat (const char *c --#ifdef MAN_CATS -- - /* Return pipeline to write formatted manual page to for saving as cat file. */ - static pipeline *open_cat_stream (const char *cat_file) - { -@@ -1884,6 +1954,7 @@ static int close_cat_stream (pipeline *c - free (tmp_cat_file); return status; } +#endif /* MAN_CATS */ /* TODO: This should all be refactored after work on the decompression * library is complete. -@@ -1896,6 +1967,7 @@ void discard_stderr (pipeline *p) - p->commands[i]->discard_err = 1; +@@ -2104,7 +2136,6 @@ static void maybe_discard_stderr (pipeli } -+#ifdef MAN_CATS - /* - * format a manual page with format_cmd, display it with disp_cmd, and - * save it to cat_file -@@ -2057,6 +2129,7 @@ static void format_display (pipeline *de + #ifdef MAN_CATS +- + /* Return pipeline to write formatted manual page to for saving as cat file. */ + static pipeline *open_cat_stream (const char *cat_file, const char *encoding) + { +@@ -2338,6 +2369,7 @@ static void format_display (pipeline *de regain_effective_privs (); } @@ -1052,48 +862,24 @@ /* "Display" a page in catman mode, which amounts to saving it. */ /* TODO: merge with format_display_and_save? */ static void display_catman (const char *cat_file, pipeline *decomp, -@@ -2095,6 +2168,7 @@ static void display_catman (const char * +@@ -2377,6 +2409,7 @@ static void display_catman (const char * pop_cleanup(); free (tmpcat); } +#endif /* MAN_CATS */ - /* - * optionally chdir to dir, if necessary update cat_file from man_file -@@ -2117,10 +2191,18 @@ static int display (const char *dir, con - if (dir) { - debug ("chdir %s\n", dir); - -+ if (global_manpath) -+ drop_effective_privs(); -+ - if (chdir (dir)) { - error (0, errno, _("can't chdir to %s"), dir); -+ if (global_manpath) -+ regain_effective_privs(); - return 0; - } -+ -+ if (global_manpath) -+ regain_effective_privs(); - } - - /* define format_cmd */ -@@ -2133,11 +2215,10 @@ static int display (const char *dir, con - - if (decomp) { - pipeline_start (decomp); -- format_cmd = make_roff_command (dir, man_file, decomp, -- dbfilters); -+ format_cmd = make_roff_command (dir, man_file, decomp, dbfilters); - } else + static void disable_hyphenation (void *data ATTRIBUTE_UNUSED) + { +@@ -2529,7 +2562,7 @@ static int display (const char *dir, con format_cmd = NULL; + decomp_errno = errno; + } - +#ifdef MAN_CATS /* Get modification time, for commit_tmp_cat(). */ if (man_file && *man_file) { struct stat stb; -@@ -2146,7 +2227,7 @@ static int display (const char *dir, con +@@ -2538,7 +2571,7 @@ static int display (const char *dir, con else man_modtime = stb.st_mtime; } @@ -1102,7 +888,7 @@ display_to_stdout = troff; #ifdef TROFF_IS_GROFF if (htmlout) -@@ -2263,6 +2344,7 @@ static int display (const char *dir, con +@@ -2673,6 +2706,7 @@ static int display (const char *dir, con } if (printed) putchar ('\n'); @@ -1110,15 +896,15 @@ } else if (catman) { if (format) { if (!save_cat) -@@ -2274,6 +2356,7 @@ static int display (const char *dir, con - display_catman (cat_file, decomp, - format_cmd); +@@ -2685,6 +2719,7 @@ static int display (const char *dir, con + format_cmd, + formatted_encoding); } +#endif /* MAN_CATS */ } else if (format) { /* no cat or out of date */ pipeline *disp_cmd; -@@ -2324,8 +2407,10 @@ static int display (const char *dir, con +@@ -2743,8 +2778,10 @@ static int display (const char *dir, con } } @@ -1131,7 +917,15 @@ if (!prompt) prompt = found; -@@ -2923,7 +3008,7 @@ static int display_database_check (struc +@@ -2752,7 +2789,6 @@ static int display (const char *dir, con + return found; + } + +- + static char *find_cat_file (const char *path, const char *original, + const char *man_file) + { +@@ -3486,7 +3522,7 @@ static int display_database_check (struc #ifdef MAN_DB_UPDATES if (!exists && !skip) { debug ("dbdelete_wrapper (%s, %p)\n", @@ -1141,7 +935,7 @@ } #endif /* MAN_DB_UPDATES */ --- src/man_db.conf.in -+++ src/man_db.conf.in 2008-08-12 15:35:48.000000000 +0200 ++++ src/man_db.conf.in 2008-08-12 13:35:48.000000000 +0000 @@ -20,6 +20,14 @@ MANDATORY_MANPATH /usr/man MANDATORY_MANPATH /usr/share/man @@ -1310,8 +1104,8 @@ #--------------------------------------------------------- # Program definitions. These are commented out by default as the value --- src/mandb.c -+++ src/mandb.c 2008-08-12 16:59:18.688466727 +0200 -@@ -185,6 +185,8 @@ static const char *xtmpfile; ++++ src/mandb.c 2012-10-02 15:26:11.359507056 +0000 +@@ -193,6 +193,8 @@ static const char *xtmpfile; #ifdef SECURE_MAN_UID extern uid_t ruid; extern uid_t euid; @@ -1320,7 +1114,25 @@ #endif /* SECURE_MAN_UID */ static char *manpathlist[MAXDIRS]; -@@ -518,7 +520,7 @@ static short process_manpath (const char +@@ -527,6 +529,8 @@ static int mandb (const char *catpath, c + return amount; + } + ++extern void mkcatdirs (const char *, const char *); ++ + static int process_manpath (const char *manpath, int global_manpath, + struct hashtable *tried_catdirs) + { +@@ -560,6 +564,8 @@ static int process_manpath (const char * + database = NULL; + } + ++ mkcatdirs (manpath, catpath); ++ + push_cleanup (cleanup, NULL, 0); + push_cleanup (cleanup_sigsafe, NULL, 1); + if (single_filename) { +@@ -590,7 +596,7 @@ static int process_manpath (const char * if (!opt_test && amount) { finish_up (); #ifdef SECURE_MAN_UID @@ -1329,7 +1141,7 @@ do_chown (man_owner->pw_uid); #endif /* SECURE_MAN_UID */ } -@@ -586,8 +588,14 @@ int main (int argc, char *argv[]) +@@ -801,8 +807,14 @@ int main (int argc, char *argv[]) error (FAIL, 0, _("the setuid man user \"%s\" does not exist"), MAN_OWNER); @@ -1345,70 +1157,10 @@ + } #endif /* SECURE_MAN_UID */ - + read_config_file (user); --- src/manp.c -+++ src/manp.c 2008-08-12 16:59:18.712468986 +0200 -@@ -70,6 +70,7 @@ - #include "security.h" - #include "encodings.h" - #include "manp.h" -+#include "security.h" - - struct list { - char *key; -@@ -673,6 +674,8 @@ char *get_manpath (const char *systems) - #ifdef SECURE_MAN_UID - extern uid_t ruid; /* initial real user id */ - extern uid_t euid; /* initial effective user id */ -+extern gid_t rgid; /* initial real group id */ -+extern gid_t egid; /* initial effective group id */ - #endif /* SECURE_MAN_UID */ - - /* create the catman hierarchy if it doesn't exist */ -@@ -701,6 +704,8 @@ mkcatdirs (const char *mandir, const cha - #ifdef SECURE_MAN_UID - if (ruid == 0) - chown (catdir, man_owner->pw_uid, 0); -+ if (rgid == 0) -+ chown (catdir, -1, man_owner->pw_gid); - #endif /* SECURE_MAN_UID */ - drop_effective_privs (); - } -@@ -711,9 +716,14 @@ mkcatdirs (const char *mandir, const cha - int j; - regain_effective_privs (); - debug ("creating catdir hierarchy %s ", catdir); -- for (j = 1; j <= 9; j++) { -- catname[strlen (catname) - 1] = '0' + j; -- manname[strlen (manname) - 1] = '0' + j; -+ for (j = 0; j <= 10; j++) { -+ unsigned int c; -+ if (j < 10) -+ c = '0' + j; -+ else -+ c = 'n'; -+ catname[strlen (catname) - 1] = c; -+ manname[strlen (manname) - 1] = c; - if ((is_directory (manname) == 1) - && (is_directory (catname) != 1)) { - if (mkdir (catname, -@@ -722,11 +732,12 @@ mkcatdirs (const char *mandir, const cha - error (0, 0, _("warning: cannot create catdir %s"), catname); - debug ("warning: cannot create catdir %s\n", catname); - } else -- debug (" cat%d", j); -+ debug (" cat%c", c); - #ifdef SECURE_MAN_UID - if (ruid == 0) -- chown (catname, -- man_owner->pw_uid, 0); -+ chown (catname, man_owner->pw_uid, 0); -+ if (rgid == 0) -+ chown (catname, -1, man_owner->pw_gid); - #endif /* SECURE_MAN_UID */ - } - } -@@ -865,7 +876,7 @@ static char *def_path (int flag) ++++ src/manp.c 2012-10-02 14:10:25.187007537 +0000 +@@ -907,7 +907,7 @@ static char *def_path (int flag) /* If we have complete config file failure... */ if (!manpath) @@ -1417,107 +1169,9 @@ return manpath; } ---- src/security.c -+++ src/security.c 2007-12-10 14:24:24.000000000 +0100 -@@ -76,10 +76,13 @@ - # ifdef POSIX_SAVED_IDS - # if defined (HAVE_SETEUID) - # define SET_EUID(euid) seteuid(euid) -+# define SET_EGID(egid) setegid(egid) - # elif defined (HAVE_SETREUID) - # define SET_EUID(euid) setreuid(-1, euid) -+# define SET_EGID(egid) setregid(-1, egid) - # elif defined (HAVE_SETRESUID) - # define SET_EUID(euid) setresuid(-1, euid, -1) -+# define SET_EGID(egid) setresgid(-1, egid, -1) - # endif /* HAVE_SETEUID */ - - /* Sort out the function to use to swap ruid with euid. Used if no suid. */ -@@ -87,8 +90,10 @@ - # else /* !POSIX_SAVED_IDS */ - # if defined (HAVE_SETREUID) - # define SWAP_UIDS(ida, idb) setreuid(idb, ida) -+# define SWAP_GIDS(ida, idb) setregid(idb, ida) - # elif defined (HAVE_SETRESUID) - # define SWAP_UIDS(ida, idb) setresuid(idb, ida, -1) -+# define SWAP_GIDS(ida, idb) setresgid(idb, ida, -1) - # warning Using setresuid() whithout _POSIX_SAVED_IDS! - # endif /* HAVE_SETREUID */ - # endif /* POSIX_SAVED_IDS */ -@@ -100,7 +105,10 @@ - - uid_t ruid; /* initial real user id */ - uid_t euid; /* initial effective user id */ -+gid_t rgid; /* initial real group id */ -+gid_t egid; /* initial effective group id */ - uid_t uid; /* current euid */ -+gid_t gid; /* current egid */ - - static struct passwd *man_owner; - -@@ -114,10 +122,17 @@ static inline void gripe_set_euid (void) - error (FATAL, errno, _("can't set effective uid")); - } - -+static __inline__ void gripe_set_egid () -+{ -+ error (FATAL, errno, _( "can't set effective gid")); -+} -+ - void init_security (void) - { - ruid = getuid (); -+ rgid = getgid (); - uid = euid = geteuid (); -+ gid = egid = getegid (); - debug ("ruid=%d, euid=%d\n", (int) ruid, (int) euid); - priv_drop_count = 0; - drop_effective_privs (); -@@ -191,6 +206,28 @@ void regain_effective_privs (void) - - uid = euid; - } -+ -+ if (gid != rgid) { -+# ifdef POSIX_SAVED_IDS -+ if (SET_EGID (rgid)) -+# else -+ if (SWAP_GIDS (egid, rgid)) -+# endif -+ gripe_set_egid(); -+ -+ gid = rgid; -+ } -+ -+ if (gid != egid) { -+# ifdef POSIX_SAVED_IDS -+ if (SET_EGID (egid)) -+# else -+ if (SWAP_GIDS (rgid, egid)) -+# endif -+ gripe_set_egid(); -+ -+ gid = egid; -+ } - #endif /* SECURE_MAN_UID */ - } - ---- src/security.h -+++ src/security.h 2008-04-21 15:19:19.000000000 +0200 -@@ -25,8 +25,8 @@ - #include - - /* security.c */ --extern inline void drop_effective_privs (void); --extern inline void regain_effective_privs (void); -+extern void drop_effective_privs (void); -+extern void regain_effective_privs (void); - extern int do_system_drop_privs (struct pipeline *p); - extern int remove_with_dropped_privs (const char *filename); - extern void init_security (void); --- src/straycats.c -+++ src/straycats.c 2008-08-12 16:59:18.780475384 +0200 -@@ -35,6 +35,7 @@ ++++ src/straycats.c 2008-08-12 14:59:19.000000000 +0000 +@@ -36,6 +36,7 @@ #include #include #include @@ -1525,7 +1179,7 @@ #ifdef HAVE_DIRENT_H # include -@@ -268,13 +269,17 @@ static int check_for_stray (void) +@@ -279,13 +280,17 @@ static int check_for_stray (void) if (lg.whatis) free (lg.whatis); @@ -1548,8 +1202,8 @@ closedir (cdir); return strays; --- src/ult_src.c -+++ src/ult_src.c 2007-12-10 14:34:00.000000000 +0100 -@@ -289,12 +289,17 @@ const char *ult_src (const char *name, c ++++ src/ult_src.c 2007-12-10 13:34:00.000000000 +0000 +@@ -326,12 +326,17 @@ const char *ult_src (const char *name, c } pipeline_start (decomp); @@ -1571,8 +1225,8 @@ if (include) { const char *ult; --- src/ult_src.h -+++ src/ult_src.h 2007-12-10 13:24:30.000000000 +0100 -@@ -21,9 +21,10 @@ ++++ src/ult_src.h 2007-12-10 12:24:30.000000000 +0000 +@@ -22,9 +22,10 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -1584,139 +1238,5 @@ +#define HARD_LINK 0x0004 +#define WHATISBUF 0x0008 - extern const char *ult_src (const char *name, const char *path, - struct stat *buf, int flags); ---- src/util.c -+++ src/util.c 2007-12-10 13:24:30.000000000 +0100 -@@ -43,6 +43,9 @@ - #include - #include - -+#include -+#define _(String) gettext (String) -+ - #include "manconfig.h" - - #include "pipeline.h" ---- src/wrapper.c -+++ src/wrapper.c 2008-01-07 13:06:02.000000000 +0100 -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -48,7 +49,7 @@ - * it is fixed at compile time to avoid a full class of - * dangers ... - */ --struct { -+static struct { - const char *prog; - const char *run; - const char *user; -@@ -64,10 +65,11 @@ struct { - - char *program_name; - --int main (int argc, char **argv) -+int main (int argc, char **argv, char *envp[]) - { -- uid_t ruid; -- char *fakeroot; -+ uid_t ruid, euid; -+ gid_t rgid; -+// char *fakeroot; - struct passwd *pwd; - - argc = argc; /* not used */ -@@ -84,57 +86,56 @@ int main (int argc, char **argv) - program_name = base_name (argv[0]); - - ruid = getuid (); -- fakeroot = getenv ("FAKEROOTKEY"); -+ euid = geteuid(); -+ rgid = getgid (); -+// fakeroot = getenv ("FAKEROOTKEY"); - - #ifdef DEBUG - printf ("%s:\n", program_name); -- printf ("real = %d, = %d, fakeroot = %d\n", -- (int) ruid, (fakeroot != 0)); -+// printf ("real = %d, = %d, fakeroot = %d\n", (int) ruid, (fakeroot != 0)); - #endif - -- for (wlp = wrapped_list; wlp->prog && strcmp (program_name, wlp->prog); -- ++wlp) -- ; -+ for (wlp = wrapped_list; wlp->prog && strcmp (program_name, wlp->prog); ++wlp) -+ /* __asm__ __volatile__("": : :"memory") */; - if (!wlp->prog) { - fprintf (stderr, _("Don't know which program should I run being >%s<\n"), - program_name); - return -ENOENT; - } -- -- if (!fakeroot && ruid == 0) { -+#ifdef DEBUG -+ printf ("%s\n", wlp->run); -+#endif -+ if (/* !fakeroot && */ (ruid == 0 || euid == 0)) { - pwd = getpwnam (wlp->user); -- /* -- if (!pwd -- || setgid (pwd->pw_gid) -- || initgroups (wlp->user, pwd->pw_gid) -- || setuid (pwd->pw_uid)) { -- fprintf (stderr, _("%s: Failed su to user %s\n"), -- wlp->prog, wlp->user); -- return -EACCES; -- } -- */ - if (!pwd) { -- fprintf (stderr, _("%s: Failed su to user %s\n"), -- wlp->prog, wlp->user); -+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); - return -EACCES; - } -- if (setgid (pwd->pw_gid)) { -- fprintf (stderr, _("%s: Failed su to user %s\n"), -- wlp->prog, wlp->user); -+ if (ruid == 0) { -+ ruid = pwd->pw_uid; -+ rgid = pwd->pw_gid; -+ } else { -+#ifndef MAN_CATS -+ /* No permissions required to create files -+ * under the sub directories of /var/chache/man */ -+ pwd->pw_uid = ruid; -+ pwd->pw_gid = rgid; -+#endif -+ } -+ if (setregid (rgid, pwd->pw_gid)) { -+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); - return -EACCES; - } -- if (initgroups (wlp->user, pwd->pw_gid)) { -- fprintf (stderr, _("%s: Failed su to user %s\n"), -- wlp->prog, wlp->user); -+ if (initgroups (wlp->user, rgid)) { -+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); - return -EACCES; - } -- if (setuid (pwd->pw_uid)) { -- fprintf (stderr, _("%s: Failed su to user %s\n"), -- wlp->prog, wlp->user); -+ if (setreuid (ruid, pwd->pw_uid)) { -+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); - return -EACCES; - } - } -- execv (wlp->run, argv); -- perror ("execv"); -+ execve (wlp->run, argv, envp); -+ perror ("execve"); - return -errno; - } + /* Trace of the link chain from a given file. Any names listed here should + * not have WHATIS_MAN entries created for them. diff --git a/man-db-2.6.3.tar.xz b/man-db-2.6.3.tar.xz new file mode 100644 index 0000000..52c52d3 --- /dev/null +++ b/man-db-2.6.3.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51db85cbbdcb99927865bad4c653a8b18991831e751cc501098a772924e26b47 +size 1388944 diff --git a/man-db_2.5.2-2.diff.bz2 b/man-db_2.5.2-2.diff.bz2 deleted file mode 100644 index 95e1ce5..0000000 --- a/man-db_2.5.2-2.diff.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:67a9fbffb34c693617f7d43cee527acad9610bd30be437069519c326a442724d -size 313 diff --git a/man.spec b/man.spec index 17abfb1..4c44a2d 100644 --- a/man.spec +++ b/man.spec @@ -25,9 +25,13 @@ BuildRequires: gettext-tools BuildRequires: groff BuildRequires: less BuildRequires: libbz2-devel +BuildRequires: libpipeline-devel BuildRequires: libzio-devel +BuildRequires: pkg-config +BuildRequires: po4a +BuildRequires: xz-devel BuildRequires: zlib-devel -Version: 2.5.2 +Version: 2.6.3 Release: 0 Summary: A Program for Displaying man Pages License: GPL-2.0+ @@ -38,25 +42,21 @@ Provides: man_db Requires: glibc-locale Requires: groff >= 1.18 Requires: less -Source: man-db-%{version}.tar.bz2 +Source: man-db-%{version}.tar.xz Source1: sysconfig.cron-man Source2: cron.daily.do_mandb Source3: cron.daily.clean_catman Source4: mancoding +Source5: wrapper.c Patch0: man-db-%{version}.dif -Patch1: man-db_%{version}-2.diff.bz2 +Source6: man-db-2.6.3-man0.dif Patch2: man-db-2.3.19deb4.0-groff.dif -Patch4: man-db-2.4.3-section.dif -Patch5: man-db-2.5.1-security4.dif -Patch6: man-db-2.4.3-firefox.dif -Patch7: man-db-%{version}-chinese.dif -Patch8: man-db-2.5.1-globbing.dif -Patch9: man-db-2.5.1-zio.dif -Patch10: man-db-2.5.1-listall.dif -Patch11: man-db-%{version}-catp.dif -Patch12: man-db-2.5.2-fastpipe.dif -Patch13: man-db-2.5.2-fhs.dif -Patch14: automake-1.12.patch +Patch4: man-db-2.6.3-section.dif +Patch5: man-db-2.6.3-security4.dif +Patch6: man-db-2.6.3-firefox.dif +Patch7: man-db-2.6.3-chinese.dif +Patch9: man-db-2.6.3-zio.dif +Patch10: man-db-2.6.3-listall.dif BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc @@ -74,22 +74,14 @@ Authors: %prep %setup -n man-db-%{version} -%patch1 -p1 -b .debian %patch2 -p0 -b .groff %patch4 -p0 -b .sect %patch5 -p0 -b .secu4 %patch6 -p0 -b .firefox %patch7 -p0 -b .chinese -%patch8 -p0 -b .globbing %patch9 -p0 -b .zio %patch10 -p0 -b .listall -%patch11 -p0 -b .catp -%patch12 -p0 -b .fp -%patch13 -p0 -b .fhs -%patch0 -p0 -%if 0%{?suse_version} > 1210 -%patch14 -p1 -%endif +%patch0 -p0 %build gettextize --force --copy --no-changelog @@ -115,40 +107,35 @@ Authors: Cg g s m) SEC="${SEC[@]}" rm -f configure - CFLAGS="${RPM_OPT_FLAGS} -funroll-loops -pipe -D_GNU_SOURCE -D_SVID_SOURCE -Wall" +%global optflags %{optflags} -funroll-loops -pipe -D_GNU_SOURCE -D_SVID_SOURCE -Wall + CFLAGS="%{optflags}" LDFLAGS= LIBS= - export CFLAGS LDFLAGS LIBS -%if %suse_version > 1030 - aclocal -I ${PWD}/m4 -I ${PWD}/gnulib/m4 - autoconf -B ${PWD}/m4 -B ${PWD}/gnulib/m4 + LINGUAS= + for d in $(cat man/LINGUAS*) ; do + test -d %{_datadir}/locale/$d || continue + LINGUAS="${LINGUAS:+$LINGUAS }$d" + done + export CFLAGS LDFLAGS LIBS LINGUAS + aclocal -I ${PWD} -I ${PWD}/m4 -I ${PWD}/gnulib/m4 + autoconf -B ${PWD} -B ${PWD}/m4 -B ${PWD}/gnulib/m4 automake --add-missing -%else - sed -ri 's/(m4_PACKAGE_VERSION,[[:blank:]]*\[)2.61(\])/\12.60\2/' aclocal.m4 - sed -ri 's/(AM_INIT_AUTOMAKE\(\[)1.10/\11.9.6/' configure.ac - sed -ri 's/intl//' Makefile.am - aclocal -I ${PWD}/m4 -I ${PWD}/gnulib/m4 - autoconf -B ${PWD}/m4 -B ${PWD}/gnulib/m4 - mkdir -p tools - touch tools/compile - export MKDIR_P="mkdir -p" -%endif - ./configure \ - --enable-dups \ - --enable-setuid=man \ - --with-device=utf8 \ - --prefix=%{_prefix} \ - --mandir=%{_mandir} \ - --localstatedir=%{_localstatedir} \ - --libexecdir=%{_prefix}/lib \ - --with-zio \ - --with-gnu-ld \ - --disable-rpath \ - --enable-mb-groff \ - --with-db=gdbm \ - --enable-nls \ + %configure \ + --enable-dups \ + --enable-setuid=man \ + --with-device=utf8 \ + --with-zio \ + --with-gnu-ld \ + --disable-rpath \ + --disable-automatic-create \ + --enable-automatic-update \ + --disable-cats \ + --enable-threads=posix \ + --enable-mb-groff \ + --with-db=gdbm \ + --enable-nls \ --with-config-file=%{_sysconfdir}/manpath.config \ - --without-included-gettext \ + --without-included-gettext \ --with-sections="${SEC}" make %{?_smp_mflags} nls=all for man in $(find man/ -type f -a -name '*.man[0-9]'); do @@ -166,22 +153,33 @@ Authors: " $man esac done + gcc $CFLAGS -I gnulib/lib/ -I include/ --include config.h --include configmake.h \ + -o wrapper %{S:5} -L gnulib/lib/.libs/ -lgnu %install %if %suse_version <= 1030 export MKDIR_P="mkdir -p" %endif - rm -rf %{buildroot}%{_localstatedir}/cache/man + rm -rf %{buildroot}%{_localstatedir}/cache/man + mkdir -p %{buildroot}%{_datadir}/doc/packages/man mkdir -p %{buildroot}%{_prefix}/lib/man-db mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}/etc make nls=all install DESTDIR=%{buildroot} - if test -x %{buildroot}%{_bindir}/wrapper ; then - rm -f %{buildroot}%{_bindir}/mandb - rm -f %{buildroot}%{_bindir}/man - mv %{buildroot}%{_bindir}/wrapper %{buildroot}%{_bindir}/mandb - ln -sf mandb %{buildroot}%{_bindir}/man + mv %{buildroot}%{_libdir}/man-db/libman*%{version}.so \ + %{buildroot}%{_libdir}/ + rm -rfv %{buildroot}%{_libdir}/man-db/ + mv %{buildroot}%{_datadir}/doc/man-db/man-db-manual.* \ + %{buildroot}%{_datadir}/doc/packages/man/ + # wrapper + if test -x %{buildroot}%{_bindir}/mandb ; then + mv %{buildroot}%{_bindir}/mandb %{buildroot}%{_prefix}/lib/man-db/ fi + if test -x %{buildroot}%{_bindir}/man ; then + mv %{buildroot}%{_bindir}/man %{buildroot}%{_prefix}/lib/man-db/ + fi + install wrapper %{buildroot}%{_bindir}/mandb + ln -sf mandb %{buildroot}%{_bindir}/man mkdir -p %{buildroot}%{_mandir} pushd %{buildroot}%{_mandir}/ rm -rf *.ascii/ @@ -213,7 +211,8 @@ test -d var/catman/ && rm -rf var/catman/ || true %files -f man-db.lang %defattr(-,root,root) %doc docs/COPYING -%doc docs/ChangeLog +%doc ChangeLog +%doc %{_datadir}/doc/packages/man/man-db-manual.* %config /etc/manpath.config %attr(0744,root,root) /etc/cron.daily/suse-clean_catman %attr(0744,root,root) /etc/cron.daily/suse-do_mandb @@ -230,25 +229,19 @@ test -d var/catman/ && rm -rf var/catman/ || true %{_bindir}/manpath %{_bindir}/whatis %{_bindir}/zsoelim -%if %suse_version > 1030 %dir %attr(0755,root,root) %{_prefix}/lib/man-db %attr(0755,root,root) %{_prefix}/lib/man-db/man %attr(0755,root,root) %{_prefix}/lib/man-db/mandb %attr(0755,man,man) %{_prefix}/lib/man-db/manconv %attr(0755,man,man) %{_prefix}/lib/man-db/globbing -%else -%dir %attr(0711,root,root) %{_prefix}/lib/man-db -%attr(0711,root,root) %{_prefix}/lib/man-db/man -%attr(0711,root,root) %{_prefix}/lib/man-db/mandb -%attr(0711,man,man) %{_prefix}/lib/man-db/manconv -%attr(0711,man,man) %{_prefix}/lib/man-db/globbing -%endif %{_sbindir}/accessdb +%{_libdir}/libman*.so %{_datadir}/groff/site-tmac/tmac.andb %{_datadir}/groff/site-tmac/tmac.andocdb %doc %{_mandir}/man1/*.1.gz %doc %{_mandir}/man5/*.5.gz %doc %{_mandir}/man8/*.8.gz +%dir %{_mandir}/id %defattr(-,man,man) %{_localstatedir}/cache/man/* %{_localstatedir}/adm/fillup-templates/sysconfig.cron-man diff --git a/wrapper.c b/wrapper.c new file mode 100644 index 0000000..e2815bb --- /dev/null +++ b/wrapper.c @@ -0,0 +1,138 @@ +/* + * wrapper.c - wrapper program around man and mandb + * + * Copyright (C) 2000 Fabrizio Polacco + * Copyright (C) 2001, 2002 Colin Watson. + * + * This file is part of man-db. + * + * man-db is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * man-db is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with man-db; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dirname.h" + +#include "gettext.h" +#include +#define _(Text) gettext (Text) + +#include "manconfig.h" + + +/* this list is used to authenticate the program running. + * it is fixed at compile time to avoid a full class of + * dangers ... + */ +static struct { + const char *prog; + const char *run; + const char *user; +} *wlp, wrapped_list[] = +{ /* prog run user */ +#ifdef DEBUG + { "_man", "src/man", "man" }, + { "_mandb", "src/mandb", "man" }, +#endif + { "man", "/usr/lib/man-db/man", "man" }, + { "mandb", "/usr/lib/man-db/mandb", "man" }, + { 0, 0, 0, }}; + +char *program_name; + +int main (int argc, char **argv, char *envp[]) +{ + uid_t ruid, euid; + gid_t rgid; + struct passwd *pwd; + + argc = argc; /* not used */ + + /* We don't warn about this setlocale() call failing, as the program + * we call will do that. + */ + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + bindtextdomain (PACKAGE "-gnulib", LOCALEDIR); + textdomain (PACKAGE); + + /* this wrapper can be run as "man" or as "mandb" */ + program_name = base_name (argv[0]); + + ruid = getuid (); + euid = geteuid(); + rgid = getgid (); + +#ifdef DEBUG + printf ("%s:\n", program_name); +#endif + + for (wlp = wrapped_list; wlp->prog && strcmp (program_name, wlp->prog); ++wlp) + /* __asm__ __volatile__("": : :"memory") */; + if (!wlp->prog) { + fprintf (stderr, _("Don't know which program should I run being >%s<\n"), + program_name); + return -ENOENT; + } +#ifdef DEBUG + printf ("%s\n", wlp->run); +#endif + if (ruid == 0 || euid == 0) { + pwd = getpwnam (wlp->user); + if (!pwd) { + fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); + return -EACCES; + } + if (ruid == 0) { + ruid = pwd->pw_uid; + rgid = pwd->pw_gid; + } else { +#ifndef MAN_CATS + /* No permissions required to create files + * under the sub directories of /var/cache/man */ + pwd->pw_uid = ruid; + pwd->pw_gid = rgid; +#endif + } + if (setregid (rgid, pwd->pw_gid)) { + fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); + return -EACCES; + } + if (initgroups (wlp->user, rgid)) { + fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); + return -EACCES; + } + if (setreuid (ruid, pwd->pw_uid)) { + fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user); + return -EACCES; + } + } + execve (wlp->run, argv, envp); + perror ("execve"); + return -errno; +}