public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* mandb -p deleting "obsolete" Windows cat directories
@ 2018-01-23  1:49 Brian Inglis
       [not found] ` <5A66C996.6010808@tlinx.org>
  2018-01-23 23:31 ` Hans-Bernhard Bröker
  0 siblings, 2 replies; 3+ messages in thread
From: Brian Inglis @ 2018-01-23  1:49 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1757 bytes --]

Recently loaded up a bunch of man pages for other systems ("man -m SYSTEM") for
use across installs under /proc/cygdrive/c/usr/local/share/man/...

To make these usable I added short symlinks in those directories, added those to
/etc/man_db.conf (attached) with associated catpaths, then ran mandb -p
(--no-purge), which took a long time.

I was surprised when I looked at the log (attached, with lots of man directory
indexing stripped), that mandb -p decide to scan my C drive and perform the
undocumented action of removing Windows localization cat directories that it
considers obsolete e.g.
"...
Removing obsolete cat directory /proc/cygdrive/c/Windows/en-US...
"
which is kind of worrisome, especially when the complete path is not shown!

Question is why does mandb scan the whole drive, think Windows cat directories
are its property, delete them while running with -p, and suggestions for how I
can stop mandb doing that, including configuration or system changes, or
approaches to mandb patches, I can make to do that?

I have renamed /etc/postinstall/zp_man-db.sh temporarily to avoid future surprises.

--------------------
MANPATH is the result of a profile script developed over the years to set up all
useful man directories on various systems, without duplicates, depending on
whether they are accessible from each system at login.

$ echo $MANPATH
/usr/local/man:/usr/man:/usr/ssl/man:/usr/share/sendmail/man:/usr/share/texmf-dist/doc/man:/proc/cygdrive/c/usr/local/share/man:/proc/cygdrive/c/usr/local/cygwin32/usr/share/man:/proc/cygdrive/c/usr/local/ubuntu/usr/share/man:/proc/cygdrive/c/usr/local/ast/src/lib/libast/man:/proc/cygdrive/c/usr/local/ast/arch/cygwin.i386/man:

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

[-- Attachment #2: man_db.conf --]
[-- Type: text/plain, Size: 6523 bytes --]

# gdbm
#
# This file is used by the man-db package to configure the man and cat paths.
# It is also used to provide a manpath for those without one by examining
# their PATH environment variable. For details see the manpath(5) man page.
#
# Lines beginning with `#' are comments and are ignored. Any combination of
# tabs or spaces may be used as `whitespace' separators.
#
# There are three mappings allowed in this file:
# --------------------------------------------------------
# MANDATORY_MANPATH			manpath_element
# MANPATH_MAP		path_element	manpath_element
# MANDB_MAP		global_manpath	[relative_catpath]
#---------------------------------------------------------
# every automatically generated MANPATH includes these fields
#
#MANDATORY_MANPATH 			/usr/src/pvm3/man
#
MANDATORY_MANPATH			/usr/man
MANDATORY_MANPATH			/usr/share/man
MANDATORY_MANPATH			/usr/local/share/man
#---------------------------------------------------------
# set up PATH to MANPATH mapping
# ie. what man tree holds man pages for what binary directory.
#
#		*PATH*        ->	*MANPATH*
#
MANPATH_MAP	/bin			/usr/share/man
MANPATH_MAP	/usr/bin		/usr/share/man
MANPATH_MAP	/sbin			/usr/share/man
MANPATH_MAP	/usr/sbin		/usr/share/man
MANPATH_MAP	/usr/local/bin		/usr/local/man
MANPATH_MAP	/usr/local/bin		/usr/local/share/man
MANPATH_MAP	/usr/local/sbin		/usr/local/man
MANPATH_MAP	/usr/local/sbin		/usr/local/share/man
MANPATH_MAP	/usr/X11R6/bin		/usr/X11R6/man
MANPATH_MAP	/usr/bin/X11		/usr/X11R6/man
MANPATH_MAP	/usr/games		/usr/share/man
MANPATH_MAP	/opt/bin		/opt/man
MANPATH_MAP	/opt/sbin		/opt/man
#---------------------------------------------------------
# For a manpath element to be treated as a system manpath (as most of those
# above should normally be), it must be mentioned below. Each line may have
# an optional extra string indicating the catpath associated with the
# manpath. If no catpath string is used, the catpath will default to the
# given manpath.
#
# You *must* provide all system manpaths, including manpaths for alternate
# operating systems, locale specific manpaths, and combinations of both, if
# they exist, otherwise the permissions of the user running man/mandb will
# be used to manipulate the manual pages. Also, mandb will not initialise
# the database cache for any manpaths not mentioned below unless explicitly
# requested to do so.
#
# In a per-user configuration file, this directive only controls the
# location of catpaths and the creation of database caches; it has no effect
# on privileges.
#
# Any manpaths that are subdirectories of other manpaths must be mentioned
# *before* the containing manpath. E.g. /usr/man/preformat must be listed
# before /usr/man.
#
#		*MANPATH*     ->	*CATPATH*
#
MANDB_MAP	/usr/man		/var/cache/man/fsstnd
MANDB_MAP	/usr/share/man		/var/cache/man
MANDB_MAP	/usr/local/man		/var/cache/man/oldlocal
MANDB_MAP	/usr/local/share/man	/var/cache/man/local
MANDB_MAP	/usr/X11R6/man		/var/cache/man/X11R6
MANDB_MAP	/opt/man		/var/cache/man/opt
#		*MANPATH*		    ->			*CATPATH*
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/centos	/proc/cygdrive/c/var/cache/man/centos
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/darwin	/proc/cygdrive/c/var/cache/man/darwin
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/debian	/proc/cygdrive/c/var/cache/man/debian
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/freebsd	/proc/cygdrive/c/var/cache/man/freebsd
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/hpux	/proc/cygdrive/c/var/cache/man/hpux
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/netbsd	/proc/cygdrive/c/var/cache/man/netbsd
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/openbsd	/proc/cygdrive/c/var/cache/man/openbsd
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/ports	/proc/cygdrive/c/var/cache/man/ports
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/redhat	/proc/cygdrive/c/var/cache/man/redhat
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/solaris	/proc/cygdrive/c/var/cache/man/solaris
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/suse	/proc/cygdrive/c/var/cache/man/suse
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/ubuntu	/proc/cygdrive/c/var/cache/man/ubuntu
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man/x		/proc/cygdrive/c/var/cache/man/x
MANDB_MAP	/proc/cygdrive/c/usr/local/share/man		/proc/cygdrive/c/var/cache/man/local
MANDB_MAP	/proc/cygdrive/c/usr/local/man			/proc/cygdrive/c/var/cache/man/oldlocal
#
#---------------------------------------------------------
# Program definitions.  These are commented out by default as the value
# of the definition is already the default.  To change: uncomment a
# definition and modify it.
#
#DEFINE 	pager	less
#DEFINE 	cat	cat
#DEFINE 	tr	tr '\255\267\264\327' '\055\157\047\170'
#DEFINE		grep	grep
#DEFINE 	troff 	groff -mandoc
#DEFINE 	nroff 	nroff -mandoc
#DEFINE 	eqn 	eqn
#DEFINE 	neqn	neqn
#DEFINE 	tbl 	tbl
#DEFINE 	col 	col
#DEFINE 	vgrind 	
#DEFINE 	refer 	refer
#DEFINE 	grap 	
#DEFINE 	pic 	pic -S
#
#DEFINE		compressor	gzip -c7
#---------------------------------------------------------
# Misc definitions: same as program definitions above.
#
#DEFINE		whatis_grep_flags		-i
#DEFINE		apropos_grep_flags		-iEw
#DEFINE		apropos_regex_grep_flags	-iE
#---------------------------------------------------------
# Section names. Manual sections will be searched in the order listed here;
# the default is 1, n, l, 8, 3, 0, 2, 5, 4, 9, 6, 7. Multiple SECTION
# directives may be given for clarity, and will be concatenated together in
# the expected way.
# If a particular extension is not in this list (say, 1mh), it will be
# displayed with the rest of the section it belongs to. The effect of this
# is that you only need to explicitly list extensions if you want to force a
# particular order. Sections with extensions should usually be adjacent to
# their main section (e.g. "1 1mh 8 ...").
#
SECTION		1 1p 8 2 3 3p 4 5 6 7 9 0p n
#
#---------------------------------------------------------
# Range of terminal widths permitted when displaying cat pages. If the
# terminal falls outside this range, cat pages will not be created (if
# missing) or displayed.
#
#MINCATWIDTH	80
#MAXCATWIDTH	80
#
# If CATWIDTH is set to a non-zero number, cat pages will always be
# formatted for a terminal of the given width, regardless of the width of
# the terminal actually being used. This should generally be within the
# range set by MINCATWIDTH and MAXCATWIDTH.
#
#CATWIDTH	0
#
#---------------------------------------------------------
# Flags.
# NOCACHE keeps man from creating cat pages.
#NOCACHE

[-- Attachment #3: mandb.log --]
[-- Type: text/plain, Size: 4799 bytes --]

/usr/bin/mandb: warning: $MANPATH set, appending /etc/man_db.conf
...
Processing manual pages under /proc/cygdrive/c...
Processing manual pages under /proc/cygdrive/c/$GetCurrent...
Processing manual pages under /proc/cygdrive/c/$Recycle.Bin...
Processing manual pages under /proc/cygdrive/c/AMD...
Processing manual pages under /proc/cygdrive/c/bin...
Processing manual pages under /proc/cygdrive/c/Boot...
Processing manual pages under /proc/cygdrive/c/Config.Msi...
/usr/bin/mandb: can't search directory /proc/cygdrive/c/Config.Msi: Permission denied
Processing manual pages under /proc/cygdrive/c/dev...
Processing manual pages under /proc/cygdrive/c/Documents and Settings...
Processing manual pages under /proc/cygdrive/c/etc...
Processing manual pages under /proc/cygdrive/c/home...
Processing manual pages under /proc/cygdrive/c/inetpub...
Processing manual pages under /proc/cygdrive/c/lib...
Processing manual pages under /proc/cygdrive/c/Logs...
Processing manual pages under /proc/cygdrive/c/MSOCache...
Processing manual pages under /proc/cygdrive/c/OEM...
Processing manual pages under /proc/cygdrive/c/PerfLogs...
Processing manual pages under /proc/cygdrive/c/proc...
Processing manual pages under /proc/cygdrive/c/Program Files...
Processing manual pages under /proc/cygdrive/c/Program Files (x86)...
Processing manual pages under /proc/cygdrive/c/ProgramData...
Processing manual pages under /proc/cygdrive/c/Recovery...
/usr/bin/mandb: can't search directory /proc/cygdrive/c/Recovery: Permission denied
Processing manual pages under /proc/cygdrive/c/run...
Processing manual pages under /proc/cygdrive/c/sbin...
Processing manual pages under /proc/cygdrive/c/Swsetup...
Processing manual pages under /proc/cygdrive/c/System Volume Information...
/usr/bin/mandb: can't search directory /proc/cygdrive/c/System Volume Information: Permission denied
Processing manual pages under /proc/cygdrive/c/tmp...
Processing manual pages under /proc/cygdrive/c/Users...
Processing manual pages under /proc/cygdrive/c/usr...
Processing manual pages under /proc/cygdrive/c/var...
Processing manual pages under /proc/cygdrive/c/Windows...
Removing obsolete cat directory /proc/cygdrive/c/Boot/bg-BG...
Removing obsolete cat directory /proc/cygdrive/c/Boot/cs-CZ...
Removing obsolete cat directory /proc/cygdrive/c/Boot/da-DK...
Removing obsolete cat directory /proc/cygdrive/c/Boot/de-DE...
Removing obsolete cat directory /proc/cygdrive/c/Boot/el-GR...
Removing obsolete cat directory /proc/cygdrive/c/Boot/en-GB...
Removing obsolete cat directory /proc/cygdrive/c/Boot/en-US...
Removing obsolete cat directory /proc/cygdrive/c/Boot/es-ES...
Removing obsolete cat directory /proc/cygdrive/c/Boot/es-MX...
Removing obsolete cat directory /proc/cygdrive/c/Boot/et-EE...
Removing obsolete cat directory /proc/cygdrive/c/Boot/fi-FI...
Removing obsolete cat directory /proc/cygdrive/c/Boot/fr-CA...
Removing obsolete cat directory /proc/cygdrive/c/Boot/fr-FR...
Removing obsolete cat directory /proc/cygdrive/c/Boot/hr-HR...
Removing obsolete cat directory /proc/cygdrive/c/Boot/hu-HU...
Removing obsolete cat directory /proc/cygdrive/c/Boot/it-IT...
Removing obsolete cat directory /proc/cygdrive/c/Boot/ja-JP...
Removing obsolete cat directory /proc/cygdrive/c/Boot/ko-KR...
Removing obsolete cat directory /proc/cygdrive/c/Boot/lt-LT...
Removing obsolete cat directory /proc/cygdrive/c/Boot/lv-LV...
Removing obsolete cat directory /proc/cygdrive/c/Boot/nb-NO...
Removing obsolete cat directory /proc/cygdrive/c/Boot/nl-NL...
Removing obsolete cat directory /proc/cygdrive/c/Boot/pl-PL...
Removing obsolete cat directory /proc/cygdrive/c/Boot/pt-BR...
Removing obsolete cat directory /proc/cygdrive/c/Boot/pt-PT...
Removing obsolete cat directory /proc/cygdrive/c/Boot/ro-RO...
Removing obsolete cat directory /proc/cygdrive/c/Boot/ru-RU...
Removing obsolete cat directory /proc/cygdrive/c/Boot/sk-SK...
Removing obsolete cat directory /proc/cygdrive/c/Boot/sl-SI...
Removing obsolete cat directory /proc/cygdrive/c/Boot/sr-Latn-CS...
Removing obsolete cat directory /proc/cygdrive/c/Boot/sr-Latn-RS...
Removing obsolete cat directory /proc/cygdrive/c/Boot/sv-SE...
Removing obsolete cat directory /proc/cygdrive/c/Boot/tr-TR...
Removing obsolete cat directory /proc/cygdrive/c/Boot/uk-UA...
Removing obsolete cat directory /proc/cygdrive/c/Boot/zh-CN...
Removing obsolete cat directory /proc/cygdrive/c/Boot/zh-HK...
Removing obsolete cat directory /proc/cygdrive/c/Boot/zh-TW...
Removing obsolete cat directory /proc/cygdrive/c/Program Files (x86)/gs...
Removing obsolete cat directory /proc/cygdrive/c/Program Files/gs...
Removing obsolete cat directory /proc/cygdrive/c/Windows/en-US...
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.


[-- Attachment #4: Type: text/plain, Size: 219 bytes --]


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mandb -p deleting "obsolete" Windows cat directories
       [not found] ` <5A66C996.6010808@tlinx.org>
@ 2018-01-23 11:02   ` Brian Inglis
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Inglis @ 2018-01-23 11:02 UTC (permalink / raw)
  To: cygwin

On 2018-01-22 22:35, L A Walsh wrote:
> Brian Inglis wrote:
>> Removing obsolete cat directory /proc/cygdrive/c/Windows/en-US...
>> "
>> which is kind of worrisome, especially when the complete path is not shown!
>>   
> Ouch!
> 
> You might try loading the source of the program and searching for 'obsolete'
> in the sources -- (grep -ir obsolete '<dir>').  Comments or notes might give
> some hints..?

Obvious patch is "if (purge) purge_catdirs(...);" which disables it with -p.

Already looked and no obvious reason why whole drive scanned, rather than just
system cat dirs without matching man dirs.

Need to check further if it tests that cat dirs are empty before removal.
I use cat dirs for e.g. Windows help, command /?, program --help output,
anything without man pages, to avoid having to remember how to do that.
I don't want those purged either - I would be mighty POed - some are from
strings searches thru exes and online docs!

>> Question is why does mandb scan the whole drive, think Windows cat
>> directories are its property, delete them while running with -p, and
>> suggestions for how> Also, might check if any of places it scans are symlinks?
Most man symlinks are created by me for specific purposes and valid from my
checks using "find -L ... -type l | xargs ls -dl --color".
PATH profile function checks for accessible real path names to guarantee order,
existence, eliminate duplicates, and reduce search overhead.

Looks like I have to patch as above, rebuild with debuginfo, and run with
debugging output under gdb.
Then I want to complete the details on the mandb page, as any directory starting
with two lowercase letters, optionally followed by any non-lowercase character,
with any subdirectory starting with cat, without a matching subdirectory
starting with man followed by the (possibly null) suffix for cat, gets wiped
e.g. abZ/catalog/ goes unless abZ/manalog/ exists.
Then possibly add another option --no-purge-obsolete patch to switch that off!

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mandb -p deleting "obsolete" Windows cat directories
  2018-01-23  1:49 mandb -p deleting "obsolete" Windows cat directories Brian Inglis
       [not found] ` <5A66C996.6010808@tlinx.org>
@ 2018-01-23 23:31 ` Hans-Bernhard Bröker
  1 sibling, 0 replies; 3+ messages in thread
From: Hans-Bernhard Bröker @ 2018-01-23 23:31 UTC (permalink / raw)
  To: cygwin

Am 23.01.2018 um 02:49 schrieb Brian Inglis:

> I was surprised when I looked at the log (attached, with lots of man directory > indexing stripped), that mandb -p decide to scan my C drive and 
perform the

It probably wasn't actually scanning "the C drive" as such, but rather 
the neighboring directories of those listed in your $PATH to discover 
further worthy additions to $MANPATH.  And since %windir% and 
%windir%\System32 are on the default Cygwin $PATH...

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-23 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23  1:49 mandb -p deleting "obsolete" Windows cat directories Brian Inglis
     [not found] ` <5A66C996.6010808@tlinx.org>
2018-01-23 11:02   ` Brian Inglis
2018-01-23 23:31 ` Hans-Bernhard Bröker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).