diff --git a/.gitignore b/.gitignore index bfc13f4..a09126a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/man-db-2.6.4.tar.xz +/man-db-2.6.5.tar.xz diff --git a/man-db-2.6.1-locale-fallback.patch b/man-db-2.6.1-locale-fallback.patch deleted file mode 100644 index e749d5a..0000000 --- a/man-db-2.6.1-locale-fallback.patch +++ /dev/null @@ -1,31 +0,0 @@ -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) { diff --git a/man-db-2.6.2-invalid-cache.patch b/man-db-2.6.2-invalid-cache.patch index f0708a1..1fbdacd 100644 --- a/man-db-2.6.2-invalid-cache.patch +++ b/man-db-2.6.2-invalid-cache.patch @@ -1,6 +1,6 @@ -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 +diff -upr man-db-2.6.5.orig/src/check_mandirs.c man-db-2.6.5/src/check_mandirs.c +--- man-db-2.6.5.orig/src/check_mandirs.c 2013-06-27 11:01:22.000000000 +0200 ++++ man-db-2.6.5/src/check_mandirs.c 2013-06-27 13:42:36.410902580 +0200 @@ -190,8 +190,7 @@ void test_manfile (const char *file, con comp extensions */ abs_filename = make_filename (path, NULL, @@ -11,9 +11,9 @@ diff -upr man-db-2.6.2.orig/src/check_mandirs.c man-db-2.6.2/src/check_mandirs.c 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 +diff -upr man-db-2.6.5.orig/src/filenames.c man-db-2.6.5/src/filenames.c +--- man-db-2.6.5.orig/src/filenames.c 2011-10-09 01:19:00.000000000 +0200 ++++ man-db-2.6.5/src/filenames.c 2013-06-27 13:42:36.411902591 +0200 @@ -27,6 +27,7 @@ #include @@ -34,10 +34,10 @@ diff -upr man-db-2.6.2.orig/src/filenames.c man-db-2.6.2/src/filenames.c 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 +diff -upr man-db-2.6.5.orig/src/man.c man-db-2.6.5/src/man.c +--- man-db-2.6.5.orig/src/man.c 2013-06-27 11:09:56.000000000 +0200 ++++ man-db-2.6.5/src/man.c 2013-06-27 13:42:36.413902605 +0200 +@@ -3114,6 +3114,9 @@ static int add_candidate (struct candida name = req_name; filename = make_filename (path, name, source, cat ? "cat" : "man"); @@ -47,7 +47,7 @@ diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c 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 +@@ -3331,6 +3334,9 @@ static int display_filesystem (struct ca { char *filename = make_filename (candp->path, NULL, candp->source, candp->cat ? "cat" : "man"); @@ -55,9 +55,9 @@ diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c + 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 + char *title = xasprintf ("%s(%s)", candp->source->name, + candp->source->ext); +@@ -3421,14 +3427,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"); @@ -75,7 +75,7 @@ diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c if (man_file == NULL) { free (title); return found; /* zero */ -@@ -3416,7 +3422,7 @@ static int display_database (struct cand +@@ -3445,7 +3451,7 @@ static int display_database (struct cand free (lang); lang = NULL; } /* else {drop through to the bottom and return 0 anyway} */ @@ -84,7 +84,7 @@ diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c #endif /* NROFF_MISSING */ -@@ -3441,9 +3447,9 @@ static int display_database (struct cand +@@ -3470,9 +3476,9 @@ static int display_database (struct cand } file = make_filename (candp->path, name, in, "cat"); @@ -97,7 +97,7 @@ diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c char *catpath; catpath = get_catpath (candp->path, global_manpath ? SYSTEM_CAT -@@ -3453,10 +3459,10 @@ static int display_database (struct cand +@@ -3482,10 +3488,10 @@ static int display_database (struct cand file = make_filename (catpath, name, in, "cat"); free (catpath); @@ -112,7 +112,7 @@ diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c /* don't delete here, return==0 will do that */ free (title); -@@ -3520,6 +3526,8 @@ static int maybe_update_file (const char +@@ -3549,6 +3555,8 @@ static int maybe_update_file (const char real_name = name; file = make_filename (manpath, real_name, info, "man"); diff --git a/man-db-2.6.3-gcc.patch b/man-db-2.6.3-gcc.patch deleted file mode 100644 index 93d60f6..0000000 --- a/man-db-2.6.3-gcc.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -up man-db-2.6.3/src/check_mandirs.c.gcc man-db-2.6.3/src/check_mandirs.c ---- man-db-2.6.3/src/check_mandirs.c.gcc 2013-03-18 13:56:24.000000000 +0100 -+++ man-db-2.6.3/src/check_mandirs.c 2013-03-18 14:03:20.081132550 +0100 -@@ -440,7 +440,10 @@ static int testmandirs (const char *path - return 0; - } - -- chdir (path); -+ if (chdir (path) != 0) { -+ error (0, errno, _("can't change to directory %s"), path); -+ return 0; -+ } - - while( (mandir = readdir (dir)) ) { - if (strncmp (mandir->d_name, "man", 3) != 0) - diff --git a/man-db-2.6.3-valgrind.patch b/man-db-2.6.3-valgrind.patch deleted file mode 100644 index 628a1b8..0000000 --- a/man-db-2.6.3-valgrind.patch +++ /dev/null @@ -1,350 +0,0 @@ -diff -up man-db-2.6.4/lib/encodings.c.valgrind-mem man-db-2.6.4/lib/encodings.c ---- man-db-2.6.4/lib/encodings.c.valgrind-mem 2013-06-24 18:32:18.598659138 +0200 -+++ man-db-2.6.4/lib/encodings.c 2013-06-24 18:32:18.613658959 +0200 -@@ -559,6 +559,7 @@ const char *get_locale_charset (void) - - /* Restore LC_CTYPE to its value on entry to this function. */ - setlocale (LC_CTYPE, saved_locale); -+ free (saved_locale); - - if (charset && *charset) - return get_canonical_charset_name (charset); -@@ -596,9 +597,12 @@ char *find_charset_locale (const char *c - locale = xstrdup("en_US.UTF-8"); - if (setlocale (LC_CTYPE, locale)) { - setlocale (LC_CTYPE, saved_locale); -+ free (saved_locale); - return locale; - } - } -+ free (saved_locale); -+ free (locale); - return NULL; - } - -@@ -628,6 +632,7 @@ char *find_charset_locale (const char *c - - out: - setlocale (LC_CTYPE, saved_locale); -+ free (saved_locale); - fclose (supported); - return locale; - } -diff -up man-db-2.6.4/src/check_mandirs.c.valgrind-mem man-db-2.6.4/src/check_mandirs.c ---- man-db-2.6.4/src/check_mandirs.c.valgrind-mem 2013-06-24 18:32:18.610658995 +0200 -+++ man-db-2.6.4/src/check_mandirs.c 2013-06-24 18:32:18.613658959 +0200 -@@ -442,6 +442,7 @@ static int testmandirs (const char *path - - if (chdir (path) != 0) { - error (0, errno, _("can't change to directory %s"), path); -+ closedir (dir); - return 0; - } - -@@ -479,11 +480,13 @@ static int testmandirs (const char *path - if (errno == EACCES || errno == EROFS) { - debug ("database %s is read-only\n", - database); -+ closedir (dir); - return 0; - } else { - error (0, errno, - _("can't create index cache %s"), - database); -+ closedir (dir); - return -errno; - } - } -@@ -496,6 +499,7 @@ static int testmandirs (const char *path - - if (!dbf) { - gripe_rwopen_failed (); -+ closedir (dir); - return 0; - } - -diff -up man-db-2.6.4/src/manconv_client.c.valgrind-mem man-db-2.6.4/src/manconv_client.c ---- man-db-2.6.4/src/manconv_client.c.valgrind-mem 2011-01-04 04:04:50.000000000 +0100 -+++ man-db-2.6.4/src/manconv_client.c 2013-06-24 18:32:18.614658947 +0200 -@@ -111,8 +111,10 @@ void add_manconv (pipeline *p, const cha - char *name; - pipecmd *cmd; - -- if (STREQ (source, "UTF-8") && STREQ (target, "UTF-8")) -+ if (STREQ (source, "UTF-8") && STREQ (target, "UTF-8")) { -+ free (codes); - return; -+ } - - /* informational only; no shell quoting concerns */ - name = appendstr (NULL, MANCONV, " -f ", NULL); -diff -up man-db-2.6.4/src/man.c.valgrind-mem man-db-2.6.4/src/man.c ---- man-db-2.6.4/src/man.c.valgrind-mem 2013-06-24 18:32:18.603659078 +0200 -+++ man-db-2.6.4/src/man.c 2013-06-24 18:45:21.537924667 +0200 -@@ -188,7 +188,7 @@ static char *manpathlist[MAXDIRS]; - /* globals */ - int quiet = 1; - char *program_name; --char *database; -+char *database = NULL; - MYDBM_FILE dbf; - extern const char *extension; /* for globbing.c */ - extern char *user_config_file; /* defined in manp.c */ -@@ -956,7 +956,7 @@ static int local_man_loop (const char *a - - if (directory_on_path (argv_dir)) { - char *argv_base = base_name (argv); -- char *new_manp; -+ char *new_manp, *nm; - char **old_manpathlist, **mp; - - debug ("recalculating manpath for executable " -@@ -968,7 +968,9 @@ static int local_man_loop (const char *a - "executable\n"); - goto executable_out; - } -- new_manp = locale_manpath (new_manp); -+ nm = locale_manpath (new_manp); -+ free (new_manp); -+ new_manp = nm; - - old_manpathlist = XNMALLOC (MAXDIRS, char *); - memcpy (old_manpathlist, manpathlist, -@@ -1176,14 +1178,21 @@ int main (int argc, char *argv[]) - manp = get_manpath (""); - printf ("%s\n", manp); - exit (OK); -- } else -+ } else { -+ free (cwd); -+ free (internal_locale); -+ free (program_name); - gripe_no_name (NULL); -+ } - } - - section_list = get_section_list (); - -- if (manp == NULL) -- manp = locale_manpath (get_manpath (alt_system_name)); -+ if (manp == NULL) { -+ char *mp = get_manpath (alt_system_name); -+ manp = locale_manpath (mp); -+ free (mp); -+ } - else - free (get_manpath (NULL)); - -@@ -1359,6 +1368,10 @@ int main (int argc, char *argv[]) - if (cwd[0]) - chdir (cwd); - -+ if (database) { -+ free (database); -+ database = NULL; -+ } - free_pathlist (manpathlist); - free (cwd); - free (internal_locale); -@@ -1819,6 +1832,9 @@ static pipeline *make_roff_command (cons - pipeline_command (p, cmd); - } - -+ /* free pp_string */ -+ get_preprocessors_from_file(NULL); -+ - free (page_encoding); - return p; - } -@@ -2330,6 +2346,7 @@ static void format_display (pipeline *de - htmldir); - free (htmlfile); - free (htmldir); -+ free (old_cwd); - } else - #endif /* TROFF_IS_GROFF */ - /* TODO: check format_cmd status too? */ -@@ -2501,6 +2518,7 @@ static int display (const char *dir, con - free (name); - free_locale_bits (&bits); - } -+ free (page_lang); - } - #endif /* TROFF_IS_GROFF */ - -@@ -2567,6 +2585,7 @@ static int display (const char *dir, con - if (prompt && do_prompt (title)) { - pipeline_free (format_cmd); - pipeline_free (decomp); -+ free (formatted_encoding); - return 0; - } - drop_effective_privs (); -@@ -2693,6 +2712,7 @@ static int display (const char *dir, con - if (prompt && do_prompt (title)) { - pipeline_free (format_cmd); - pipeline_free (decomp); -+ free (formatted_encoding); - if (local_man_file) - return 1; - else -@@ -2744,6 +2764,8 @@ static int display (const char *dir, con - } - } - -+ free (formatted_encoding); -+ - pipeline_free (format_cmd); - pipeline_free (decomp); - -@@ -2805,6 +2827,7 @@ static char *find_cat_file (const char * - *tmp = 0; - if (is_directory (cat_dir)) { - debug ("will try cat file %s\n", cat_file); -+ free (cat_dir); - return cat_file; - } else - debug ("cat dir %s does not exist\n", cat_dir); -@@ -3275,6 +3298,7 @@ static int try_section (const char *path - } - } - -+ int f; - for (np = names; np && *np; np++) { - struct mandata *info = infoalloc (); - char *info_buffer = filename_info (*np, info, name); -@@ -3303,8 +3327,15 @@ static int try_section (const char *path - else - info->id = SO_MAN; - -- found += add_candidate (cand_head, CANDIDATE_FILESYSTEM, -+ f = add_candidate (cand_head, CANDIDATE_FILESYSTEM, - cat, name, path, ult, info); -+ found += f; -+ /* Free info and info_buffer if it wasn't added to the candidates. */ -+ if (f == 0) { -+ free (info_buffer); -+ info->addr = NULL; -+ free_mandata_struct (info); -+ } - /* Don't free info and info_buffer here. */ - } - -@@ -3322,9 +3353,13 @@ static int display_filesystem (struct ca - char *title = appendstr (NULL, candp->source->name, - "(", candp->source->ext, ")", NULL); - if (candp->cat) { -- if (troff || want_encoding || recode) -+ if (troff || want_encoding || recode) { -+ free (title); - return 0; -- return display (candp->path, NULL, filename, title, NULL); -+ } -+ int r = display (candp->path, NULL, filename, title, NULL); -+ free (title); -+ return r; - } else { - const char *man_file; - char *cat_file; -@@ -3347,6 +3382,7 @@ static int display_filesystem (struct ca - free (lang); - lang = NULL; - free (title); -+ free (filename); - - return found; - } -@@ -3574,6 +3610,10 @@ 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); -+ if (database) { -+ free (database); -+ database = NULL; -+ } - if (catpath) { - database = mkdbname (catpath); - free (catpath); -@@ -3945,7 +3985,7 @@ static int man (const char *name, int *f - - for (cand = candidates; cand; cand = candnext) { - candnext = cand->next; -- free (cand); -+ free_candidate (cand); - } - - return *found ? OK : NOT_FOUND; -diff -up man-db-2.6.4/src/mandb.c.valgrind-mem man-db-2.6.4/src/mandb.c ---- man-db-2.6.4/src/mandb.c.valgrind-mem 2012-02-21 12:15:11.000000000 +0100 -+++ man-db-2.6.4/src/mandb.c 2013-06-24 18:32:18.618658899 +0200 -@@ -247,7 +247,7 @@ static int xcopy (const char *from, cons - } - - while (!feof (ifp) && !ferror (ifp)) { -- char buf[32 * 1024]; -+ char buf[9 * 1024]; - size_t in = fread (buf, 1, sizeof (buf), ifp); - if (in > 0) { - if (fwrite (buf, 1, in, ofp) == 0 && ferror (ofp)) { -diff -up man-db-2.6.4/src/manp.c.valgrind-mem man-db-2.6.4/src/manp.c ---- man-db-2.6.4/src/manp.c.valgrind-mem 2013-06-24 18:32:18.608659018 +0200 -+++ man-db-2.6.4/src/manp.c 2013-06-24 18:32:18.619658887 +0200 -@@ -504,6 +504,7 @@ static char *get_nls_manpath (const char - - closedir (mandir); - } -+ free (manpathlist_copy); - - free_locale_bits (&lbits); - return manpath; -@@ -567,6 +568,7 @@ char *add_nls_manpaths (char *manpathlis - free (locale_manpath); - } - } -+ free (locales_copy); - - /* Always try untranslated pages as a last resort. */ - locale_manpath = get_nls_manpath (manpathlist, "C"); -@@ -821,6 +823,11 @@ next: - free (buf); - buf = NULL; - } -+ -+ if (buf) { -+ free (buf); -+ buf = NULL; -+ } - } - - static void free_config_file (void *unused ATTRIBUTE_UNUSED) -diff -up man-db-2.6.4/src/whatis.c.valgrind-mem man-db-2.6.4/src/whatis.c ---- man-db-2.6.4/src/whatis.c.valgrind-mem 2012-06-18 12:23:37.000000000 +0200 -+++ man-db-2.6.4/src/whatis.c 2013-06-24 18:32:18.620658875 +0200 -@@ -501,7 +501,7 @@ static inline int do_whatis_section (con - - static int suitable_manpath (const char *manpath, const char *page_dir) - { -- char *page_manp; -+ char *page_manp, *pm; - char *page_manpathlist[MAXDIRS], **mp; - int ret; - -@@ -510,7 +510,9 @@ static int suitable_manpath (const char - free (page_manp); - return 0; - } -- page_manp = locale_manpath (page_manp); -+ pm = locale_manpath (page_manp); -+ free (page_manp); -+ page_manp = pm; - create_pathlist (page_manp, page_manpathlist); - - ret = 0; -@@ -554,6 +556,7 @@ static void do_whatis (const char * cons - debug ("%s not on manpath for %s\n", - manpath, page); - free (page_dir); -+ free (page); - continue; - } - } diff --git a/man-db.spec b/man-db.spec index cf050ae..03997ba 100644 --- a/man-db.spec +++ b/man-db.spec @@ -3,7 +3,7 @@ Summary: Tools for searching and reading man pages Name: man-db -Version: 2.6.4 +Version: 2.6.5 Release: 1%{?dist} # GPLv2+ .. man-db # GPLv3+ .. gnulib @@ -15,16 +15,10 @@ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.ta Source1: man-db.crondaily Source2: man-db.sysconfig -# resolves: #657409 -Patch3: man-db-2.6.1-locale-fallback.patch # resolves: #841431 Patch4: man-db-2.6.2-invalid-cache.patch # adds support for man-pages-overrides Patch5: man-db-2.6.3-overrides.patch -# fixed some compiler warnings -Patch6: man-db-2.6.3-gcc.patch -# fixed memory leaks detected by valgrind -Patch7: man-db-2.6.3-valgrind.patch # fixed certain man pages to match options with --help and --usage Patch8: man-db-2.6.3-man-options.patch @@ -48,11 +42,8 @@ manual pages. %prep %setup -q -%patch3 -p1 -b .locale-fallback %patch4 -p1 -b .invalid-cache %patch5 -p1 -b .overrides -%patch6 -p1 -b .gcc -%patch7 -p1 -b .valgrind-mem %patch8 -p1 -b .man-options %build @@ -136,6 +127,9 @@ install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/man-db %lang(zh_CN) %{_datadir}/man/zh_CN/man*/* %changelog +* Thu Jun 27 2013 Peter Schiffer - 2.6.5-1 +- updated to 2.6.5 + * Tue Jun 25 2013 Peter Schiffer - 2.6.4-1 - resolves: #977255 updated to 2.6.4 diff --git a/sources b/sources index 283f4f2..101a8bd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -66d9274637841a43374744efb83cc716 man-db-2.6.4.tar.xz +36f59d9314b45a266ba350584b4d7cc1 man-db-2.6.5.tar.xz