Bug#389762: man-db: cannot select manpage correctly with LANG=ja_JP.UTF-8

2008-12-08 Thread Colin Watson
tags 389762 fixed-upstream
thanks

On Wed, Dec 03, 2008 at 12:35:58PM +, Colin Watson wrote:
 The case of select is somewhat confusing. There's an ordinary page in
 section 2 (both for English and Japanese), which is straightforward. If
 you install manpages-posix-dev then there's also an ordinary page in
 section 3 with extension posix. However, manpages-dev installs links to
 select(2) as both FD_ZERO(2) and FD_ZERO(3) (I don't know why), and the
 section 3 version is spotted when doing a database lookup. This is why
 you get the duplication of /usr/share/man/man2/select.2.gz - at the
 level where man is checking for duplicate candidates, it sees that
 they're in different sections and therefore distinct, but it hasn't
 realised that the section 3 page is actually a symlink into section 2.
 
 As of man-db 2.5.0, there are databases for non-English hierarchies as
 well, and I think this has papered over the problem because the bizarre
 section 3 page shows up for Japanese as well. However, the fact that the
 duplication isn't noticed and the fact that the whole list isn't
 properly sorted are still bugs.
 
 For my own reference: it would probably be best to fix the sorting
 first, since I have a good reproduction case here.

I've now fixed this for the next upstream release (man-db 2.5.4). On my
system, the bug showed up as follows:

  $ man -aw select
  /usr/share/man/man2/select.2.gz
  /usr/share/man/man2/select.2.gz
  /usr/share/man/man3/select.3posix.gz
  $ LC_ALL=ja_JP.UTF-8 man -aw select
  /usr/share/man/ja/man2/select.2.gz
  /usr/share/man/man2/select.2.gz
  /usr/share/man/ja/man2/select.2.gz
  /usr/share/man/man2/select.2.gz
  /usr/share/man/man3/select.3posix.gz

The corrected version behaves as follows instead:

  $ src/man -aw select
  /usr/share/man/man2/select.2.gz
  /usr/share/man/man3/select.3posix.gz
  $ LC_ALL=ja_JP.UTF-8 src/man -aw select
  /usr/share/man/ja/man2/select.2.gz
  /usr/share/man/man2/select.2.gz
  /usr/share/man/man3/select.3posix.gz

Mon Dec  8 10:08:45 GMT 2008  Colin Watson  [EMAIL PROTECTED]

Improve sorting and de-duplication of manual page candidates (Debian
bug #389762).

* src/man.c (struct candidate): Add ult member.
  (duplicate_candidates): Pare down to only check for duplication
  rather than trying to compare as well; the latter function is now
  handled entirely by compare_candidates. Compare the ultimate
  source file as the first test.
  (compare_candidates): Compare locale elements in candidate paths
  before comparing sections.
  (add_candidates): Look up the ultimate source file if necessary,
  and save it in the candidate structure. Use duplicate_candidates
  for duplicate testing only and compare_candidates for comparison.
  Insert elements at the latest possible position rather than the
  earliest possible.
  (try_section): Pass the ultimate source file that was already
  looked up here.
  (try_db): Adjust for new add_candidate signature.

Thanks for helping to improve man-db!

-- 
Colin Watson   [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#389762: man-db: cannot select manpage correctly with LANG=ja_JP.UTF-8

2008-12-03 Thread Colin Watson
On Thu, Sep 28, 2006 at 12:08:38AM +0900, KISE Hiroshi wrote:
 case 1: installed manpages-dev and manpages-ja-dev, not installed
  manpages-posix-dev
 
 $ LANG=ja_JP.UTF-8 man -a -w select
 /usr/share/man/man2/select.2.gz
 /usr/share/man/ja/man2/select.2.gz
 /usr/share/man/man2/select.2.gz
 $ LANG=ja_JP.UTF-8 man -w select
 /usr/share/man/man2/select.2.gz
 
 It's incorrect.  I expected result /usr/share/man/ja/man2/select.2.gz.

This particular instance of the problem is not reproducible any more,
but I think the underlying bug is still present.

man processes the manpath twice (at least if you use -a). In the first
phase, it looks in the filesystem; in the second phase, it looks in its
database. In each phase it looks through the possible sections and tries
to determine which pages are preferable.

The case of select is somewhat confusing. There's an ordinary page in
section 2 (both for English and Japanese), which is straightforward. If
you install manpages-posix-dev then there's also an ordinary page in
section 3 with extension posix. However, manpages-dev installs links to
select(2) as both FD_ZERO(2) and FD_ZERO(3) (I don't know why), and the
section 3 version is spotted when doing a database lookup. This is why
you get the duplication of /usr/share/man/man2/select.2.gz - at the
level where man is checking for duplicate candidates, it sees that
they're in different sections and therefore distinct, but it hasn't
realised that the section 3 page is actually a symlink into section 2.

As of man-db 2.5.0, there are databases for non-English hierarchies as
well, and I think this has papered over the problem because the bizarre
section 3 page shows up for Japanese as well. However, the fact that the
duplication isn't noticed and the fact that the whole list isn't
properly sorted are still bugs.

For my own reference: it would probably be best to fix the sorting
first, since I have a good reproduction case here.

Thanks,

-- 
Colin Watson   [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#389762: man-db: cannot select manpage correctly with LANG=ja_JP.UTF-8

2006-09-27 Thread KISE Hiroshi
Package: man-db
Version: 2.4.3-3
Severity: important

case 1: installed manpages-dev and manpages-ja-dev, not installed
 manpages-posix-dev

$ LANG=ja_JP.UTF-8 man -a -w select
/usr/share/man/man2/select.2.gz
/usr/share/man/ja/man2/select.2.gz
/usr/share/man/man2/select.2.gz
$ LANG=ja_JP.UTF-8 man -w select
/usr/share/man/man2/select.2.gz

It's incorrect.  I expected result /usr/share/man/ja/man2/select.2.gz.

case 2: installed manpages-dev, manpages-ja-dev and manpages-posix-dev
$ LANG=ja_JP.UTF-8 man -a -w select
/usr/share/man/man2/select.2.gz
/usr/share/man/ja/man2/select.2.gz
/usr/share/man/man2/select.2.gz
/usr/share/man/man3/select.3posix.gz
$ LANG=ja_JP.UTF-8 man -w select
/usr/share/man/ja/man2/select.2.gz

It's correct.

$ egrep ^SECTION /etc/manpath.config
SECTION 1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7

I attached debug outputs of man -d -w select for each case.
man-debug-1.txt for case 1, man-debug-2.txt for case 2.
(file encoding is UTF-8)

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=ja_JP.eucJP, LC_CTYPE=ja_JP.eucJP (charmap=EUC-JP)

Versions of packages man-db depends on:
ii  bsdmainutils 6.1.4   collection of more utilities from 
ii  debconf [debconf-2.0]1.5.4   Debian configuration management sy
ii  dpkg 1.13.21 package maintenance system for Deb
ii  groff-base   1.18.1.1-12 GNU troff text-formatting system (
ii  libc62.3.6.ds1-4 GNU C Library: Shared libraries
ii  libgdbm3 1.8.3-3 GNU dbm database routines (runtime

man-db recommends no packages.

-- debconf information:
  man-db/build-database: true
  man-db/rebuild-database: true
* man-db/install-setuid: false


man-debug.tar.gz
Description: Binary data