Accepting request 137028 from Base:System

- Update to version 2.6.3
  * Build fixes for glibc 2.16 and Automake 1.12.
  * apropos prints an error message and returns non-zero when it finds
    no matches.  (Regression introduced in 2.5.1.)
  * The presence of a 64-bit GDBM database on the manpath no longer
    causes a 32-bit man process to exit with a fatal error.
  * apropos is much faster when run with many arguments.
  * whatis may be given the full path to an executable as an argument,
    in which case it will look up the base name of that executable in
    the appropriate parts of the manpath.
  * Translated manual pages are no longer displayed starting with a
    spurious blank line.
  * Fix double-free in mandb when encountering a symlink outside the
    manual hierarchy, thanks to Peter Schiffer.
  * Running 'man -w' (with a new --path alias) without a name now
    prints the manpath, for compatibility with other man
    implementations.  The vim viewdoc plugin makes use of this.
  * Fix a segfault when scanning links to empty pages.
  * Once we've seen at least one record in a page's NAME section,
    ignore any further records that don't include a whatis
    description, as they tend to be noise.
  * Ensure that the target of a symlink or .so chain is always recorded
    as a real page.
  * Read a user-specified configuration file even if HOME is unset.
  * Fix failure to display manual pages in some encodings when
    installed setuid.
  * Wrap long table cells in man(1), fixing test failures with groff
    1.21.
  * If an explicit section is passed to man, then pages that match
    that section exactly will be preferred over pages that only have

OBS-URL: https://build.opensuse.org/request/show/137028
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/man?expand=0&rev=50
This commit is contained in:
Stephan Kulow 2012-10-07 17:52:19 +00:00 committed by Git OBS Bridge
commit 0f79cbfcb4
22 changed files with 1184 additions and 1744 deletions

View File

@ -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

View File

@ -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

View File

@ -1,32 +0,0 @@
--- src/mandb.c
+++ src/mandb.c 2008-04-21 13:06:01.440910914 +0200
@@ -36,6 +36,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h> /* for chmod() */
+#include <fcntl.h> /* for open () */
#include <dirent.h>
#include <unistd.h>
@@ -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

View File

@ -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 <limits.h> 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

View File

@ -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);

View File

@ -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 */

View File

@ -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 <sys/socket.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# 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. */

View File

@ -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 <unistd.h>
#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;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3da6a5983a3dd1233b45d66cfcc44e787f8cd6cfc77d5b97cb154414ea70a4ca
size 1315763

50
man-db-2.6.3-chinese.dif Normal file
View File

@ -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 */

View File

@ -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);

View File

@ -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)

60
man-db-2.6.3-man0.dif Normal file
View File

@ -0,0 +1,60 @@
--- man/de/man1/man.1
+++ man/de/man1/man.1
@@ -79,6 +79,9 @@ und den Typ der dort zu findenden Seiten
.TS
tab (@);
l lx.
+0@T{
+Dateiheader (gewöhnlich in \fI/usr/include\fR)
+T}
1@T{
Ausführbare Programme oder Shell\-Befehle
T}
--- man/es/man1/man.1
+++ man/es/man1/man.1
@@ -101,6 +101,9 @@ del manual y los tipos de páginas que c
.TS
tab (@);
l lx.
+0@T{
+Ficheros (se encuentran generalmente en \fI/usr/include\fR)
+T}
1@T{
Programas ejecutables y guiones del intérprete de órdenes
T}
--- man/it/man1/man.1
+++ man/it/man1/man.1
@@ -124,6 +124,9 @@ del manuale seguiti dai tipi di pagine c
.TS
tab (@);
l lx.
+0@T{
+File (di solito trovabili in \fI/usr/include\fR)
+T}
1@T{
Programmi eseguibili e comandi della shell
T}
--- man/ja/man1/man.1
+++ man/ja/man1/man.1
@@ -73,6 +73,9 @@ man \- オンラインマニュアルの
.TS
tab (@);
l lx.
+0@T{
+(\fIusr/include\fP)
+T}
1@T{
実行プログラムまたはシェルコマンド
T}
--- man/man1/man.1
+++ man/man1/man.1
@@ -179,6 +179,9 @@ numbers of the manual followed by the ty
.TS
tab (@);
l lx.
+0@T{
+Header files (usually found in \fI/usr/include\fR)
+T}
1@T{
Executable programs or shell commands
T}

View File

@ -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;

View File

@ -0,0 +1,48 @@
--- src/mandb.c
+++ src/mandb.c 2012-10-01 14:30:11.619507260 +0000
@@ -37,6 +37,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h> /* for chmod() */
+#include <fcntl.h> /* for open () */
#include <dirent.h>
#include <unistd.h>
#include <signal.h>
@@ -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);

176
man-db-2.6.3-zio.dif Normal file
View File

@ -0,0 +1,176 @@
--- 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 <linewrap.h> 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,46 @@ 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(lzmadec.h, [
+ for lib in lzma lzmadec
+ do
+ AC_CHECK_LIB($lib, lzmadec_open, [LIBS="$LIBS -Wl,--no-as-needed -l$lib"; break])
+ done
+ ])
+ AC_CHECK_HEADER(lzma.h, [
+ for lib in lzma
+ do
+ AC_CHECK_LIB($lib, lzma_easy_encoder, [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) {
+ const char *opt;
+ 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;

File diff suppressed because it is too large Load Diff

3
man-db-2.6.3.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:51db85cbbdcb99927865bad4c653a8b18991831e751cc501098a772924e26b47
size 1388944

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:67a9fbffb34c693617f7d43cee527acad9610bd30be437069519c326a442724d
size 313

View File

@ -1,3 +1,274 @@
-------------------------------------------------------------------
Thu Oct 4 09:16:16 UTC 2012 - werner@suse.de
- Update to version 2.6.3
* Build fixes for glibc 2.16 and Automake 1.12.
* apropos prints an error message and returns non-zero when it finds
no matches. (Regression introduced in 2.5.1.)
* The presence of a 64-bit GDBM database on the manpath no longer
causes a 32-bit man process to exit with a fatal error.
* apropos is much faster when run with many arguments.
* whatis may be given the full path to an executable as an argument,
in which case it will look up the base name of that executable in
the appropriate parts of the manpath.
* Translated manual pages are no longer displayed starting with a
spurious blank line.
* Fix double-free in mandb when encountering a symlink outside the
manual hierarchy, thanks to Peter Schiffer.
* Running 'man -w' (with a new --path alias) without a name now
prints the manpath, for compatibility with other man
implementations. The vim viewdoc plugin makes use of this.
* Fix a segfault when scanning links to empty pages.
* Once we've seen at least one record in a page's NAME section,
ignore any further records that don't include a whatis
description, as they tend to be noise.
* Ensure that the target of a symlink or .so chain is always recorded
as a real page.
* Read a user-specified configuration file even if HOME is unset.
* Fix failure to display manual pages in some encodings when
installed setuid.
* Wrap long table cells in man(1), fixing test failures with groff
1.21.
* If an explicit section is passed to man, then pages that match
that section exactly will be preferred over pages that only have
that section as a prefix.
* Fix a segfault when 'man -K' tries to display certain pages.
* Fix a segfault in some situations when processes are killed by
SIGHUP, SIGINT, or SIGTERM.
* As promised in the release notes for man-db 2.5.8, man-db no
longer ships its own copy of libpipeline
(http://libpipeline.nongnu.org/). You must build and install that
library separately.
* Search the full manpath when expanding .so directives in manual
pages. As part of this, '.so name.1' should now work as well as
'.so man1/name.1'.
* lexgrog handles roff named glyphs and perldoc strings in NAME
sections.
* man no longer starts a pager if standard output is not a tty.
* The -s option to whatis and apropos now takes a colon- or
comma-separated list of sections, similar to 'man -S'.
* mandb error output is neater when stderr is not a terminal.
* Add basic support for the implementation of nroff/troff in the
Heirloom Documentation Tools. Title lengths are not properly set
as yet, and many features are untested.
* mandb removes cat* and NLS subdirectories of cat directories whose
corresponding man directories no longer exist.
* mandb forces SIGPIPE back to its default disposition on startup,
to avoid noisy output in case it was started in a context where
SIGPIPE was ignored.
* SECTION entries in a user configuration file now override those in
the system configuration file, rather than appending to them.
* The default less prompt now includes "(press h for help or q to
quit)" to help novices find their way around.
* man-db may now be built to use Berkeley DB version 5
(--with-db=db5).
* Fix assertion failure on 'man -l' with an uncompressed page and
any of --no-hyphenation, --no-justification, or a non-English
page.
* Try underscore-separated subpages as well as hyphen-separated
ones, thanks to Tanguy Ortolo.
* Build libman and libmandb as shared libraries, reducing installed
footprint by about 200K (at least on GNU/Linux).
* Warnings about unrecognised locales are now suppressed if the
DPKG_RUNNING_VERSION environment variable is set (i.e. man-db is
running within a Debian package's maintainer script), since the
system locales are often out of sync with the C library in that
context. Thanks to the Debian Perl maintainers for the idea.
* Allow building with an external libpipeline
(http://libpipeline.nongnu.org/), which has been split out from
man-db. This is a transitional measure: a future version of
man-db will stop shipping its own copy of libpipeline.
* mandb should no longer repeatedly rescan manual page hierarchies
when a whatis entry turns into a broken link.
* If a subprocess exits before man manages to read all the output
from it, it now drains the output file descriptor rather than
immediately discarding it.
* If /usr/share/i18n/SUPPORTED is available, man attempts to use it
to ensure that LC_CTYPE is set to an appropriate locale for the
selected character set when invoking col. This fixes 'LANG=C man
-E UTF-8', as used by lintian.
* Fix possible mandb crash when MAN_MUST_CREATE is unset.
* man can now tell nroff to disable justification if the
--no-justification option is used.
* If the full path to an executable is given as an argument, man
will try looking up the corresponding manual page in the
appropriate part of the manpath, rather than just trying to format
the text of the executable as a manual page.
* In the GNU manual hierarchy layout, search man<sec><ext>
directories as well as just man<sec> (e.g. /usr/share/man/man3p as
well as /usr/share/man/man3).
* By request, man now prefers getting a page from the best manual
section over getting a page in the correct language.
* All programs now support a MAN_DEBUG environment variable which
can be used in place of the -d/--debug option. This is useful in
some situations where a program is being called deep in a process
tree.
* Add support for emulating pipe() with socketpair(), which is
faster on some systems; thanks to Werner Fink of SUSE.
* Cat pages are now always saved in UTF-8, and converted to the
proper encoding at display time, which means that cat pages can
now be saved regardless of locale. Note that a consequence of this
is that cat pages now include formatting information (e.g.
overstriking) and need to be run through col(1) before display.
* Exact-section database lookups were incorrectly returning all
database entries whose section names were prefixes of the
requested section name. In some cases this could confuse mandb
into never believing that the database was up to date.
* Fix handling of pages with comma-separated names ("foo, bar,
baz") in their NAME sections, broken by a change in 2.5.0 (!)
to ignore manual page names containing spaces.
* Fixed a buffer overflow in the pipeline library's line-reading
functions. I don't believe this to be exploitable: at worst we
might believe that there's some garbage at the end of manual pages
(whose contents are untrusted anyway) and this bug typically
resulted in a failed assertion the next time anything tried to
read a line.
* Plugged two substantial memory leaks in the pipeline library.
* whatis and apropos only display any given manual page, or pointers
to it, once.
* man now sets less(1)'s environment up correctly for manual pages
encoded in CP1251.
* manconv no longer confuses situations such as "this UTF-8
character is not representable in the target encoding" with "this
text is not in UTF-8".
* The default configuration file now includes section 0, used on
some systems to document C library header files.
* 'make check' now passes in the presence of a UTF-8-aware col, such
as that in util-linux-ng.
* The 'man -K' option is now supported to search the full text of
all manual pages. This was inspired by a similar option in the
other man package (currently at version 1.6f) currently maintained
by Federico Lucifredi and formerly by Andries Brouwer, but I took
advantage of man-db's pipeline library to implement it entirely
in-process, without having to start a separate grep process for
every manual page. In my tests with fairly typical searches across
variously all manual pages or just one section, man-db's
implementation ran between 3 and 10 times faster.
* Database directories are now only created when there are
corresponding manual page directories, not just because they're
mentioned in the configuration file.
* By default, man will now try to interpret pairs of manual page
names given on the command line as equivalent to a single manual
page name containing a hyphen (e.g. 'man foo bar' => foo-bar(1)).
This supports the common pattern of programs that implement a
number of subcommands, allowing them to provide manual pages for
each that can be accessed using similar syntax as would be used to
invoke the subcommands themselves. Suggested by H. Peter Anvin,
Federico Lucifredi, and others on the git mailing list.
* The build process is now quieter by default. Use './configure
--disable-silent-rules' or 'make V=0' if you don't like this or
your make(1) doesn't support the non-standard extension required.
* manconv understands a wider range of Emacs-style coding tags.
* Recommendations to change MAN_DB_CREATES, MAN_DB_UPDATES, and
MAN_CATS #define options in manconfig.h have been replaced by new
configure options --enable-automatic-create,
--disable-automatic-update, and --disable-cats respectively. Note
that automatic user database creation is now off by default, as it
is often too slow for the usefulness it adds; use
--enable-automatic-create to enable it.
* Pages that declare a non-default encoding in their preprocessor
lines are now handled correctly.
* man-db's 'make check' now tests that all its own manual pages
format without errors or warnings from groff, to ensure a
better-quality release.
* lexgrog now stops on any unrecognised roff request, rather than
continuing and often littering the database with garbage.
* man no longer requires both standard input and standard output to
be terminals in order to use the terminal line length. The line
length from standard output is preferred if available.
* The manpath was built completely wrongly when multiple entries
were present in LANGUAGE: duplicates were handled strangely, and
languages were effectively iterated in reverse order. It should be
rather more sensible now.
* The MAN_KEEP_STDERR environment variable can now be used to
override man's default of discarding stderr when stdout is a
terminal.
* Handling of terminal widths for cat pages is now configurable,
using the MINCATWIDTH, MAXCATWIDTH, and CATWIDTH configuration
file directives.
* 'man -a' now detects duplicate manual page candidates more
reliably, and sorts them better.
* Belarusian, Estonian, Greek, Latvian, Lithuanian, Macedonian,
Romanian, Slovenian, and Ukrainian pages are now supported.
* man can now search for pages using regular expressions (with
--regex) or shell wildcards (with --wildcard). By default this
searches both page names and descriptions, like apropos, but if
the --names-only option is used then it searches page names only,
like whatis.
* man can now tell nroff to disable hyphenation if the
--no-hyphenation option is used.
* man-db already searched for manual pages in ../man and man
directories relative to each $PATH component; it now searches in
../share/man and share/man directories too.
* Groff 1.20 was recently released, including the 'preconv'
preprocessor. Although man-db has supported preconv to some extent
since 2.4.4, man-db's configure now detects its presence and
infers that groff supports Unicode input using it; man also now
takes slightly better advantage of preconv than before.
* Per-locale groff macros are now loaded if possible, allowing us to
take advantage of such things as localised versions of predefined
strings and language-aware hyphenation. This only works with Groff
1.20.2 or better (not yet released), since earlier versions did
not allow us to suppress warnings in the event that the
appropriate macro file is not available.
* Cleaned up a number of possible crashes, memory leaks, and missing
error checks found by the Coverity Scan project.
* Fix build if MAN_CATS is undefined.
* If the LINGUAS environment variable is set while running
configure, it now controls building and installation of localised
manual pages as well as program translations.
* The LANGUAGE environment variable is now tokenised properly,
rather than only taking the first two characters of each element.
* Fix build if --disable-nls is used or iconv is not available.
* man now correctly propagates the exit code of whatis or apropos
when called with the -f or -k option respectively.
* A number of inconsistencies and readability problems with man-db's
own manual pages have been cleaned up, thanks mainly to Yuri
Kozlov.
* Reduce the number of warnings emitted when using an unrecognised
locale.
* manconv and zsoelim are now called internally rather than by
executing external programs, to improve performance.
* man-db now uses GDBM (--with-db=gdbm) in preference to Berkeley DB
(--with-db=db or --with-db=dbN where N is 1, 2, 3, or 4) by
default, since hardware improvements have rendered Berkeley DB's
speed advantages negligible for our purposes and the relatively
frequent SONAME and on-disk format changes are not worth the
hassle. Distributors should note that if they follow this change
then they will need to arrange for databases to be rebuilt on
upgrade to this version.
* Duplicate manual page hierarchies due to symlinks (e.g. /usr/man
-> /usr/share/man) are detected and removed from the search order.
* A locale modifier (e.g. @latin) in a directory name must now match
the locale if the former is set, in addition to the language and
territory.
* Bare .so includes (e.g. ".so foo.1" rather than ".so man1/foo.1")
now work, although only within the same manual page hierarchy for
now.
* 'man -H' (without a browser argument) was completely broken in
2.5.1 and is now fixed.
* man no longer breaks in Japanese locales when using less as a
pager.
* The --encoding option to man can now take a true character
encoding rather than a *roff device; the latter was an unreliable,
inflexible, and awkward way to select an output encoding. The old
semantics are still supported for backward compatibility.
* Whatis parsing stops at .ie or .if conditionals.
* CJK locale specifications where the codeset component is
equivalent to but not stringwise-identical to UTF-8 (e.g.
zh_CN.utf8) are handled better.
* man(1)'s OPTIONS section is ordered more comprehensibly.
* apropos, lexgrog, man, mandb, and whatis ignore encoding
conversion errors for the last possible encoding of the source
page. This helps, for example, with pages including misencoded
non-ASCII names of authors; it usually seems better to allow these
pages to pass with small errors than to break them entirely.
-------------------------------------------------------------------
Mon Oct 1 13:13:14 UTC 2012 - werner@suse.de
- Add ChangeLog and COPYING to documentation (bnc #777385)
-------------------------------------------------------------------
Tue Sep 4 13:44:08 UTC 2012 - coolo@suse.com

132
man.spec
View File

@ -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
Patch1: 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,43 +107,40 @@ 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 \
find -name 'Makefile.*' | xargs \
sed -ri -e '/^pkglibdir/{ s@^(pkglibdir[[:blank:]]+=[[:blank:]]+\$\(libdir\)).*@\1@p }'
%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
for man in $(find man/ -type f -a -name '*.[0-9]'); do
pp="$(head -n 1 $man)"
case "$pp" in
\'\\\"*\ -\*-\ coding:\ *\ -\*-)
@ -166,22 +155,32 @@ Authors:
" $man
esac
done
patch -p0 < %{P:1}
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
rm -vf %{buildroot}%{_libdir}/*.la
mv %{buildroot}%{_datadir}/doc/man-db/man-db-manual.* \
%{buildroot}%{_datadir}/doc/packages/man/
# wrapper which drops roots privileges if root executes man or mandb
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/
@ -212,6 +211,9 @@ test -d var/catman/ && rm -rf var/catman/ || true
%files -f man-db.lang
%defattr(-,root,root)
%doc docs/COPYING
%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
@ -228,25 +230,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

138
wrapper.c Normal file
View File

@ -0,0 +1,138 @@
/*
* wrapper.c - wrapper program around man and mandb
*
* Copyright (C) 2000 Fabrizio Polacco <fpolacco@debian.org>
* 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 <string.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <grp.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include "dirname.h"
#include "gettext.h"
#include <locale.h>
#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;
}