Dr. Werner Fink 2015-05-28 13:24:43 +00:00 committed by Git OBS Bridge
parent 4b847985e8
commit bf0c0a0211
9 changed files with 465 additions and 461 deletions

View File

@ -1,40 +0,0 @@
---
src/man.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git src/man.c src/man.c
index 10bcd4f..5c164ad 100644
--- src/man.c
+++ src/man.c
@@ -2316,22 +2316,24 @@ static void format_display (pipeline *decomp,
if (!status)
break;
}
- if (!candidate)
- error (CHILD_FAIL, 0,
- "couldn't execute any browser from %s",
- html_pager);
free (browser_list);
if (chdir (old_cwd) == -1) {
error (0, errno, _("can't change to directory %s"),
old_cwd);
chdir ("/");
}
+ if (!status)
+ sleep(5); /* firefox runs into background to fast */
if (remove_directory (htmldir, 0) == -1)
error (0, errno, _("can't remove directory %s"),
htmldir);
free (htmlfile);
free (htmldir);
free (old_cwd);
+ if (!candidate)
+ error (CHILD_FAIL, 0,
+ "couldn't execute any browser from %s",
+ html_pager);
} else
#endif /* TROFF_IS_GROFF */
/* TODO: check format_cmd status too? */
--
1.8.4.5

View File

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

47
man-db-2.7.1-firefox.dif Normal file
View File

@ -0,0 +1,47 @@
---
src/man.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
--- src/man.c
+++ src/man.c 2015-05-28 10:54:07.961519305 +0000
@@ -1847,16 +1847,6 @@ static void format_display (pipeline *de
if (!status)
break;
}
- if (!candidate) {
- if (html_pager && *html_pager)
- error (CHILD_FAIL, 0,
- "couldn't execute any browser from %s",
- html_pager);
- else
- error (CHILD_FAIL, 0,
- "no browser configured, so cannot show "
- "HTML output");
- }
free (browser_list);
if (have_old_cwd && restore_cwd (&old_cwd) < 0) {
error (0, errno,
@@ -1864,11 +1854,23 @@ static void format_display (pipeline *de
chdir ("/");
}
free_cwd (&old_cwd);
+ if (!status)
+ sleep(5); /* firefox runs into background to fast */
if (remove_directory (htmldir, 0) == -1)
error (0, errno, _("can't remove directory %s"),
htmldir);
free (htmlfile);
free (htmldir);
+ if (!candidate) {
+ if (html_pager && *html_pager)
+ error (CHILD_FAIL, 0,
+ "couldn't execute any browser from %s",
+ html_pager);
+ else
+ error (CHILD_FAIL, 0,
+ "no browser configured, so cannot show "
+ "HTML output");
+ }
} else
#endif /* TROFF_IS_GROFF */
/* TODO: check format_cmd status too? */

View File

@ -2,10 +2,8 @@
src/mandb.c | 12 ++++++++++++ src/mandb.c | 12 ++++++++++++
1 file changed, 12 insertions(+) 1 file changed, 12 insertions(+)
diff --git src/mandb.c src/mandb.c
index 86b9e97..5b8c57d 100644
--- src/mandb.c --- src/mandb.c
+++ src/mandb.c +++ src/mandb.c 2015-05-28 10:43:41.785520616 +0000
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
@ -14,7 +12,7 @@ index 86b9e97..5b8c57d 100644
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
@@ -422,10 +423,19 @@ static int mandb (const char *catpath, const char *manpath) @@ -446,10 +447,19 @@ static int mandb (const char *catpath, c
char *dbname; char *dbname;
char *cachedir_tag; char *cachedir_tag;
struct stat st; struct stat st;
@ -34,22 +32,17 @@ index 86b9e97..5b8c57d 100644
if (!quiet) if (!quiet)
printf (_("Processing manual pages under %s...\n"), manpath); printf (_("Processing manual pages under %s...\n"), manpath);
@@ -433,6 +443,7 @@ static int mandb (const char *catpath, const char *manpath) @@ -458,11 +468,13 @@ static int mandb (const char *catpath, c
if (stat (cachedir_tag, &st) == -1 && errno == ENOENT) { if (stat (cachedir_tag, &st) == -1 && errno == ENOENT) {
FILE *cachedir_tag_file; FILE *cachedir_tag_file;
+ drop_effective_privs (); + drop_effective_privs ();
cachedir_tag_file = fopen (cachedir_tag, "w"); cachedir_tag_file = fopen (cachedir_tag, "w");
if (cachedir_tag_file) { if (cachedir_tag_file) {
fputs ("Signature: 8a477f597d28d172789f06886806bc55\n" fputs (CACHEDIR_TAG, cachedir_tag_file);
@@ -444,6 +455,7 @@ static int mandb (const char *catpath, const char *manpath)
cachedir_tag_file);
fclose (cachedir_tag_file); fclose (cachedir_tag_file);
} }
+ regain_effective_privs (); + regain_effective_privs ();
} }
free (cachedir_tag); free (cachedir_tag);
}
--
1.8.4.5

View File

@ -1,14 +1,12 @@
--- ---
config.h.in | 3 +++ config.h.in | 3 ++
configure.ac | 52 +++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 52 ++++++++++++++++++++++++++++++++++++++++++++
lib/decompress.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/decompress.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 120 insertions(+) 3 files changed, 120 insertions(+)
diff --git config.h.in config.h.in
index efa85da..9a3fcc9 100644
--- config.h.in --- config.h.in
+++ config.h.in +++ config.h.in 2015-05-28 00:00:00.000000000 +0000
@@ -692,6 +692,9 @@ @@ -737,6 +737,9 @@
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ #undef HAVE_LIBZ
@ -18,14 +16,12 @@ index efa85da..9a3fcc9 100644
/* Define to 1 if you have the <linewrap.h> header file. */ /* Define to 1 if you have the <linewrap.h> header file. */
#undef HAVE_LINEWRAP_H #undef HAVE_LINEWRAP_H
diff --git configure.ac configure.ac
index adde408..2daf4a3 100644
--- configure.ac --- configure.ac
+++ configure.ac +++ configure.ac 2015-05-28 11:01:35.689518526 +0000
@@ -98,6 +98,18 @@ AC_ARG_WITH([sections], @@ -35,6 +35,18 @@ MAN_ARG_DEVICE
sections="$withval" MAN_ARG_DB
fi], MAN_ARG_CONFIG_FILE
[: ${sections=1 n l 8 3 2 5 4 9 6 7}]) MAN_ARG_SECTIONS
+AC_ARG_WITH([zio], +AC_ARG_WITH([zio],
+[AS_HELP_STRING([--with-zio=LIBRARY], [use zlib/libbz2 wrapper library LIBRARY (libzio)])], +[AS_HELP_STRING([--with-zio=LIBRARY], [use zlib/libbz2 wrapper library LIBRARY (libzio)])],
+ [if test -z "$withval" -o "$withval" = "yes" + [if test -z "$withval" -o "$withval" = "yes"
@ -38,15 +34,15 @@ index adde408..2daf4a3 100644
+ zio=$withval + zio=$withval
+ fi], + fi],
+ [: ${zio=no}]) + [: ${zio=no}])
AC_ARG_ENABLE([automatic-create], MAN_ARG_AUTOMATIC_CREATE
[AS_HELP_STRING([--enable-automatic-create], [allow man to create user databases on the fly])], MAN_ARG_AUTOMATIC_UPDATE
[if test "$enableval" = "yes" MAN_ARG_CATS
@@ -410,6 +422,46 @@ AC_SUBST([unlzma]) @@ -325,6 +337,46 @@ AC_SUBST([unlzma])
AC_SUBST([unxz]) AC_SUBST([unxz])
AC_SUBST([unlzip]) AC_SUBST([unlzip])
MAN_COMPRESS_LIB([z], [gzopen]) MAN_COMPRESS_LIB([z], [gzopen])
+dnl Check for zlib and libbz2 libraries to use this together +dnl Check for zlib and libbz2 libraries to use this together
+dnl with SuSE's libzio to open compressed info files. +dnl with SUSE's libzio to open compressed info files.
+dnl +dnl
+if test "$zio" = "no" || test -n "$zio" +if test "$zio" = "no" || test -n "$zio"
+then +then
@ -87,11 +83,9 @@ index adde408..2daf4a3 100644
+fi +fi
dnl To add more decompressors just follow the scheme above. dnl To add more decompressors just follow the scheme above.
# Work out which manual page hierarchy scheme might be in use. # Check for various header files and associated libraries.
diff --git lib/decompress.c lib/decompress.c
index a176a9d..0057e39 100644
--- lib/decompress.c --- lib/decompress.c
+++ lib/decompress.c +++ lib/decompress.c 2015-05-28 00:00:00.000000000 +0000
@@ -38,6 +38,10 @@ @@ -38,6 +38,10 @@
#include "xvasprintf.h" #include "xvasprintf.h"
@ -103,7 +97,7 @@ index a176a9d..0057e39 100644
#include "manconfig.h" #include "manconfig.h"
#include "comp_src.h" #include "comp_src.h"
#include "pipeline.h" #include "pipeline.h"
@@ -68,6 +72,32 @@ static void decompress_zlib (void *data ATTRIBUTE_UNUSED) @@ -68,6 +72,32 @@ static void decompress_zlib (void *data
#endif /* HAVE_LIBZ */ #endif /* HAVE_LIBZ */
@ -136,7 +130,7 @@ index a176a9d..0057e39 100644
pipeline *decompress_open (const char *filename) pipeline *decompress_open (const char *filename)
{ {
pipecmd *cmd; pipecmd *cmd;
@@ -82,6 +112,37 @@ pipeline *decompress_open (const char *filename) @@ -82,6 +112,37 @@ pipeline *decompress_open (const char *f
if (stat (filename, &st) < 0 || S_ISDIR (st.st_mode)) if (stat (filename, &st) < 0 || S_ISDIR (st.st_mode))
return NULL; return NULL;
@ -174,7 +168,7 @@ index a176a9d..0057e39 100644
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
filename_len = strlen (filename); filename_len = strlen (filename);
if (filename_len > 3 && STREQ (filename + filename_len - 3, ".gz")) { if (filename_len > 3 && STREQ (filename + filename_len - 3, ".gz")) {
@@ -95,7 +156,11 @@ pipeline *decompress_open (const char *filename) @@ -95,7 +156,11 @@ pipeline *decompress_open (const char *f
} }
#endif /* HAVE_LIBZ */ #endif /* HAVE_LIBZ */
@ -186,6 +180,3 @@ index a176a9d..0057e39 100644
if (ext) { if (ext) {
++ext; ++ext;
--
1.8.4.5

View File

@ -1,28 +1,25 @@
--- ---
configure.ac | 18 ++++++- configure.ac | 18 +++++-
include/comp_src.h.in | 2 +- include/comp_src.h.in | 2
lib/security.c | 36 +++++++++++++ lib/security.c | 36 ++++++++++++
lib/util.c | 3 ++ lib/util.c | 3 +
libdb/mydbm.h | 4 +- libdb/mydbm.h | 4 -
mk_catdirs | 30 +++++++++++ mk_catdirs | 30 ++++++++++
src/Makefile.am | 12 ++--- src/Makefile.am | 12 +---
src/check_mandirs.c | 48 ++++++++++++----- src/check_mandirs.c | 43 ++++++++++----
src/lexgrog.l | 121 ++++++++++++++++++++++++++++------------- src/lexgrog.l | 121 ++++++++++++++++++++++++++++-------------
src/man.c | 115 ++++++++++++++++++++++++++------------- src/man.c | 109 ++++++++++++++++++++++++++-----------
src/man_db.conf.in | 145 +++++++++++++++++++++++++++++++++++++++++++++++--- src/man_db.conf.in | 145 +++++++++++++++++++++++++++++++++++++++++++++++---
src/mandb.c | 18 +++++-- src/mandb.c | 18 +++++-
src/manp.c | 2 +- src/manp.c | 2
src/straycats.c | 13 +++-- src/straycats.c | 19 ++++--
src/ult_src.c | 9 +++- src/ult_src.c | 9 ++-
src/ult_src.h | 7 +-- src/ult_src.h | 7 +-
16 files changed, 460 insertions(+), 123 deletions(-) 16 files changed, 459 insertions(+), 119 deletions(-)
create mode 100644 mk_catdirs
diff --git configure.ac configure.ac
index 2daf4a3..34ce06e 100644
--- configure.ac --- configure.ac
+++ configure.ac +++ configure.ac 2015-05-28 00:00:00.000000000 +0000
@@ -333,6 +333,14 @@ then @@ -248,6 +248,14 @@ then
fi fi
MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn]) MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
@ -37,7 +34,7 @@ index 2daf4a3..34ce06e 100644
MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn]) 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 # 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 # ascii device. As this is only relevant for equations (?), not using latin1
@@ -376,9 +384,15 @@ then @@ -291,9 +299,15 @@ then
compress_ext="gz" compress_ext="gz"
fi fi
MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress]) MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
@ -55,10 +52,8 @@ index 2daf4a3..34ce06e 100644
if test -z "$gzip" if test -z "$gzip"
then then
compressor="$compress -c" compressor="$compress -c"
diff --git include/comp_src.h.in include/comp_src.h.in
index 4d6b0e7..7c865e8 100644
--- include/comp_src.h.in --- include/comp_src.h.in
+++ include/comp_src.h.in +++ include/comp_src.h.in 2015-05-28 00:00:00.000000000 +0000
@@ -53,7 +53,7 @@ struct compression comp_list[] = { @@ -53,7 +53,7 @@ struct compression comp_list[] = {
#endif /* HAVE_GZIP */ #endif /* HAVE_GZIP */
@ -68,10 +63,8 @@ index 4d6b0e7..7c865e8 100644
{UNCOMPRESS, "Z", NULL}, {UNCOMPRESS, "Z", NULL},
/* Else if we have gzip, incorporate the following */ /* Else if we have gzip, incorporate the following */
#elif defined (HAVE_GZIP) #elif defined (HAVE_GZIP)
diff --git lib/security.c lib/security.c
index dd2e221..37d0ca7 100644
--- lib/security.c --- lib/security.c
+++ lib/security.c +++ lib/security.c 2015-05-28 00:00:00.000000000 +0000
@@ -60,7 +60,10 @@ @@ -60,7 +60,10 @@
uid_t ruid; /* initial real user id */ uid_t ruid; /* initial real user id */
@ -134,11 +127,9 @@ index dd2e221..37d0ca7 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
} }
diff --git lib/util.c lib/util.c
index 978a16e..3dcf336 100644
--- lib/util.c --- lib/util.c
+++ lib/util.c +++ lib/util.c 2015-05-28 00:00:00.000000000 +0000
@@ -48,6 +48,9 @@ @@ -50,6 +50,9 @@
#include "gettext.h" #include "gettext.h"
@ -148,11 +139,9 @@ index 978a16e..3dcf336 100644
#include "manconfig.h" #include "manconfig.h"
#include "error.h" #include "error.h"
diff --git libdb/mydbm.h libdb/mydbm.h
index f0c4784..3538ed4 100644
--- libdb/mydbm.h --- libdb/mydbm.h
+++ libdb/mydbm.h +++ libdb/mydbm.h 2015-05-28 00:00:00.000000000 +0000
@@ -42,7 +42,7 @@ @@ -44,7 +44,7 @@
# include <gdbm.h> # include <gdbm.h>
# ifndef HAVE_GDBM_EXISTS # ifndef HAVE_GDBM_EXISTS
@ -161,7 +150,7 @@ index f0c4784..3538ed4 100644
# endif /* !HAVE_GDBM_EXISTS */ # endif /* !HAVE_GDBM_EXISTS */
/* gdbm_nextkey() is not lexicographically sorted, so we need to keep the /* gdbm_nextkey() is not lexicographically sorted, so we need to keep the
@@ -144,7 +144,7 @@ extern int btree_nextkeydata(DB *db, datum *key, datum *cont); @@ -156,7 +156,7 @@ extern void btree_set_time(DB *db, const
# define MYDBM_SET_DPTR(d, value) ((d).data = (char *) (value)) # define MYDBM_SET_DPTR(d, value) ((d).data = (char *) (value))
# define MYDBM_DSIZE(d) ((d).size) # define MYDBM_DSIZE(d) ((d).size)
# define MYDBM_CTRWOPEN(file) btree_flopen(file, O_TRUNC|O_CREAT|O_RDWR, DBMODE) # define MYDBM_CTRWOPEN(file) btree_flopen(file, O_TRUNC|O_CREAT|O_RDWR, DBMODE)
@ -170,11 +159,8 @@ index f0c4784..3538ed4 100644
# define MYDBM_RWOPEN(file) btree_flopen(file, O_RDWR, DBMODE) # define MYDBM_RWOPEN(file) btree_flopen(file, O_RDWR, DBMODE)
# define MYDBM_RDOPEN(file) btree_flopen(file, O_RDONLY, DBMODE) # define MYDBM_RDOPEN(file) btree_flopen(file, O_RDONLY, DBMODE)
# define MYDBM_INSERT(db, key, cont) btree_insert(db, key, cont) # define MYDBM_INSERT(db, key, cont) btree_insert(db, key, cont)
diff --git mk_catdirs mk_catdirs --- mk_catdirs
new file mode 100644 +++ mk_catdirs 2015-05-28 00:00:00.000000000 +0000
index 0000000..47eaa25
--- /dev/null
+++ mk_catdirs
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
+#!/bin/sh +#!/bin/sh
+ +
@ -206,11 +192,9 @@ index 0000000..47eaa25
+cd ${OLDPWD} +cd ${OLDPWD}
+ +
+test "$(id -u)" -ne 0 || chown man:man -R ${CACHE} +test "$(id -u)" -ne 0 || chown man:man -R ${CACHE}
diff --git src/Makefile.am src/Makefile.am
index 51118a1..0003cbc 100644
--- src/Makefile.am --- src/Makefile.am
+++ src/Makefile.am +++ src/Makefile.am 2015-05-28 00:00:00.000000000 +0000
@@ -177,15 +177,9 @@ apropos$(EXEEXT): whatis$(EXEEXT) @@ -173,15 +173,9 @@ apropos$(EXEEXT): whatis$(EXEEXT)
all-am: apropos$(EXEEXT) all-am: apropos$(EXEEXT)
install-exec-hook: install-exec-hook:
@ -229,11 +213,9 @@ index 51118a1..0003cbc 100644
install-data-hook: install-data-hook:
@if test -f $(DESTDIR)$(config_file); then \ @if test -f $(DESTDIR)$(config_file); then \
diff --git src/check_mandirs.c src/check_mandirs.c
index f954dbf..f9d6314 100644
--- src/check_mandirs.c --- src/check_mandirs.c
+++ src/check_mandirs.c +++ src/check_mandirs.c 2015-05-28 00:00:00.000000000 +0000
@@ -354,10 +354,13 @@ static inline void add_dir_entries (const char *path, char *infile) @@ -362,10 +362,13 @@ static inline void add_dir_entries (cons
#ifdef SECURE_MAN_UID #ifdef SECURE_MAN_UID
extern uid_t ruid; /* initial real user id */ extern uid_t ruid; /* initial real user id */
@ -248,7 +230,7 @@ index f954dbf..f9d6314 100644
{ {
char *manname, *catname; char *manname, *catname;
#ifdef SECURE_MAN_UID #ifdef SECURE_MAN_UID
@@ -381,6 +384,8 @@ static void mkcatdirs (const char *mandir, const char *catdir) @@ -389,6 +392,8 @@ static void mkcatdirs (const char *mandi
#ifdef SECURE_MAN_UID #ifdef SECURE_MAN_UID
if (ruid == 0) if (ruid == 0)
chown (catdir, man_owner->pw_uid, 0); chown (catdir, man_owner->pw_uid, 0);
@ -257,7 +239,7 @@ index f954dbf..f9d6314 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
drop_effective_privs (); drop_effective_privs ();
} }
@@ -391,9 +396,14 @@ static void mkcatdirs (const char *mandir, const char *catdir) @@ -399,9 +404,14 @@ static void mkcatdirs (const char *mandi
int j; int j;
regain_effective_privs (); regain_effective_privs ();
debug ("creating catdir hierarchy %s ", catdir); debug ("creating catdir hierarchy %s ", catdir);
@ -275,7 +257,7 @@ index f954dbf..f9d6314 100644
if ((is_directory (manname) == 1) if ((is_directory (manname) == 1)
&& (is_directory (catname) != 1)) { && (is_directory (catname) != 1)) {
if (mkdir (catname, if (mkdir (catname,
@@ -402,11 +412,12 @@ static void mkcatdirs (const char *mandir, const char *catdir) @@ -410,11 +420,12 @@ static void mkcatdirs (const char *mandi
error (0, 0, _("warning: cannot create catdir %s"), catname); error (0, 0, _("warning: cannot create catdir %s"), catname);
debug ("warning: cannot create catdir %s\n", catname); debug ("warning: cannot create catdir %s\n", catname);
} else } else
@ -291,7 +273,7 @@ index f954dbf..f9d6314 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
} }
} }
@@ -505,15 +516,10 @@ static int testmandirs (const char *path, const char *catpath, time_t last, @@ -523,15 +534,10 @@ static int testmandirs (const char *path
} }
if (!quiet) { if (!quiet) {
@ -308,7 +290,7 @@ index f954dbf..f9d6314 100644
} }
add_dir_entries (path, mandir->d_name); add_dir_entries (path, mandir->d_name);
MYDBM_CLOSE (dbf); MYDBM_CLOSE (dbf);
@@ -681,7 +687,7 @@ int update_db (const char *manpath, const char *catpath) @@ -651,7 +657,7 @@ int update_db (const char *manpath, cons
return new; return new;
} }
@ -317,7 +299,7 @@ index f954dbf..f9d6314 100644
return EOF; return EOF;
} }
@@ -863,6 +869,7 @@ static int purge_whatis (const char *path, int cat, const char *name, @@ -843,6 +849,7 @@ static int purge_whatis (const char *pat
"would delete\n", name, info->ext); "would delete\n", name, info->ext);
return 1; return 1;
} }
@ -325,22 +307,11 @@ index f954dbf..f9d6314 100644
} }
/* Check that multi keys are correctly constructed. */ /* Check that multi keys are correctly constructed. */
@@ -937,6 +944,11 @@ int purge_missing (const char *manpath, const char *catpath) @@ -941,6 +948,14 @@ int purge_missing (const char *manpath,
gripe_rwopen_failed (); key = nextkey;
return 0;
}
+ if (dbver_rd (dbf)) {
+ MYDBM_CLOSE (dbf);
+ dbf = NULL;
+ return 0;
+ }
/* Extract the database mtime. */
key = MYDBM_FIRSTKEY (dbf);
@@ -978,6 +990,14 @@ int purge_missing (const char *manpath, const char *catpath)
continue; continue;
} }
+
+ /* Ignore db identifier keys. */ + /* Ignore db identifier keys. */
+ if (*key.dptr == '.' && *(key.dptr+1) == 0) { + if (*key.dptr == '.' && *(key.dptr+1) == 0) {
+ nextkey = MYDBM_NEXTKEY (dbf, key); + nextkey = MYDBM_NEXTKEY (dbf, key);
@ -348,15 +319,12 @@ index f954dbf..f9d6314 100644
+ key = nextkey; + key = nextkey;
+ continue; + continue;
+ } + }
+
content = MYDBM_FETCH (dbf, key); content = MYDBM_FETCH (dbf, key);
if (!MYDBM_DPTR (content)) { if (!MYDBM_DPTR (content)) {
nextkey = MYDBM_NEXTKEY (dbf, key);
diff --git src/lexgrog.l src/lexgrog.l
index 18c5a5b..9e5fc16 100644
--- src/lexgrog.l --- src/lexgrog.l
+++ src/lexgrog.l +++ src/lexgrog.l 2015-05-28 11:06:00.000000000 +0000
@@ -56,7 +56,7 @@ @@ -54,7 +54,7 @@
#include "manconv_client.h" #include "manconv_client.h"
@ -364,8 +332,8 @@ index 18c5a5b..9e5fc16 100644
+#define YY_READ_BUF_SIZE YY_BUF_SIZE +#define YY_READ_BUF_SIZE YY_BUF_SIZE
#define MAX_NAME 8192 #define MAX_NAME 8192
#ifdef PROFILE #define ARRAY_SIZE(array) (sizeof (array) / sizeof ((array)[0]))
@@ -207,15 +207,15 @@ static const struct macro perldocs[] = { @@ -200,15 +200,15 @@ static const struct macro perldocs[] = {
{ "R\"", "\"" } { "R\"", "\"" }
}; };
@ -390,7 +358,7 @@ index 18c5a5b..9e5fc16 100644
static char newname[MAX_NAME]; static char newname[MAX_NAME];
static char *p_name; static char *p_name;
@@ -224,6 +224,7 @@ static char filters[MAX_FILTERS]; @@ -217,6 +217,7 @@ static char filters[MAX_FILTERS];
static int fill_mode; static int fill_mode;
static int waiting_for_quote; static int waiting_for_quote;
@ -398,7 +366,7 @@ index 18c5a5b..9e5fc16 100644
static pipeline *decomp; static pipeline *decomp;
@@ -241,7 +242,7 @@ static pipeline *decomp; @@ -234,7 +235,7 @@ static pipeline *decomp;
%} %}
%option ecs meta-ecs %option ecs meta-ecs
@ -407,7 +375,7 @@ index 18c5a5b..9e5fc16 100644
%option nostdinit %option nostdinit
%option warn %option warn
%option noyywrap nounput %option noyywrap nounput
@@ -279,8 +280,9 @@ font_change \\f([[:upper:]1-4]|\({upper}{2}) @@ -272,8 +273,9 @@ font_change \\f([[:upper:]1-4]|\({upper}
size_change \\s[+-]?{digit} size_change \\s[+-]?{digit}
style_change ({font_change}{size_change}?|{size_change}{font_change}?) style_change ({font_change}{size_change}?|{size_change}{font_change}?)
typeface \.(B[IR]?|I[BR]?|R[BI]|S[BM]) typeface \.(B[IR]?|I[BR]?|R[BI]|S[BM])
@ -418,7 +386,7 @@ index 18c5a5b..9e5fc16 100644
/* Please add to this list if you know how. */ /* Please add to this list if you know how. */
/* Note that, since flex only supports UTF-8 by accident, character classes /* Note that, since flex only supports UTF-8 by accident, character classes
@@ -315,7 +317,26 @@ vi_name TÊN @@ -308,7 +310,26 @@ vi_name TÊN
zh_CN_name 名{blank}?(称|字){blank}?.* zh_CN_name 名{blank}?(称|字){blank}?.*
zh_TW_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 ({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})
@ -446,7 +414,7 @@ index 18c5a5b..9e5fc16 100644
/* eptgrv : eqn, pic, tbl, grap, refer, vgrind */ /* eptgrv : eqn, pic, tbl, grap, refer, vgrind */
tbl_request \.TS tbl_request \.TS
@@ -329,8 +350,13 @@ vgrind_request \.vS @@ -322,8 +343,13 @@ vgrind_request \.vS
%% %%
/* begin NAME section processing */ /* begin NAME section processing */
@ -462,7 +430,7 @@ index 18c5a5b..9e5fc16 100644
/* general text matching */ /* general text matching */
<MAN_FILE>\.[^Ss\r\n].* | <MAN_FILE>\.[^Ss\r\n].* |
@@ -398,6 +424,7 @@ vgrind_request \.vS @@ -391,6 +417,7 @@ vgrind_request \.vS
<MAN_NAME>{bol}\.sp{blank}* | /* vertical spacing */ <MAN_NAME>{bol}\.sp{blank}* | /* vertical spacing */
<MAN_NAME>{bol}\.ig{blank}* | /* block comment */ <MAN_NAME>{bol}\.ig{blank}* | /* block comment */
<MAN_NAME>{bol}\.de[1i]?{blank}* | /* macro definition */ <MAN_NAME>{bol}\.de[1i]?{blank}* | /* macro definition */
@ -470,7 +438,7 @@ index 18c5a5b..9e5fc16 100644
<MAN_NAME>{bol}\.i[ef]{blank}* | /* conditional */ <MAN_NAME>{bol}\.i[ef]{blank}* | /* conditional */
<MAN_NAME>{empty}{bol}.+ | <MAN_NAME>{empty}{bol}.+ |
<MAN_NAME><<EOF>> { /* terminate the string */ <MAN_NAME><<EOF>> { /* terminate the string */
@@ -435,21 +462,24 @@ vgrind_request \.vS @@ -428,21 +455,24 @@ vgrind_request \.vS
} }
/* No-op requests */ /* No-op requests */
@ -500,7 +468,7 @@ index 18c5a5b..9e5fc16 100644
/* escape sequences and special characters */ /* escape sequences and special characters */
<MAN_NAME>{ <MAN_NAME>{
@@ -465,6 +495,7 @@ vgrind_request \.vS @@ -458,6 +488,7 @@ vgrind_request \.vS
{next}\\[|^&!%acdpruz{}\r\n] /* various useless control chars */ {next}\\[|^&!%acdpruz{}\r\n] /* various useless control chars */
{next}\\[bhlLvx]{blank}*'[^']+' /* various inline functions */ {next}\\[bhlLvx]{blank}*'[^']+' /* various inline functions */
@ -508,7 +476,7 @@ index 18c5a5b..9e5fc16 100644
{next}\\\$[1-9] /* interpolate arg */ {next}\\\$[1-9] /* interpolate arg */
/* roff named glyphs */ /* roff named glyphs */
@@ -627,11 +658,8 @@ vgrind_request \.vS @@ -620,11 +651,8 @@ vgrind_request \.vS
for later processing */ for later processing */
<MAN_NAME>{ <MAN_NAME>{
{bol}\.br{blank}* | {bol}\.br{blank}* |
@ -521,7 +489,7 @@ index 18c5a5b..9e5fc16 100644
{bol}\.RS{blank}.* | {bol}\.RS{blank}.* |
{bol}\.RE{blank}.* add_char_to_whatis ((char) 0x11); {bol}\.RE{blank}.* add_char_to_whatis ((char) 0x11);
} }
@@ -646,7 +674,7 @@ vgrind_request \.vS @@ -639,7 +667,7 @@ vgrind_request \.vS
<MAN_NAME>[[:alnum:]]* add_str_to_whatis (yytext, yyleng); <MAN_NAME>[[:alnum:]]* add_str_to_whatis (yytext, yyleng);
/* normalise the period (,) separators */ /* normalise the period (,) separators */
@ -530,7 +498,7 @@ index 18c5a5b..9e5fc16 100644
<MAN_NAME>{blank}*,{blank}* add_str_to_whatis (", ", 2); <MAN_NAME>{blank}*,{blank}* add_str_to_whatis (", ", 2);
<CAT_NAME,MAN_NAME>{bol}. { <CAT_NAME,MAN_NAME>{bol}. {
@@ -662,7 +690,7 @@ vgrind_request \.vS @@ -655,7 +683,7 @@ vgrind_request \.vS
%% %%
/* print warning and force scanner to terminate */ /* print warning and force scanner to terminate */
@ -539,7 +507,7 @@ index 18c5a5b..9e5fc16 100644
{ {
/* Even though MAX_NAME is a macro expanding to a constant, we /* Even though MAX_NAME is a macro expanding to a constant, we
* translate it using ngettext anyway because that will make it * translate it using ngettext anyway because that will make it
@@ -679,7 +707,7 @@ static void too_big (void) @@ -672,7 +700,7 @@ static void too_big (void)
} }
/* append a string to newname if enough room */ /* append a string to newname if enough room */
@ -548,7 +516,7 @@ index 18c5a5b..9e5fc16 100644
{ {
if (p_name - newname + length >= MAX_NAME) if (p_name - newname + length >= MAX_NAME)
too_big (); too_big ();
@@ -690,8 +718,10 @@ static void add_str_to_whatis (const char *string, size_t length) @@ -683,8 +711,10 @@ static void add_str_to_whatis (const cha
} }
/* append a char to newname if enough room */ /* append a char to newname if enough room */
@ -560,7 +528,7 @@ index 18c5a5b..9e5fc16 100644
if (p_name - newname + 1 >= MAX_NAME) if (p_name - newname + 1 >= MAX_NAME)
too_big (); too_big ();
else if (waiting_for_quote && c == '"') else if (waiting_for_quote && c == '"')
@@ -703,8 +733,24 @@ static void add_char_to_whatis (unsigned char c) @@ -696,8 +726,24 @@ static void add_char_to_whatis (unsigned
/* append the " - " separator to newname, trimming the first space if one's /* append the " - " separator to newname, trimming the first space if one's
* already there * already there
*/ */
@ -586,7 +554,7 @@ index 18c5a5b..9e5fc16 100644
if (p_name != newname && *(p_name - 1) != ' ') if (p_name != newname && *(p_name - 1) != ' ')
add_char_to_whatis (' '); add_char_to_whatis (' ');
add_str_to_whatis ("- ", 2); add_str_to_whatis ("- ", 2);
@@ -712,7 +758,7 @@ static void add_separator_to_whatis (void) @@ -705,7 +751,7 @@ static void add_separator_to_whatis (voi
/* append a word to newname if enough room, ensuring only necessary /* append a word to newname if enough room, ensuring only necessary
surrounding space */ surrounding space */
@ -595,7 +563,7 @@ index 18c5a5b..9e5fc16 100644
{ {
if (p_name != newname && *(p_name - 1) != ' ') if (p_name != newname && *(p_name - 1) != ' ')
add_char_to_whatis (' '); add_char_to_whatis (' ');
@@ -722,7 +768,7 @@ static void add_wordn_to_whatis (const char *string, size_t length) @@ -715,7 +761,7 @@ static void add_wordn_to_whatis (const c
add_str_to_whatis (string, length); add_str_to_whatis (string, length);
} }
@ -604,7 +572,7 @@ index 18c5a5b..9e5fc16 100644
{ {
add_wordn_to_whatis (string, strlen (string)); add_wordn_to_whatis (string, strlen (string));
} }
@@ -732,7 +778,7 @@ struct compare_macro_key { @@ -725,7 +771,7 @@ struct compare_macro_key {
size_t length; size_t length;
}; };
@ -613,7 +581,7 @@ index 18c5a5b..9e5fc16 100644
{ {
const struct compare_macro_key *key = left; const struct compare_macro_key *key = left;
const struct macro *value = right; const struct macro *value = right;
@@ -750,7 +796,7 @@ static int compare_macro (const void *left, const void *right) @@ -743,7 +789,7 @@ static int compare_macro (const void *le
return 0; return 0;
} }
@ -622,7 +590,7 @@ index 18c5a5b..9e5fc16 100644
const char *string, size_t length) const char *string, size_t length)
{ {
struct compare_macro_key key; struct compare_macro_key key;
@@ -764,23 +810,23 @@ static void add_macro_to_whatis (const struct macro *macros, size_t n_macros, @@ -757,23 +803,23 @@ static void add_macro_to_whatis (const s
add_str_to_whatis (macro->value, strlen (macro->value)); add_str_to_whatis (macro->value, strlen (macro->value));
} }
@ -650,7 +618,7 @@ index 18c5a5b..9e5fc16 100644
{ {
/* If we are mid p_name and the last added char was not a space, /* If we are mid p_name and the last added char was not a space,
* best add one. * best add one.
@@ -856,6 +902,7 @@ int find_name_decompressed (pipeline *p, const char *filename, lexgrog *p_lg) @@ -851,6 +897,7 @@ int find_name_decompressed (pipeline *p,
fill_mode = 1; fill_mode = 1;
waiting_for_quote = 0; waiting_for_quote = 0;
@ -658,19 +626,17 @@ index 18c5a5b..9e5fc16 100644
if (p_lg->type) if (p_lg->type)
BEGIN (CAT_FILE); BEGIN (CAT_FILE);
diff --git src/man.c src/man.c
index 4715efb..edcd59c 100644
--- src/man.c --- src/man.c
+++ src/man.c +++ src/man.c 2015-05-28 12:30:03.846019151 +0000
@@ -68,6 +68,7 @@ static char *cwd; @@ -68,6 +68,7 @@ int have_cwd;
#include <utime.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
+#include <sys/time.h> +#include <sys/time.h>
#include "argp.h" #include "argp.h"
#include "dirname.h" #include "dirname.h"
@@ -110,6 +111,8 @@ static char *cwd; @@ -111,6 +112,8 @@ int have_cwd;
#ifdef SECURE_MAN_UID #ifdef SECURE_MAN_UID
extern uid_t ruid; extern uid_t ruid;
extern uid_t euid; extern uid_t euid;
@ -679,7 +645,7 @@ index 4715efb..edcd59c 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
/* the default preprocessor sequence */ /* the default preprocessor sequence */
@@ -140,6 +143,10 @@ char *lang; @@ -141,6 +144,10 @@ char *lang;
static int global_manpath = -1; /* global or user manual page hierarchy? */ static int global_manpath = -1; /* global or user manual page hierarchy? */
static int skip; /* page exists but has been skipped */ static int skip; /* page exists but has been skipped */
@ -690,18 +656,19 @@ index 4715efb..edcd59c 100644
#if defined _AIX || defined __sgi #if defined _AIX || defined __sgi
char **global_argv; char **global_argv;
@@ -244,9 +251,9 @@ static int found_a_stray; /* found a straycat */ @@ -245,10 +252,10 @@ static int found_a_stray; /* found a st
#ifdef MAN_CATS #ifdef MAN_CATS
static char *tmp_cat_file; /* for open_cat_stream(), close_cat_stream() */ static char *tmp_cat_file; /* for open_cat_stream(), close_cat_stream() */
static int created_tmp_cat; /* dto. */ static int created_tmp_cat; /* dto. */
-#endif -#endif
static int tmp_cat_fd; static int tmp_cat_fd;
static int man_modtime; /* modtime of man page, for commit_tmp_cat() */ static struct timespec man_modtime; /* modtime of man page, for
+#endif /* MAN_CATS */ * commit_tmp_cat() */
+#endif
# ifdef TROFF_IS_GROFF # ifdef TROFF_IS_GROFF
static int ditroff; static int ditroff;
@@ -611,25 +618,6 @@ static void gripe_no_name (const char *sect) @@ -613,25 +620,6 @@ static void gripe_no_name (const char *s
exit (FAIL); exit (FAIL);
} }
@ -727,18 +694,152 @@ index 4715efb..edcd59c 100644
#if defined(TROFF_IS_GROFF) || defined(HEIRLOOM_NROFF) #if defined(TROFF_IS_GROFF) || defined(HEIRLOOM_NROFF)
static int get_roff_line_length (void) static int get_roff_line_length (void)
{ {
@@ -916,30 +904,43 @@ static int local_man_loop (const char *argv) @@ -1454,6 +1442,18 @@ static void setenv_less (pipecmd *cmd, c
free (less_opts);
}
+static void disable_x(void)
+{
+ char *bname = basename((char*)pager);
+ if (bname) {
+ if (!strcmp(bname, "less"))
+ unsetenv("DISPLAY");
+#if 0
+ free(bname);
+#endif
+ }
+}
+
static void add_output_iconv (pipeline *p,
const char *source, const char *target)
{
@@ -1513,6 +1513,8 @@ static pipeline *make_display_command (c
else
pipecmd_chdir (pager_cmd, cwd.name);
setenv_less (pager_cmd, title);
+ if (!htmlout)
+ disable_x();
pipeline_command (p, pager_cmd);
}
pipeline_ignore_signals (p, 1);
@@ -1523,7 +1525,7 @@ static pipeline *make_display_command (c
return p;
}
-
+#ifdef MAN_CATS
/* return a (malloced) temporary name in cat_file's directory */
static char *tmp_cat_filename (const char *cat_file)
{
@@ -1551,7 +1553,6 @@ static char *tmp_cat_filename (const cha
return name;
}
-
/* If delete unlink tmp_cat, else commit tmp_cat to cat_file.
Return non-zero on error.
*/
@@ -1623,6 +1624,7 @@ static int commit_tmp_cat (const char *c
return status;
}
+#endif /* MAN_CATS */
/* TODO: This should all be refactored after work on the decompression
* library is complete.
@@ -1643,7 +1645,6 @@ static void maybe_discard_stderr (pipeli
}
#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)
{
@@ -1880,6 +1881,7 @@ static void format_display (pipeline *de
regain_effective_privs ();
}
+#ifdef MAN_CATS
/* "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,
@@ -1919,6 +1921,7 @@ static void display_catman (const char *
pop_cleanup();
free (tmpcat);
}
+#endif /* MAN_CATS */
static void disable_hyphenation (void *data ATTRIBUTE_UNUSED)
{
@@ -2111,7 +2114,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;
@@ -2121,7 +2124,7 @@ static int display (const char *dir, con
} else
man_modtime = get_stat_mtime (&stb);
}
-
+#endif /* MAN_CATS */
display_to_stdout = troff;
#ifdef TROFF_IS_GROFF
if (htmlout)
@@ -2257,6 +2260,7 @@ static int display (const char *dir, con
}
if (printed)
putchar ('\n');
+#ifdef MAN_CATS
} else if (catman) {
if (format) {
if (!save_cat)
@@ -2269,6 +2273,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;
@@ -2330,8 +2335,10 @@ static int display (const char *dir, con
free (formatted_encoding);
- pipeline_free (format_cmd);
- pipeline_free (decomp);
+ if (format_cmd)
+ pipeline_free (format_cmd);
+ if (decomp)
+ pipeline_free (decomp);
if (!prompt)
prompt = found;
@@ -3165,7 +3172,7 @@ static int display_database_check (struc
#ifdef MAN_DB_UPDATES
if (!exists && !skip) {
debug ("dbdelete_wrapper (%s, %p)\n",
- candp->req_name, candp->source);
+ candp->req_name, candp->source->addr);
dbdelete_wrapper (candp->req_name, candp->source);
}
#endif /* MAN_DB_UPDATES */
@@ -3768,6 +3775,8 @@ static int local_man_loop (const char *a
display (NULL, "", NULL, "(stdin)", NULL); display (NULL, "", NULL, "(stdin)", NULL);
else { else {
struct stat st; struct stat st;
- + char *file = base_name((char*)argv);
- if (cwd[0]) { + char *pwd = NULL;
- debug ("chdir %s\n", cwd);
- if (chdir (cwd)) { if (have_cwd) {
- error (0, errno, _("can't chdir to %s"), cwd); debug ("restore_cwd: %d %s\n", cwd.desc, cwd.name);
+ char *pwd = cwd; @@ -3779,21 +3788,39 @@ static int local_man_loop (const char *a
+ char *file = basename((char*)argv); return 0;
+ }
}
+ if (strcmp(argv, file)) { + if (strcmp(argv, file)) {
+ char *dlm; + char *dlm;
+ pwd = strdupa(argv); + pwd = strdupa(argv);
@ -746,15 +847,14 @@ index 4715efb..edcd59c 100644
+ if ((dlm = strrchr(pwd, '/'))) + if ((dlm = strrchr(pwd, '/')))
+ *dlm = '\0'; + *dlm = '\0';
+ } + }
+ + if (pwd && pwd[0]) {
+ if (pwd[0]) {
+ debug ("chdir %s\n", pwd); + debug ("chdir %s\n", pwd);
+ if (chdir (pwd)) { + if (chdir (pwd)) {
+ error (0, errno, _("can't chdir to %s"), pwd); + error (0, errno, _("can't chdir to %s"), pwd);
regain_effective_privs (); + regain_effective_privs ();
return 0; + return 0;
} + }
} + }
/* Check that the file exists and isn't e.g. a directory */ /* Check that the file exists and isn't e.g. a directory */
- if (stat (argv, &st)) { - if (stat (argv, &st)) {
@ -777,7 +877,7 @@ index 4715efb..edcd59c 100644
return NOT_FOUND; return NOT_FOUND;
} }
@@ -1006,8 +1007,13 @@ executable_out: @@ -3860,8 +3887,13 @@ executable_out:
argv_abs = xstrdup (argv); argv_abs = xstrdup (argv);
} }
lang = lang_dir (argv_abs); lang = lang_dir (argv_abs);
@ -792,7 +892,7 @@ index 4715efb..edcd59c 100644
if (local_mf) if (local_mf)
error (0, errno, "%s", argv); error (0, errno, "%s", argv);
exit_status = NOT_FOUND; exit_status = NOT_FOUND;
@@ -1036,7 +1042,16 @@ int main (int argc, char *argv[]) @@ -3990,7 +4022,16 @@ int main (int argc, char *argv[])
umask (022); umask (022);
init_locale (); init_locale ();
@ -810,7 +910,7 @@ index 4715efb..edcd59c 100644
/* Use LANGUAGE only when LC_MESSAGES locale category is /* Use LANGUAGE only when LC_MESSAGES locale category is
* neither "C" nor "POSIX". */ * neither "C" nor "POSIX". */
if (internal_locale && strcmp (internal_locale, "C") && if (internal_locale && strcmp (internal_locale, "C") &&
@@ -1101,9 +1116,13 @@ int main (int argc, char *argv[]) @@ -4053,9 +4094,13 @@ int main (int argc, char *argv[])
if (external) if (external)
do_extern (argc, argv); do_extern (argc, argv);
@ -825,153 +925,8 @@ index 4715efb..edcd59c 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
/* close this locale and reinitialise if a new locale was /* close this locale and reinitialise if a new locale was
@@ -1409,7 +1428,8 @@ static char *get_preprocessors_from_file (pipeline *decomp)
if (!line)
return NULL;
- if (!strncmp (line, PP_COOKIE, 4)) {
+ if (!strncmp (line, PP_COOKIE, 4) ||
+ (strlen(line) == 6 && !strncmp(line, ".\\\" ", 4))) {
const char *newline = strchr (line, '\n');
if (newline)
return xstrndup (line + 4, newline - (line + 4));
@@ -1921,6 +1941,18 @@ static void setenv_less (pipecmd *cmd, const char *title)
free (less_opts);
}
+static void disable_x(void)
+{
+ char *bname = basename((char*)pager);
+ if (bname) {
+ if (!strcmp(bname, "less"))
+ unsetenv("DISPLAY");
+#if 0
+ free(bname);
+#endif
+ }
+}
+
static void add_output_iconv (pipeline *p,
const char *source, const char *target)
{
@@ -1976,6 +2008,8 @@ static pipeline *make_display_command (const char *encoding, const char *title)
if (pager_cmd) {
setenv_less (pager_cmd, title);
+ if (!htmlout)
+ disable_x();
pipeline_command (p, pager_cmd);
}
pipeline_ignore_signals (p, 1);
@@ -1986,7 +2020,7 @@ static pipeline *make_display_command (const char *encoding, const char *title)
return p;
}
-
+#ifdef MAN_CATS
/* return a (malloced) temporary name in cat_file's directory */
static char *tmp_cat_filename (const char *cat_file)
{
@@ -2088,6 +2122,7 @@ static int commit_tmp_cat (const char *cat_file, const char *tmp_cat,
return status;
}
+#endif /* MAN_CATS */
/* TODO: This should all be refactored after work on the decompression
* library is complete.
@@ -2108,7 +2143,6 @@ static void maybe_discard_stderr (pipeline *p)
}
#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)
{
@@ -2343,6 +2377,7 @@ static void format_display (pipeline *decomp,
regain_effective_privs ();
}
+#ifdef MAN_CATS
/* "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,
@@ -2382,6 +2417,7 @@ static void display_catman (const char *cat_file, pipeline *decomp,
pop_cleanup();
free (tmpcat);
}
+#endif /* MAN_CATS */
static void disable_hyphenation (void *data ATTRIBUTE_UNUSED)
{
@@ -2535,7 +2571,7 @@ static int display (const char *dir, const char *man_file,
format_cmd = NULL;
decomp_errno = errno;
}
-
+#ifdef MAN_CATS
/* Get modification time, for commit_tmp_cat(). */
if (man_file && *man_file) {
struct stat stb;
@@ -2544,7 +2580,7 @@ static int display (const char *dir, const char *man_file,
else
man_modtime = stb.st_mtime;
}
-
+#endif /* MAN_CATS */
display_to_stdout = troff;
#ifdef TROFF_IS_GROFF
if (htmlout)
@@ -2680,6 +2716,7 @@ static int display (const char *dir, const char *man_file,
}
if (printed)
putchar ('\n');
+#ifdef MAN_CATS
} else if (catman) {
if (format) {
if (!save_cat)
@@ -2692,6 +2729,7 @@ static int display (const char *dir, const char *man_file,
format_cmd,
formatted_encoding);
}
+#endif /* MAN_CATS */
} else if (format) {
/* no cat or out of date */
pipeline *disp_cmd;
@@ -2753,8 +2791,10 @@ static int display (const char *dir, const char *man_file,
free (formatted_encoding);
- pipeline_free (format_cmd);
- pipeline_free (decomp);
+ if (format_cmd)
+ pipeline_free (format_cmd);
+ if (decomp)
+ pipeline_free (decomp);
if (!prompt)
prompt = found;
@@ -2762,7 +2802,6 @@ static int display (const char *dir, const char *man_file,
return found;
}
-
static char *find_cat_file (const char *path, const char *original,
const char *man_file)
{
@@ -3515,7 +3554,7 @@ static int display_database_check (struct candidate *candp)
#ifdef MAN_DB_UPDATES
if (!exists && !skip) {
debug ("dbdelete_wrapper (%s, %p)\n",
- candp->req_name, candp->source);
+ candp->req_name, candp->source->addr);
dbdelete_wrapper (candp->req_name, candp->source);
}
#endif /* MAN_DB_UPDATES */
diff --git src/man_db.conf.in src/man_db.conf.in
index bc8bb7e..c94b543 100644
--- src/man_db.conf.in --- src/man_db.conf.in
+++ src/man_db.conf.in +++ src/man_db.conf.in 2015-05-28 00:00:00.000000000 +0000
@@ -20,6 +20,14 @@ @@ -20,6 +20,14 @@
MANDATORY_MANPATH /usr/man MANDATORY_MANPATH /usr/man
MANDATORY_MANPATH /usr/share/man MANDATORY_MANPATH /usr/share/man
@ -987,7 +942,7 @@ index bc8bb7e..c94b543 100644
#--------------------------------------------------------- #---------------------------------------------------------
# set up PATH to MANPATH mapping # set up PATH to MANPATH mapping
# ie. what man tree holds man pages for what binary directory. # ie. what man tree holds man pages for what binary directory.
@@ -34,8 +42,10 @@ MANPATH_MAP /usr/local/bin /usr/local/man @@ -34,8 +42,10 @@ MANPATH_MAP /usr/local/bin /usr/local/m
MANPATH_MAP /usr/local/bin /usr/local/share/man MANPATH_MAP /usr/local/bin /usr/local/share/man
MANPATH_MAP /usr/local/sbin /usr/local/man MANPATH_MAP /usr/local/sbin /usr/local/man
MANPATH_MAP /usr/local/sbin /usr/local/share/man MANPATH_MAP /usr/local/sbin /usr/local/share/man
@ -1139,11 +1094,9 @@ index bc8bb7e..c94b543 100644
# #
#--------------------------------------------------------- #---------------------------------------------------------
# Program definitions. These are commented out by default as the value # Program definitions. These are commented out by default as the value
diff --git src/mandb.c src/mandb.c
index 5b8c57d..58cfeb6 100644
--- src/mandb.c --- src/mandb.c
+++ src/mandb.c +++ src/mandb.c 2015-05-28 11:33:30.000000000 +0000
@@ -193,6 +193,8 @@ static const char *xtmpfile; @@ -196,6 +196,8 @@ static const char *xtmpfile;
#ifdef SECURE_MAN_UID #ifdef SECURE_MAN_UID
extern uid_t ruid; extern uid_t ruid;
extern uid_t euid; extern uid_t euid;
@ -1152,7 +1105,7 @@ index 5b8c57d..58cfeb6 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
static char *manpathlist[MAXDIRS]; static char *manpathlist[MAXDIRS];
@@ -528,6 +530,8 @@ static int mandb (const char *catpath, const char *manpath) @@ -548,6 +550,8 @@ static int mandb (const char *catpath, c
return amount; return amount;
} }
@ -1161,7 +1114,7 @@ index 5b8c57d..58cfeb6 100644
static int process_manpath (const char *manpath, int global_manpath, static int process_manpath (const char *manpath, int global_manpath,
struct hashtable *tried_catdirs) struct hashtable *tried_catdirs)
{ {
@@ -561,6 +565,8 @@ static int process_manpath (const char *manpath, int global_manpath, @@ -594,6 +598,8 @@ static int process_manpath (const char *
database = NULL; database = NULL;
} }
@ -1169,8 +1122,8 @@ index 5b8c57d..58cfeb6 100644
+ +
push_cleanup (cleanup, NULL, 0); push_cleanup (cleanup, NULL, 0);
push_cleanup (cleanup_sigsafe, NULL, 1); push_cleanup (cleanup_sigsafe, NULL, 1);
if (single_filename) { if (run_mandb) {
@@ -591,7 +597,7 @@ static int process_manpath (const char *manpath, int global_manpath, @@ -608,7 +614,7 @@ static int process_manpath (const char *
if (!opt_test && amount) { if (!opt_test && amount) {
finish_up (); finish_up ();
#ifdef SECURE_MAN_UID #ifdef SECURE_MAN_UID
@ -1179,7 +1132,7 @@ index 5b8c57d..58cfeb6 100644
do_chown (man_owner->pw_uid); do_chown (man_owner->pw_uid);
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
} }
@@ -801,8 +807,14 @@ int main (int argc, char *argv[]) @@ -819,8 +825,14 @@ int main (int argc, char *argv[])
error (FAIL, 0, error (FAIL, 0,
_("the setuid man user \"%s\" does not exist"), _("the setuid man user \"%s\" does not exist"),
MAN_OWNER); MAN_OWNER);
@ -1196,10 +1149,8 @@ index 5b8c57d..58cfeb6 100644
#endif /* SECURE_MAN_UID */ #endif /* SECURE_MAN_UID */
read_config_file (user); read_config_file (user);
diff --git src/manp.c src/manp.c
index e73e838..22c7ae0 100644
--- src/manp.c --- src/manp.c
+++ src/manp.c +++ src/manp.c 2015-05-28 00:00:00.000000000 +0000
@@ -925,7 +925,7 @@ static char *def_path (int flag) @@ -925,7 +925,7 @@ static char *def_path (int flag)
/* If we have complete config file failure... */ /* If we have complete config file failure... */
@ -1209,19 +1160,17 @@ index e73e838..22c7ae0 100644
return manpath; return manpath;
} }
diff --git src/straycats.c src/straycats.c
index 349d57b..9a27ff8 100644
--- src/straycats.c --- src/straycats.c
+++ src/straycats.c +++ src/straycats.c 2015-05-28 11:36:07.000000000 +0000
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
+#include <fcntl.h> +#include <fcntl.h>
#include <dirent.h>
#ifdef HAVE_DIRENT_H #include "canonicalize.h"
# include <dirent.h> @@ -283,17 +284,23 @@ static int check_for_stray (void)
@@ -279,13 +280,17 @@ static int check_for_stray (void)
if (lg.whatis) if (lg.whatis)
free (lg.whatis); free (lg.whatis);
@ -1240,14 +1189,20 @@ index 349d57b..9a27ff8 100644
- free (section); - free (section);
+ if (section) + if (section)
+ free (section); + free (section);
next_name:
- free (names[i]);
+ if (names[i])
+ free (names[i]);
} }
closedir (cdir); - free (names);
+ if (names)
+ free (names);
return strays; return strays;
diff --git src/ult_src.c src/ult_src.c }
index 283aee1..d2eb971 100644
--- src/ult_src.c --- src/ult_src.c
+++ src/ult_src.c +++ src/ult_src.c 2015-05-28 00:00:00.000000000 +0000
@@ -379,10 +379,15 @@ const char *ult_src (const char *name, const char *path, @@ -364,10 +364,15 @@ const char *ult_src (const char *name, c
} }
pipeline_start (decomp); pipeline_start (decomp);
@ -1265,10 +1220,8 @@ index 283aee1..d2eb971 100644
include = test_for_include (buffer); include = test_for_include (buffer);
if (include) { if (include) {
diff --git src/ult_src.h src/ult_src.h
index 6fad470..3cd3a37 100644
--- src/ult_src.h --- src/ult_src.h
+++ src/ult_src.h +++ src/ult_src.h 2015-05-28 00:00:00.000000000 +0000
@@ -22,9 +22,10 @@ @@ -22,9 +22,10 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
@ -1283,6 +1236,3 @@ index 6fad470..3cd3a37 100644
/* Trace of the link chain from a given file. Any names listed here should /* Trace of the link chain from a given file. Any names listed here should
* not have WHATIS_MAN entries created for them. * not have WHATIS_MAN entries created for them.
--
1.8.4.5

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

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

View File

@ -1,3 +1,59 @@
-------------------------------------------------------------------
Thu May 28 12:55:34 UTC 2015 - werner@suse.de
- Update to version 2.7.1
For the first time since version 2.4.0, the database format has
changed slightly, so you will need to run 'mandb --create' after
installing the new version to rebuild your databases from scratch.
- Fixes
* Various portability fixes for Solaris, contributed by Peter Bray.
* man now runs correctly when its current working directory has been
deleted. (As a result of this fix, man-db now requires
libpipeline >= 1.4.0.)
* 'man -a' sends its prompts to /dev/tty rather than to stderr, and
likewise reads replies from /dev/tty rather than from stdin.
* Be more careful to avoid using or double-closing closed database
handles. Fixes test suite failures on some systems.
* Patch the fdutimens function imported from Gnulib to work around a
libc bug in GNU/Hurd.
* Fix test suite in the case where the system supports
high-precision timestamps but the file system containing the build
directory does not.
* lexgrog now filters terminal escape sequences out of cat pages
before trying to parse them.
* Tools that consider the terminal line length now prioritise the
COLUMNS environment variable above the TIOCGWINSZ ioctl.
* Manpath elements are no longer canonicalised before being inserted
into the search path; this caused the use of incorrect catpaths in
some cases. This was broken by the LANGUAGE-handling fixes in
2.5.4.
* Remove test suite dependency on realpath(1).
* Fix a test failure when configured with --enable-undoc.
* Run the pager in man's original working directory rather than in
the manual hierarchy. (As a result of this fix, man-db now
requires libpipeline >= 1.3.0.)
* mandb only creates a cache directory tag if the catpath is
different from the manpath, since it should only be created in
directories that consist entirely of cached information.
- Improvements
* Ship a systemd tmpfiles snippet to clean up old cat files after a
week.
* The modification time of manual databases is now simply stored in
the mtime of the database files themselves, rather than using a
special row. This makes databases reproducible between
otherwise-identical installations, as long as the underlying
database has predictable behaviour. As a bonus, man-db now uses
high-precision timestamps to determine whether it needs to update
databases.
* Timestamps of manual pages are also now stored in the database
with high precision and compared accordingly.
* Files are now ordered by first physical extent before reading
them, for substantial performance improvements in operations such
as mandb and 'man -K'.
* 'man -H' shows a better error message if no browser is configured.
* zsoelim is now installed in $pkglibexecdir, to avoid clashes with
other packages.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jul 31 08:33:00 UTC 2014 - werner@suse.de Thu Jul 31 08:33:00 UTC 2014 - werner@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package man # spec file for package man
# #
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -31,7 +31,8 @@ BuildRequires: pkg-config
BuildRequires: po4a BuildRequires: po4a
BuildRequires: xz-devel BuildRequires: xz-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
Version: 2.6.6 #Version: 2.6.6
Version: 2.7.1
Release: 0 Release: 0
Summary: A Program for Displaying man Pages Summary: A Program for Displaying man Pages
License: GPL-2.0+ License: GPL-2.0+
@ -39,26 +40,28 @@ Group: System/Base
Url: https://savannah.nongnu.org/projects/man-db Url: https://savannah.nongnu.org/projects/man-db
PreReq: coreutils fillup PreReq: coreutils fillup
Provides: man_db Provides: man_db
Requires: cronie
Requires: glibc-locale Requires: glibc-locale
%if 0%{suse_version} > 1300 %if 0%{suse_version} > 1300
Recommends: groff-full Recommends: groff-full
%endif %endif
Requires: groff >= 1.18 Requires: groff >= 1.18
Requires: less Requires: less
Source: http://download.savannah.gnu.org/releases/man-db/man-db-%{version}.tar.xz #Source: http://download.savannah.gnu.org/releases/man-db/man-db-%{version}.tar.xz
Source: man-db-2.7.1.tar.xz
Source1: sysconfig.cron-man Source1: sysconfig.cron-man
Source2: cron.daily.do_mandb Source2: cron.daily.do_mandb
Source3: cron.daily.clean_catman Source3: cron.daily.clean_catman
Source4: mancoding Source4: mancoding
Source5: wrapper.c Source5: wrapper.c
Patch0: man-db-2.6.5.dif Patch0: man-db-2.7.1.dif
Patch1: man-db-2.6.3-man0.dif Patch1: man-db-2.6.3-man0.dif
Patch2: man-db-2.3.19deb4.0-groff.dif Patch2: man-db-2.3.19deb4.0-groff.dif
Patch4: man-db-2.6.3-section.dif Patch4: man-db-2.6.3-section.dif
Patch5: man-db-2.6.5-security4.dif Patch5: man-db-2.7.1-security4.dif
Patch6: man-db-2.6.5-firefox.dif Patch6: man-db-2.7.1-firefox.dif
Patch7: man-db-2.6.3-chinese.dif Patch7: man-db-2.6.3-chinese.dif
Patch9: man-db-2.6.5-zio.dif Patch9: man-db-2.7.1-zio.dif
Patch10: man-db-2.6.3-listall.dif Patch10: man-db-2.6.3-listall.dif
# PATCH-FIX-SUSE Fixes the documentation for bnc#786679 # PATCH-FIX-SUSE Fixes the documentation for bnc#786679
Patch11: man-MAN_POSIXLY_CORRECT-man1.dif Patch11: man-MAN_POSIXLY_CORRECT-man1.dif
@ -113,8 +116,12 @@ Authors:
Cg g s m) Cg g s m)
SEC="${SEC[@]}" SEC="${SEC[@]}"
rm -f configure rm -f configure
%global optflags %{optflags} -funroll-loops -pipe -D_GNU_SOURCE -D_SVID_SOURCE -Wall %global optflags %{optflags} -funroll-loops -pipe -Wall
CFLAGS="%{optflags}" if grep -q _DEFAULT_SOURCE /usr/include/features.h ; then
CFLAGS="%{optflags} -D_DEFAULT_SOURCE"
else
CFLAGS="%{optflags} -D_GNU_SOURCE -D_SVID_SOURCE"
fi
LDFLAGS= LDFLAGS=
LIBS= LIBS=
LINGUAS= LINGUAS=
@ -224,8 +231,12 @@ fi
test -d var/catman/ && rm -rf var/catman/ || true test -d var/catman/ && rm -rf var/catman/ || true
%post %post
%{?tmpfiles_create:%tmpfiles_create %{_libexecdir}/tmpfiles.d/man-db.conf}
%{fillup_only -an cron} %{fillup_only -an cron}
%posttrans
mandb --quiet --create
%files -f man-db.lang %files -f man-db.lang
%defattr(-,root,root) %defattr(-,root,root)
%doc docs/COPYING %doc docs/COPYING
@ -237,23 +248,19 @@ test -d var/catman/ && rm -rf var/catman/ || true
%{_bindir}/apropos %{_bindir}/apropos
%{_bindir}/catman %{_bindir}/catman
%{_bindir}/lexgrog %{_bindir}/lexgrog
%if %suse_version > 1030 %{_bindir}/man
%attr(0755,root,root) %{_bindir}/man %{_bindir}/mandb
%attr(0755,root,root) %{_bindir}/mandb
%else
%attr(4755,root,root) %{_bindir}/man
%attr(4755,root,root) %{_bindir}/mandb
%endif
%{_bindir}/manpath %{_bindir}/manpath
%{_bindir}/whatis %{_bindir}/whatis
%{_bindir}/zsoelim %dir %attr(0755,root,root) %{_libexecdir}/man-db
%dir %attr(0755,root,root) %{_prefix}/lib/man-db %attr(0755,root,root) %{_libexecdir}/man-db/man
%attr(0755,root,root) %{_prefix}/lib/man-db/man %attr(0755,root,root) %{_libexecdir}/man-db/mandb
%attr(0755,root,root) %{_prefix}/lib/man-db/mandb %attr(0755,man,man) %{_libexecdir}/man-db/manconv
%attr(0755,man,man) %{_prefix}/lib/man-db/manconv %attr(0755,man,man) %{_libexecdir}/man-db/globbing
%attr(0755,man,man) %{_prefix}/lib/man-db/globbing
%{_sbindir}/accessdb %{_sbindir}/accessdb
%{_libdir}/libman*.so %{_libdir}/libman*.so
%{_libexecdir}/man-db/zsoelim
%{_libexecdir}/tmpfiles.d/man-db.conf
%dir %{_datadir}/groff/site-tmac %dir %{_datadir}/groff/site-tmac
%{_datadir}/groff/site-tmac/tmac.andb %{_datadir}/groff/site-tmac/tmac.andb
%{_datadir}/groff/site-tmac/tmac.andocdb %{_datadir}/groff/site-tmac/tmac.andocdb
@ -261,7 +268,7 @@ test -d var/catman/ && rm -rf var/catman/ || true
%doc %{_mandir}/man5/*.5.gz %doc %{_mandir}/man5/*.5.gz
%doc %{_mandir}/man8/*.8.gz %doc %{_mandir}/man8/*.8.gz
%dir %{_mandir}/id %dir %{_mandir}/id
%defattr(-,man,man) %defattr(-,man,root)
%ghost %{_localstatedir}/cache/man/* %ghost %{_localstatedir}/cache/man/*
%{_localstatedir}/adm/fillup-templates/sysconfig.cron-man %{_localstatedir}/adm/fillup-templates/sysconfig.cron-man