Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makemandb Don't ignore symlinks.



details:   https://anonhg.NetBSD.org/src/rev/dcab92814b8c
branches:  trunk
changeset: 349657:dcab92814b8c
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Sat Dec 17 17:04:38 2016 +0000

description:
Don't ignore symlinks.
There can be symlinks which are pointing to man pages not installed in
one of the _default locations mentioned in man.conf or MANPATH. For example
there are man pages in /usr/pkg/man which are symlinked to pages in
/usr/pkg/lib/perl5/man. If we ignore symlinks, we would not be able to
index such pages installed outside the default set of directories.

(Also, the symlink test was incorecct, so we never noticed this issue)

Ok christos@, wiz@

diffstat:

 usr.sbin/makemandb/makemandb.c |  28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diffs (66 lines):

diff -r b7a1e364ce6e -r dcab92814b8c usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c    Sat Dec 17 17:04:04 2016 +0000
+++ b/usr.sbin/makemandb/makemandb.c    Sat Dec 17 17:04:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makemandb.c,v 1.44 2016/10/03 16:11:11 abhinav Exp $   */
+/*     $NetBSD: makemandb.c,v 1.45 2016/12/17 17:04:38 abhinav Exp $   */
 /*
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: makemandb.c,v 1.44 2016/10/03 16:11:11 abhinav Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.45 2016/12/17 17:04:38 abhinav Exp $");
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -526,9 +526,10 @@
                        }
                }
                closedir(dp);
+               return;
        }
 
-       if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
+       if (!S_ISREG(sb.st_mode))
                return;
 
        if (sb.st_size == 0) {
@@ -820,15 +821,8 @@
                if (md5_status == 0) {
                        /*
                         * The MD5 hash is already present in the database,
-                        * so simply update the metadata, ignoring symlinks.
+                        * so simply update the metadata.
                         */
-                       struct stat sb;
-                       stat(file, &sb);
-                       if (S_ISLNK(sb.st_mode)) {
-                               free(md5sum);
-                               link_count++;
-                               continue;
-                       }
                        update_existing_entry(db, file, md5sum, rec,
                            &new_count, &link_count, &err_count);
                        free(md5sum);
@@ -867,12 +861,12 @@
        }
 
        if (mflags.verbosity == 2) {
-               printf("Total Number of new or updated pages encountered = %d\n"
-                   "Total number of (hard or symbolic) links found = %d\n"
-                   "Total number of pages that were successfully"
-                   " indexed/updated = %d\n"
-                   "Total number of pages that could not be indexed"
-                   " due to errors = %d\n",
+               printf("Number of new or updated pages encountered: %d\n"
+                   "Number of hard links found: %d\n"
+                   "Number of pages that were successfully"
+                   " indexed or updated: %d\n"
+                   "Number of pages that could not be indexed"
+                   " due to errors: %d\n",
                    total_count - link_count, link_count, new_count, err_count);
        }
 



Home | Main Index | Thread Index | Old Index