create core package

This commit is contained in:
aydemir
2015-02-24 11:18:35 +02:00
parent 0e4b743b82
commit 70b25d0f95
1098 changed files with 169545 additions and 0 deletions
@@ -0,0 +1,24 @@
diff -up man-db-2.5.9/include/manconfig.h.in.sgr man-db-2.5.9/include/manconfig.h.in
--- man-db-2.5.9/include/manconfig.h.in.sgr 2010-11-17 12:30:36.000000000 +0100
+++ man-db-2.5.9/include/manconfig.h.in 2010-11-24 11:29:57.000000000 +0100
@@ -128,7 +128,7 @@
#ifndef NROFF_MISSING
# ifndef NROFF
-# define NROFF "@nroff@"
+# define NROFF "@nroff@ -c"
# endif
#endif
diff -up man-db-2.5.9/src/man_db.conf.in.sgr man-db-2.5.9/src/man_db.conf.in
--- man-db-2.5.9/src/man_db.conf.in.sgr 2009-03-15 13:17:24.000000000 +0100
+++ man-db-2.5.9/src/man_db.conf.in 2010-11-24 11:27:45.000000000 +0100
@@ -80,7 +80,7 @@ MANDB_MAP /opt/man /var/cache/man/opt
#DEFINE tr @tr@ '\255\267\264\327' '\055\157\047\170'
#DEFINE grep @grep@
#DEFINE troff @troff@
-#DEFINE nroff @nroff@
+#DEFINE nroff @nroff@ -c
#DEFINE eqn @eqn@
#DEFINE neqn @neqn@
#DEFINE tbl @tbl@
@@ -0,0 +1,31 @@
diff -upr man-db-2.6.1.orig/lib/encodings.c man-db-2.6.1/lib/encodings.c
--- man-db-2.6.1.orig/lib/encodings.c 2011-05-31 02:03:02.000000000 +0200
+++ man-db-2.6.1/lib/encodings.c 2012-06-15 18:32:37.393496286 +0200
@@ -585,14 +585,23 @@ char *find_charset_locale (const char *c
if (STREQ (charset, get_locale_charset ()))
return NULL;
- supported = fopen (supported_path, "r");
- if (!supported)
- return NULL;
-
saved_locale = setlocale (LC_CTYPE, NULL);
if (saved_locale)
saved_locale = xstrdup (saved_locale);
+ supported = fopen (supported_path, "r");
+ if (!supported) {
+ if (strlen (charset) >= (size_t) 5
+ && strncmp (charset, "UTF-8", (size_t) 5) == 0) {
+ locale = xstrdup("en_US.UTF-8");
+ if (setlocale (LC_CTYPE, locale)) {
+ setlocale (LC_CTYPE, saved_locale);
+ return locale;
+ }
+ }
+ return NULL;
+ }
+
while (getline (&line, &n, supported) >= 0) {
const char *space = strchr (line, ' ');
if (space) {
@@ -0,0 +1,84 @@
diff -up man-db-2.6.2/src/Makefile.am.so-links man-db-2.6.2/src/Makefile.am
--- man-db-2.6.2/src/Makefile.am.so-links 2012-07-20 19:21:13.000000000 +0200
+++ man-db-2.6.2/src/Makefile.am 2012-07-20 19:21:13.000000000 +0200
@@ -87,6 +87,8 @@ lexgrog_SOURCES = \
descriptions.h \
filenames.c \
filenames.h \
+ globbing.c \
+ globbing.h \
lexgrog.l \
lexgrog_test.c \
manconv.c \
diff -up man-db-2.6.2/src/Makefile.in.so-links man-db-2.6.2/src/Makefile.in
--- man-db-2.6.2/src/Makefile.in.so-links 2012-07-20 19:21:13.000000000 +0200
+++ man-db-2.6.2/src/Makefile.in 2012-07-20 19:21:39.000000000 +0200
@@ -257,7 +257,7 @@ catman_DEPENDENCIES = $(am__DEPENDENCIES
am_globbing_OBJECTS = globbing.$(OBJEXT) globbing_test.$(OBJEXT)
globbing_OBJECTS = $(am_globbing_OBJECTS)
globbing_DEPENDENCIES = $(am__DEPENDENCIES_1)
-am_lexgrog_OBJECTS = compression.$(OBJEXT) descriptions.$(OBJEXT) \
+am_lexgrog_OBJECTS = globbing.$(OBJEXT) compression.$(OBJEXT) descriptions.$(OBJEXT) \
filenames.$(OBJEXT) lexgrog.$(OBJEXT) lexgrog_test.$(OBJEXT) \
manconv.$(OBJEXT) manconv_client.$(OBJEXT) ult_src.$(OBJEXT)
lexgrog_OBJECTS = $(am_lexgrog_OBJECTS)
@@ -1356,6 +1356,8 @@ lexgrog_SOURCES = \
descriptions.h \
filenames.c \
filenames.h \
+ globbing.c \
+ globbing.h \
lexgrog.l \
lexgrog_test.c \
manconv.c \
diff -up man-db-2.6.2/src/ult_src.c.so-links man-db-2.6.2/src/ult_src.c
--- man-db-2.6.2/src/ult_src.c.so-links 2012-06-18 04:28:56.000000000 +0200
+++ man-db-2.6.2/src/ult_src.c 2012-07-20 19:21:13.000000000 +0200
@@ -59,6 +59,8 @@
#include <unistd.h>
#include "canonicalize.h"
+#include "dirname.h"
+#include "globbing.h"
#include "gettext.h"
#define _(String) gettext (String)
@@ -343,6 +345,38 @@ const char *ult_src (const char *name, c
free (base);
base = appendstr (NULL, path, "/", include,
NULL);
+
+ /* If the original path from above doesn't exist, try to create
+ * new path as if the "include" was relative to the current
+ * man page.
+ */
+ if (access (base, F_OK) != 0) {
+ char *dirname = mdir_name (name);
+ char *tempFile = appendstr (NULL, dirname, "/", include,
+ NULL);
+ free (dirname);
+ if (access (tempFile, F_OK) == 0) {
+ free (base);
+ base = canonicalize_filename_mode (tempFile,
+ CAN_EXISTING);
+ } else {
+ char *tempFileAsterisk = appendstr (NULL, tempFile,
+ "*", NULL);
+ char **possibleFiles = expand_path (tempFileAsterisk);
+ free (tempFileAsterisk);
+ if (access (possibleFiles[0], F_OK) == 0) {
+ free (base);
+ base = canonicalize_filename_mode (possibleFiles[0],
+ CAN_EXISTING);
+ }
+ int i;
+ for (i = 0; possibleFiles[i] != NULL; i++) {
+ free (possibleFiles[i]);
+ }
+ free (possibleFiles);
+ }
+ free (tempFile);
+ }
free (include);
debug ("ult_src: points to %s\n", base);
@@ -0,0 +1,265 @@
diff -up man-db-2.6.2/src/globbing.c.wildcards man-db-2.6.2/src/globbing.c
--- man-db-2.6.2/src/globbing.c.wildcards 2010-09-26 23:08:14.000000000 +0200
+++ man-db-2.6.2/src/globbing.c 2012-07-20 19:18:20.000000000 +0200
@@ -427,3 +427,30 @@ char **look_for_file (const char *hier,
else
return gbuf.gl_pathv;
}
+
+char **expand_path (const char *path)
+{
+ int res = 0;
+ char **result = NULL;
+ glob_t globbuf;
+
+ res = glob (path, 0, NULL, &globbuf);
+ /* if glob failed, return the given path */
+ if (res != 0) {
+ result = (char **) xmalloc (2 * sizeof(char **));
+ result[0] = xstrndup (path, strlen(path));
+ result[1] = NULL;
+ return result;
+ }
+
+ result = (char **) xmalloc ((globbuf.gl_pathc + 1) * sizeof(char **));
+ size_t i;
+ for (i = 0; i < globbuf.gl_pathc; i++) {
+ result[i] = xstrndup (globbuf.gl_pathv[i], strlen (globbuf.gl_pathv[i]));
+ }
+ result[globbuf.gl_pathc] = NULL;
+
+ globfree (&globbuf);
+
+ return result;
+}
diff -up man-db-2.6.2/src/globbing.h.wildcards man-db-2.6.2/src/globbing.h
--- man-db-2.6.2/src/globbing.h.wildcards 2008-12-11 00:06:18.000000000 +0100
+++ man-db-2.6.2/src/globbing.h 2012-07-20 19:18:20.000000000 +0200
@@ -29,3 +29,6 @@ enum look_for_file_opts {
/* globbing.c */
extern char **look_for_file (const char *hier, const char *sec,
const char *unesc_name, int cat, int opts);
+
+/* Expand path with wildcards into list of all existing directories. */
+extern char **expand_path (const char *path);
diff -up man-db-2.6.2/src/Makefile.am.wildcards man-db-2.6.2/src/Makefile.am
--- man-db-2.6.2/src/Makefile.am.wildcards 2012-02-05 14:25:20.000000000 +0100
+++ man-db-2.6.2/src/Makefile.am 2012-07-20 19:18:20.000000000 +0200
@@ -72,6 +72,8 @@ zsoelim_LDADD = $(LIBMAN) $(libpipeline_
accessdb_SOURCES = \
accessdb.c
catman_SOURCES = \
+ globbing.c \
+ globbing.h \
catman.c \
manp.c \
manp.h
@@ -140,10 +142,14 @@ mandb_SOURCES = \
ult_src.c \
ult_src.h
manpath_SOURCES = \
+ globbing.c \
+ globbing.h \
manp.c \
manp.h \
manpath.c
whatis_SOURCES = \
+ globbing.c \
+ globbing.h \
manconv.c \
manconv.h \
manp.c \
diff -up man-db-2.6.2/src/Makefile.in.wildcards man-db-2.6.2/src/Makefile.in
--- man-db-2.6.2/src/Makefile.in.wildcards 2012-06-18 14:39:42.000000000 +0200
+++ man-db-2.6.2/src/Makefile.in 2012-07-20 19:20:29.000000000 +0200
@@ -251,7 +251,7 @@ accessdb_DEPENDENCIES = $(am__DEPENDENCI
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
-am_catman_OBJECTS = catman.$(OBJEXT) manp.$(OBJEXT)
+am_catman_OBJECTS = globbing.$(OBJEXT) catman.$(OBJEXT) manp.$(OBJEXT)
catman_OBJECTS = $(am_catman_OBJECTS)
catman_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2)
am_globbing_OBJECTS = globbing.$(OBJEXT) globbing_test.$(OBJEXT)
@@ -282,10 +282,10 @@ am_mandb_OBJECTS = check_mandirs.$(OBJEX
mandb_OBJECTS = $(am_mandb_OBJECTS)
mandb_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_2)
-am_manpath_OBJECTS = manp.$(OBJEXT) manpath.$(OBJEXT)
+am_manpath_OBJECTS = globbing.$(OBJEXT) manp.$(OBJEXT) manpath.$(OBJEXT)
manpath_OBJECTS = $(am_manpath_OBJECTS)
manpath_DEPENDENCIES = $(am__DEPENDENCIES_1)
-am_whatis_OBJECTS = manconv.$(OBJEXT) manp.$(OBJEXT) whatis.$(OBJEXT)
+am_whatis_OBJECTS = globbing.$(OBJEXT) manconv.$(OBJEXT) manp.$(OBJEXT) whatis.$(OBJEXT)
whatis_OBJECTS = $(am_whatis_OBJECTS)
whatis_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_2)
@@ -1340,6 +1340,8 @@ accessdb_SOURCES = \
catman_SOURCES = \
catman.c \
+ globbing.c \
+ globbing.h \
manp.c \
manp.h
@@ -1413,11 +1415,15 @@ mandb_SOURCES = \
ult_src.h
manpath_SOURCES = \
+ globbing.c \
+ globbing.h \
manp.c \
manp.h \
manpath.c
whatis_SOURCES = \
+ globbing.c \
+ globbing.h \
manconv.c \
manconv.h \
manp.c \
diff -up man-db-2.6.2/src/manp.c.wildcards man-db-2.6.2/src/manp.c
--- man-db-2.6.2/src/manp.c.wildcards 2012-02-05 14:18:59.000000000 +0100
+++ man-db-2.6.2/src/manp.c 2012-07-20 19:18:20.000000000 +0200
@@ -75,6 +75,7 @@
#endif
#include "manp.h"
+#include "globbing.h"
struct list {
char *key;
@@ -1035,32 +1036,45 @@ char *get_manpath_from_path (const char
static void add_dir_to_list (char **lp, const char *dir)
{
int status;
- int pos = 0;
-
- while (*lp != NULL) {
- if (pos > MAXDIRS - 1)
- gripe_overlong_list ();
- if (!strcmp (*lp, dir)) {
- debug ("%s is already in the manpath\n", dir);
- return;
+ int pos = 0, i = 0;
+ char *d = NULL;
+ char **expanded_dirs = NULL;
+
+ expanded_dirs = expand_path (dir);
+ for (i = 0; expanded_dirs[i] != NULL; i++) {
+ d = expanded_dirs[i];
+
+ while (*lp != NULL) {
+ if (pos > MAXDIRS - 1)
+ gripe_overlong_list ();
+ if (!strcmp (*lp, d)) {
+ debug ("%s is already in the manpath\n", d);
+ return;
+ }
+ lp++;
+ pos++;
}
- lp++;
- pos++;
- }
- /* Not found -- add it. */
+ /* Not found -- add it. */
+
+ status = is_directory (d);
- status = is_directory (dir);
+ if (status < 0)
+ gripe_stat_file (d);
+ else if (status == 0)
+ gripe_not_directory (d);
+ else if (status == 1) {
+ debug ("adding %s to manpath\n", d);
- if (status < 0)
- gripe_stat_file (dir);
- else if (status == 0)
- gripe_not_directory (dir);
- else if (status == 1) {
- debug ("adding %s to manpath\n", dir);
+ *lp = xstrdup (d);
+ }
- *lp = xstrdup (dir);
+ free (d);
}
+
+ /* free also the last NULL pointer */
+ free (expanded_dirs[i]);
+ free (expanded_dirs);
}
/* path does not exist in config file: check to see if path/../man,
@@ -1104,33 +1118,47 @@ static inline char *has_mandir (const ch
static char **add_dir_to_path_list (char **mphead, char **mp, const char *p)
{
- int status;
+ int status, i = 0;
char *cwd;
+ char *d = NULL;
+ char **expanded_dirs = NULL;
if (mp - mphead > MAXDIRS - 1)
gripe_overlong_list ();
- status = is_directory (p);
-
- if (status < 0)
- gripe_stat_file (p);
- else if (status == 0)
- gripe_not_directory (p);
- else {
- /* deal with relative paths */
+ expanded_dirs = expand_path (p);
+ for (i = 0; expanded_dirs[i] != NULL; i++) {
+ d = expanded_dirs[i];
+
+ status = is_directory (d);
+
+ if (status < 0)
+ gripe_stat_file (d);
+ else if (status == 0)
+ gripe_not_directory (d);
+ else {
+ /* deal with relative paths */
+
+ if (*d != '/') {
+ cwd = xgetcwd ();
+ if (!cwd)
+ error (FATAL, errno,
+ _("can't determine current directory"));
+ *mp = appendstr (cwd, "/", d, NULL);
+ } else
+ *mp = xstrdup (d);
- if (*p != '/') {
- cwd = xgetcwd ();
- if (!cwd)
- error (FATAL, errno,
- _("can't determine current directory"));
- *mp = appendstr (cwd, "/", p, NULL);
- } else
- *mp = xstrdup (p);
+ debug ("adding %s to manpathlist\n", *mp);
+ mp++;
+ }
- debug ("adding %s to manpathlist\n", *mp);
- mp++;
+ free (d);
}
+
+ /* free also the last NULL pointer */
+ free (expanded_dirs[i]);
+ free (expanded_dirs);
+
return mp;
}
@@ -0,0 +1,123 @@
diff -upr man-db-2.6.2.orig/src/check_mandirs.c man-db-2.6.2/src/check_mandirs.c
--- man-db-2.6.2.orig/src/check_mandirs.c 2011-07-09 20:53:38.000000000 +0200
+++ man-db-2.6.2/src/check_mandirs.c 2012-07-31 13:05:45.967640117 +0200
@@ -190,8 +190,7 @@ void test_manfile (const char *file, con
comp extensions */
abs_filename = make_filename (path, NULL,
exists, "man");
- debug ("test_manfile(): stat %s\n", abs_filename);
- if (stat (abs_filename, &physical) == -1) {
+ if (abs_filename == NULL || stat (abs_filename, &physical) == -1) {
if (!opt_test)
dbdelete (manpage_base, exists);
} else {
diff -upr man-db-2.6.2.orig/src/filenames.c man-db-2.6.2/src/filenames.c
--- man-db-2.6.2.orig/src/filenames.c 2011-10-09 01:19:00.000000000 +0200
+++ man-db-2.6.2/src/filenames.c 2012-07-31 12:31:10.436885216 +0200
@@ -27,6 +27,7 @@
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include "xvasprintf.h"
@@ -61,6 +62,11 @@ char *make_filename (const char *path, c
if (in->comp && *in->comp != '-') /* Is there an extension? */
file = appendstr (file, ".", in->comp, NULL);
+ if (access (file, R_OK) != 0) {
+ free (file);
+ return NULL;
+ }
+
return file;
}
diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c
--- man-db-2.6.2.orig/src/man.c 2012-05-15 01:24:17.000000000 +0200
+++ man-db-2.6.2/src/man.c 2012-07-31 13:04:48.629069419 +0200
@@ -3103,6 +3103,9 @@ static int add_candidate (struct candida
name = req_name;
filename = make_filename (path, name, source, cat ? "cat" : "man");
+ if (filename == NULL) {
+ return 0;
+ }
ult = ult_src (filename, path, NULL,
get_ult_flags (from_db, source->id), NULL);
free (filename);
@@ -3309,6 +3312,9 @@ static int display_filesystem (struct ca
{
char *filename = make_filename (candp->path, NULL, candp->source,
candp->cat ? "cat" : "man");
+ if (filename == NULL) {
+ return 0;
+ }
/* source->name is never NULL thanks to add_candidate() */
char *title = appendstr (NULL, candp->source->name,
"(", candp->source->ext, ")", NULL);
@@ -3392,14 +3398,14 @@ static int display_database (struct cand
if (in->id < STRAY_CAT) { /* There should be a src page */
file = make_filename (candp->path, name, in, "man");
- debug ("Checking physical location: %s\n", file);
+ if (file != NULL) {
+ debug ("Checking physical location: %s\n", file);
- if (access (file, R_OK) == 0) {
const char *man_file;
char *cat_file;
man_file = ult_src (file, candp->path, NULL,
- get_ult_flags (1, in->id), NULL);
+ get_ult_flags (1, in->id), NULL);
if (man_file == NULL) {
free (title);
return found; /* zero */
@@ -3416,7 +3422,7 @@ static int display_database (struct cand
free (lang);
lang = NULL;
} /* else {drop through to the bottom and return 0 anyway} */
- } else
+ } else
#endif /* NROFF_MISSING */
@@ -3441,9 +3447,9 @@ static int display_database (struct cand
}
file = make_filename (candp->path, name, in, "cat");
- debug ("Checking physical location: %s\n", file);
-
- if (access (file, R_OK) != 0) {
+ if (file != NULL) {
+ debug ("Checking physical location: %s\n", file);
+ } else {
char *catpath;
catpath = get_catpath (candp->path,
global_manpath ? SYSTEM_CAT
@@ -3453,10 +3459,10 @@ static int display_database (struct cand
file = make_filename (catpath, name,
in, "cat");
free (catpath);
- debug ("Checking physical location: %s\n",
- file);
-
- if (access (file, R_OK) != 0) {
+ if (file != NULL) {
+ debug ("Checking physical location: %s\n",
+ file);
+ } else {
/* don't delete here,
return==0 will do that */
free (title);
@@ -3520,6 +3526,8 @@ static int maybe_update_file (const char
real_name = name;
file = make_filename (manpath, real_name, info, "man");
+ if (file == NULL)
+ return 0;
if (lstat (file, &buf) != 0)
return 0;
if (buf.st_mtime == info->_st_mtime)
@@ -0,0 +1,63 @@
diff -up man-db-2.6.3/src/manp.c.overrides man-db-2.6.3/src/manp.c
--- man-db-2.6.3/src/manp.c.overrides 2012-10-24 16:52:35.134486439 +0200
+++ man-db-2.6.3/src/manp.c 2012-10-24 16:59:28.300037133 +0200
@@ -51,6 +51,7 @@
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <assert.h>
#include <errno.h>
#include <dirent.h>
@@ -95,6 +96,9 @@ static struct list *namestore, *tailstor
#define MANPATH_MAP 0
#define MANDATORY 1
+/* Subdirectory of MANPATH entries searched for man pages before the directory itself. */
+#define OVERRIDES_DIR "/overrides"
+
/* DIRLIST list[MAXDIRS]; */
static char *tmplist[MAXDIRS];
@@ -933,6 +937,7 @@ char *get_manpath_from_path (const char
char **lp;
char *end;
char *manpathlist;
+ char overrides[MAXPATHLEN];
struct list *list;
tmppath = xstrdup (path);
@@ -960,6 +965,9 @@ char *get_manpath_from_path (const char
if (mandir_list) {
debug ("is in the config file\n");
while (mandir_list) {
+ strcpy(overrides, mandir_list->cont);
+ strcat(overrides, OVERRIDES_DIR);
+ add_dir_to_list (tmplist, overrides);
add_dir_to_list (tmplist, mandir_list->cont);
mandir_list = iterate_over_list
(mandir_list, p, MANPATH_MAP);
@@ -978,6 +986,9 @@ char *get_manpath_from_path (const char
"../share/man, or share/man "
"subdirectory\n");
+ strcpy(overrides, t);
+ strcat(overrides, OVERRIDES_DIR);
+ add_dir_to_list (tmplist, overrides);
add_dir_to_list (tmplist, t);
free (t);
} else
@@ -993,8 +1004,12 @@ char *get_manpath_from_path (const char
debug ("\nadding mandatory man directories\n\n");
for (list = namestore; list; list = list->next)
- if (list->flag == MANDATORY)
+ if (list->flag == MANDATORY) {
+ strcpy(overrides, list->key);
+ strcat(overrides, OVERRIDES_DIR);
+ add_dir_to_list (tmplist, overrides);
add_dir_to_list (tmplist, list->key);
+ }
}
len = 0;
+7
View File
@@ -0,0 +1,7 @@
#
# Set to no to disable daily man-db update by /etc/cron.daily/man-db.cron
CRON="yes"
# Options used by mandb in /etc/cron.daily/man-db.cron,
# we use -q as default, too much noise without.
OPTS="-q"
+27
View File
@@ -0,0 +1,27 @@
#! /bin/bash
if [ -e /etc/sysconfig/man-db ]; then
. /etc/sysconfig/man-db
fi
if [ "$CRON" = "no" ]; then
exit 0
fi
renice +19 -p $$ >/dev/null 2>&1
ionice -c3 -p $$ >/dev/null 2>&1
LOCKFILE=/var/lock/man-db.lock
# the lockfile is not meant to be perfect, it's just in case the
# two man-db cron scripts get run close to each other to keep
# them from stepping on each other's toes. The worst that will
# happen is that they will temporarily corrupt the database
[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
touch $LOCKFILE
# create/update the mandb database
mandb $OPTS
exit 0