Don't store canonicalised versions of manpath elements

- resolves: #1043401
This commit is contained in:
Jan Chaloupka 2014-09-18 09:31:38 +02:00
parent e6e93291d3
commit cc7d744d46
2 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From 6748c88ed5ec74ec08226b46eb16eabf0d138a0d Mon Sep 17 00:00:00 2001
From: Jan Chaloupka <jchaloup@redhat.com>
Date: Wed, 17 Sep 2014 16:03:23 +0200
Subject: [PATCH] Don't store canonicalised versions of manpath elements
---
src/manp.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/manp.c b/src/manp.c
index 4501721..75e43f2 100644
--- a/src/manp.c
+++ b/src/manp.c
@@ -1219,7 +1219,7 @@ void create_pathlist (const char *manp, char **mp)
/* Eliminate duplicates due to symlinks. */
mp = mphead;
while (*mp) {
- char *target, *oldmp = NULL;
+ char *target;
char **dupcheck;
int found_dup = 0;
@@ -1227,20 +1227,25 @@ void create_pathlist (const char *manp, char **mp)
* manpath?
*/
target = canonicalize_file_name (*mp);
- if (target) {
- oldmp = *mp;
- *mp = target;
+ if (!target) {
+ ++mp;
+ continue;
}
/* Only check up to the current list position, to keep item
* order stable across deduplication.
*/
for (dupcheck = mphead; *dupcheck && dupcheck != mp;
++dupcheck) {
- if (!STREQ (*mp, *dupcheck))
+ char *dupcheck_target = canonicalize_file_name
+ (*dupcheck);
+ if (!STREQ (target, dupcheck_target)) {
+ free (dupcheck_target);
continue;
+ }
+ free (dupcheck_target);
debug ("Removing duplicate manpath entry %s (%td) -> "
"%s (%td)\n",
- oldmp, mp - mphead,
+ *mp, mp - mphead,
*dupcheck, dupcheck - mphead);
free (*mp);
for (dupcheck = mp; *(dupcheck + 1); ++dupcheck)
@@ -1249,8 +1254,7 @@ void create_pathlist (const char *manp, char **mp)
found_dup = 1;
break;
}
- if (oldmp)
- free (oldmp);
+ free (target);
if (!found_dup)
++mp;
}
--
1.9.3

View File

@ -4,7 +4,7 @@
Summary: Tools for searching and reading man pages
Name: man-db
Version: 2.6.7.1
Release: 6%{?dist}
Release: 7%{?dist}
# GPLv2+ .. man-db
# GPLv3+ .. gnulib
License: GPLv2+ and GPLv3+
@ -16,6 +16,7 @@ Source1: man-db.crondaily
Source2: man-db.sysconfig
Patch0: 1110274-Add-systemd-tmpfiles-snippet-to-clean-up-old-cat-fil.patch
Patch1: 1043401-Don-t-store-canonicalised-versions-of-manpath-elemen.patch
Obsoletes: man < 2.0
Provides: man = %{version}
@ -38,6 +39,7 @@ manual pages.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
%configure \
@ -127,6 +129,10 @@ install -D -p -m 0644 init/systemd/man-db.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.
%lang(zh_CN) %{_datadir}/man/zh_CN/man*/*
%changelog
* Thu Sep 18 2014 jchaloup <jchaloup@redhat.com> - 2.6.7.1-7
- resolves: #1043401
Don't store canonicalised versions of manpath elements
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6.7.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild