Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/catman Add notes on how to lift the BUGS entry in t...



details:   https://anonhg.NetBSD.org/src/rev/6f0b9f257a77
branches:  trunk
changeset: 345465:6f0b9f257a77
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun May 29 22:32:03 2016 +0000

description:
Add notes on how to lift the BUGS entry in the man page (about not
supporting hardlinks) in case anyone thinks it's worth doing sometime.

diffstat:

 usr.sbin/catman/README.hardlinks |  32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diffs (36 lines):

diff -r da2990f43178 -r 6f0b9f257a77 usr.sbin/catman/README.hardlinks
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/catman/README.hardlinks  Sun May 29 22:32:03 2016 +0000
@@ -0,0 +1,32 @@
+# $NetBSD: README.hardlinks,v 1.1 2016/05/29 22:32:03 dholland Exp $
+#
+
+catman.8 notes that this code doesn't handle hard links.
+
+To fix this, one might proceed as follows:
+
+(1) Add an additional data structure mapping (fsid_t, ino_t) pairs
+from stat to filenames.
+
+(2) In scanmandir(), in the readdir loop, next to the code that checks
+for a symlink, check if the page's linkcount > 1 (manstat.st_nlink > 1)
+and if so:
+   a. Check the new data structure to see if this file's been seen before.
+      If so, use the saved name of the page to construct a hard link in the
+      cat directory, and continue to the next directory entry.
+   b. If not, add to the new data structure to remember this page and
+      process it as normal.
+
+One might clear the data structure for each mandir or not; probably
+for each man tree is best. The size of the structure isn't
+prohibitive; but the chances of ever seeing the same hardlinked page
+in two different man trees (e.g. in both /usr/share/man and
+/usr/pkg/man) are pretty well zero.
+
+All of this seems like a SMOP, but it doesn't really seem worth doing
+at the moment given that we don't build catpages at all by default and
+they aren't particularly useful to have any more except on the slowest
+of slow hardware. I've left this note so that someone else can take it
+up if they see fit.
+
+ - dholland 20160529



Home | Main Index | Thread Index | Old Index