NetBSD Problem Report #47701

From root@garbled.net  Thu Mar 28 03:33:40 2013
Return-Path: <root@garbled.net>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id DA81263F314
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 28 Mar 2013 03:33:39 +0000 (UTC)
Message-Id: <20130328033332.8FDA25B667@polaris.garbled.net>
Date: Wed, 27 Mar 2013 20:33:32 -0700 (MST)
From: root@garbled.net
Reply-To: root@garbled.net
To: gnats-bugs@gnats.NetBSD.org
Subject: apropos doesn't work
X-Send-Pr-Version: 3.95

>Number:         47701
>Category:       bin
>Synopsis:       apropos doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 28 03:35:00 +0000 2013
>Closed-Date:    Sun May 29 23:51:05 +0000 2016
>Last-Modified:  Sun May 29 23:51:05 +0000 2016
>Originator:     Tim Rightnour
>Release:        NetBSD 6.0.1
>Organization:

>Environment:


System: NetBSD polaris.garbled.net 6.0.1 NetBSD 6.0.1 (GENERIC) i386
Architecture: i386
Machine: i386
>Description:
The new apropos in 6, doesn't seem to give reasonable results.  While trying
to find the usbdevs(8) command, I ran:
apropos -C usb

and got:
alcyone# apropos -C usb
usb (4) Universal Serial Bus driver
usbhid (3) USB HID access routines
cdce (4)   USB Communication Device Class Ethernet driver
ulpt (4)   USB printer support
uep (4) USB eGalax Touchpanel
ukbd (4)   USB keyboard support
cue (4) CATC USB-EL1201A USB Ethernet driver
uts (4) USB generic touchscreens
umodem (4) USB modem support
ucom (4)   USB tty support

If I want to find usbdevs, apparently I have to do -C8 ?? 

Aside from that, I find the new format of man -k to be obnoxious.  Can we
revert to the historical display, or maybe make it sensitive to an environment
var, like OLDMAN=YES ? :)

>How-To-Repeat:
man -k usb

There are lots of other examples, I haven't been able to find lots of commands


>Fix:
ENOCLUE


>Release-Note:

>Audit-Trail:
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 08:31:13 +0400

 On Thu, Mar 28, 2013 at 03:35:01 +0000, root@garbled.net wrote:

 > If I want to find usbdevs, apparently I have to do -C8 ?? 

 Apparently apropos now prints (silently) just the first 10 results!

 You need to use -p to tell it to return everything.  Except the way -p
 invokes pager seems broken since it uses popen.

 -uwe

From: Jukka Ruohonen <jruohonen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 06:58:26 +0200

 On Thu, Mar 28, 2013 at 03:35:01AM +0000, root@garbled.net wrote:
 > The new apropos in 6, doesn't seem to give reasonable results.

 I beg to disagree. What would the old appropos find for DTV USB devices?
 Many pages of garbage, whereas:

 apropos "USB DTV" 
 dtviic (4)      Inter IC (I2C) modules for DTV
 ...support for dtv(4) devices. The dtviic au8522 cx24227 lg3303 mt2131 nxt2k
 zl10353 tvpll xc3028 xc5k module group includes tuners, demodulators, and
 analog video decoders. The usual hardware structure consists of a host
 controller (connected for instance via usb(4...

 emdtv (4)       digital video driver for Empia Technology EM28xx based cards
 ...in USB products. Supported cards include: Device Demodulator Tuner ATI TV
 Wonder 600 USB lg3303(4) xc3028(4) (XC3028L) The XC3028L digital tuner
 requires firmware. This is provided by the pkgsrc/sysutils/xc3028l-firmware
 package. dtv(4) , dtviic(4) , usb...

 auvitek (4)     Auvitek AU0828 video capture device driver
 ...USB video capture devices based on the Auvitek AU0828 bridge. This hybrid
 analog/digital device requires a hi-speed
 USB...pkgsrc/sysutils/xc5k-firmware package to function properly. audio(4) ,
 dtv(4) , dtviic(4) , ehci(4) , uaudio(4) , video(4...

 MAKEDEV (8)     create system and device special files
 ...4) USB devices : usb# USB control devices, see usb(4) uhid# USB generic
 HID devices, see uhid(4) ulpt# USB...Direct Rendering Manager interface, see
 drm(4)v# Digital TV interface, see dtv(4) fb# PMAX generic framebuffer
 pseudo-device...

 - Jukka.

From: Tim Rightnour <root@garbled.net>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/47701: apropos doesn't work
Date: Wed, 27 Mar 2013 22:41:44 -0700 (MST)

 I notice that the pager gives some odd results. On my primary box, I get this
 at the bottom:

 wsconsctl (8)   get or set wscons state
 --More--(byte 1197)polaris# 

 And then it blanks out my prompt.  (via xterm)

 Another box I'm ssh'd into via an xterm, gives me a screen full of esc codes.

 Also, a strange result, I get less results from "apropos -C8p de", than I do
 from "apropos -C8p dev"

 I think some of the new matching code is really neat, but I'm completely
 confounded by what it does and doesn't find.

 On 28-Mar-2013 Valery Ushakov wrote:
 > The following reply was made to PR bin/47701; it has been noted by GNATS.
 > 
 > From: Valery Ushakov <uwe@stderr.spb.ru>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: bin/47701: apropos doesn't work
 > Date: Thu, 28 Mar 2013 08:31:13 +0400
 > 
 >  On Thu, Mar 28, 2013 at 03:35:01 +0000, root@garbled.net wrote:
 >  
 >  > If I want to find usbdevs, apparently I have to do -C8 ?? 
 >  
 >  Apparently apropos now prints (silently) just the first 10 results!
 >  
 >  You need to use -p to tell it to return everything.  Except the way -p
 >  invokes pager seems broken since it uses popen.
 >  
 >  -uwe
 >  

 ---
 Tim Rightnour <root@garbled.net>
 NetBSD: Free multi-architecture OS http://www.netbsd.org/
 Genecys: Open Source 3D MMORPG: http://www.genecys.org/

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 05:47:26 +0000

 On Wed, Mar 27, 2013 at 10:41:44PM -0700, Tim Rightnour wrote:
  > Also, a strange result, I get less results from "apropos -C8p de", than I do
  > from "apropos -C8p dev"
  > 
  > I think some of the new matching code is really neat, but I'm completely
  > confounded by what it does and doesn't find.

 It's using a real text retrieval engine, so "de" is more likely to
 find "locale" than "dev". This is a good thing.

 However, I don't like the way it blithely only displays a few results.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
To: NetBSD GNATS <gnats-bugs@netbsd.org>
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/47701: apropos doesn't work
Date: Fri, 29 Mar 2013 01:36:36 +0530

 Hi,

 On Thu, Mar 28, 2013 at 9:05 AM,  <root@garbled.net> wrote:
 > The new apropos in 6, doesn't seem to give reasonable results.  While trying
 > to find the usbdevs(8) command, I ran:
 > apropos -C usb
 >
 > and got:
 > alcyone# apropos -C usb
 > usb (4) Universal Serial Bus driver
 > usbhid (3) USB HID access routines
 > cdce (4)   USB Communication Device Class Ethernet driver
 > ulpt (4)   USB printer support
 > uep (4) USB eGalax Touchpanel
 > ukbd (4)   USB keyboard support
 > cue (4) CATC USB-EL1201A USB Ethernet driver
 > uts (4) USB generic touchscreens
 > umodem (4) USB modem support
 > ucom (4)   USB tty support
 >
 > If I want to find usbdevs, apparently I have to do -C8 ??

 As others have mentioned, the new apropos displays only the top 10
 results, which some times might not be enough to get the expected
 results.
 There is a -n option as well to specify exactly how many results you
 want to see.

 As far as usbdevs(8) not appearing in the top results is concerned,
 its a hard problem to figure out what exactly the user is looking for
 :)
 But on a more serious note, apropos uses term frequency to compute the
 rank of matching man pages in search results (apart from few other
 factors).  In case of usbdevs(8) man page, its length is too short
 (which should not be too big a contributing factor, since the
 algorithm tries to normalize it). But more importantly, the keywords
 usbdevs and usb are treated as two different keywords by apropos,
 which means an occurrence of usbdevs in the man page does not
 contribute towards a higher rank.

 I will try to experiment, if the ranking algorithm can be tweaked in
 some way to improve behaviour in such cases.

 >
 > Aside from that, I find the new format of man -k to be obnoxious.  Can we
 > revert to the historical display, or maybe make it sensitive to an environment
 > var, like OLDMAN=YES ? :)

 Not possible to get the exact same behaviour as the old apropos, but
 it is still possible to just perform search in the NAME section (like
 the old apropos).  You can disable indexing of complete content of man
 pages by using makemandb -lf, after which apropos automatically will
 search in the NAME section. However, if there is a demand, I can add
 an option to apropos itself to just search in the NAME section.

 --
 Abhinav

From: christos@zoulas.com (Christos Zoulas)
To: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>, 
	NetBSD GNATS <gnats-bugs@netbsd.org>
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 16:32:07 -0400

 On Mar 29,  1:36am, er.abhinav.upadhyay@gmail.com (Abhinav Upadhyay) wrote:
 -- Subject: Re: bin/47701: apropos doesn't work

 | Not possible to get the exact same behaviour as the old apropos, but
 | it is still possible to just perform search in the NAME section (like
 | the old apropos).  You can disable indexing of complete content of man
 | pages by using makemandb -lf, after which apropos automatically will
 | search in the NAME section. However, if there is a demand, I can add
 | an option to apropos itself to just search in the NAME section.

 I think that:
 1. defaulting to show everything
 2. having an option to just show the name
 3. having an environment variable to read default options from

 Would satisfy most of the "Get of my lawn!" folks.

 christos

From: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
To: NetBSD GNATS <gnats-bugs@netbsd.org>
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, root@garbled.net
Subject: Re: bin/47701: apropos doesn't work
Date: Fri, 29 Mar 2013 01:57:15 +0530

 On Thu, Mar 28, 2013 at 10:05 AM, Valery Ushakov <uwe@stderr.spb.ru> wrote:
 > The following reply was made to PR bin/47701; it has been noted by GNATS.
 >
 > From: Valery Ushakov <uwe@stderr.spb.ru>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: bin/47701: apropos doesn't work
 > Date: Thu, 28 Mar 2013 08:31:13 +0400
 >
 >  On Thu, Mar 28, 2013 at 03:35:01 +0000, root@garbled.net wrote:
 >
 >  > If I want to find usbdevs, apparently I have to do -C8 ??
 >
 >  Apparently apropos now prints (silently) just the first 10 results!
 >
 >  You need to use -p to tell it to return everything.  Except the way -p
 >  invokes pager seems broken since it uses popen.

 I looked at how git-log achieves the same. It seems, it forks less as
 a child process and creates a pipe between less' s stdin and its own
 stdout using pipe and dup2. I will try that as well.

 --
 Abhinav

From: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
To: NetBSD GNATS <gnats-bugs@netbsd.org>
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, root@garbled.net
Subject: Re: bin/47701: apropos doesn't work
Date: Fri, 29 Mar 2013 02:01:51 +0530

 On Thu, Mar 28, 2013 at 11:20 AM, David Holland
 <dholland-bugs@netbsd.org> wrote:
 > The following reply was made to PR bin/47701; it has been noted by GNATS.
 >
 > From: David Holland <dholland-bugs@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: bin/47701: apropos doesn't work
 > Date: Thu, 28 Mar 2013 05:47:26 +0000
 >
 >  On Wed, Mar 27, 2013 at 10:41:44PM -0700, Tim Rightnour wrote:
 >   > Also, a strange result, I get less results from "apropos -C8p de", than I do
 >   > from "apropos -C8p dev"
 >   >
 >   > I think some of the new matching code is really neat, but I'm completely
 >   > confounded by what it does and doesn't find.
 >
 >  It's using a real text retrieval engine, so "de" is more likely to
 >  find "locale" than "dev". This is a good thing.
 >
 >  However, I don't like the way it blithely only displays a few results.

 But otherwise, the screen will be full of search results and that
 won't look pretty as well :)

 I think, it would be nice to add a message at the end of the output
 like "showing 10 out of n matching results, use -p to view all
 results" ?

 --
 Abhinav

From: Tim Rightnour <root@garbled.net>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
	er.abhinav.upadhyay@gmail.com
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 13:39:52 -0700 (MST)

 On 28-Mar-2013 Abhinav Upadhyay wrote:
 >  Not possible to get the exact same behaviour as the old apropos, but
 >  it is still possible to just perform search in the NAME section (like
 >  the old apropos).  You can disable indexing of complete content of man
 >  pages by using makemandb -lf, after which apropos automatically will
 >  search in the NAME section. However, if there is a demand, I can add
 >  an option to apropos itself to just search in the NAME section.

 I understand the matching algorithim is different now, that is what it is.  But
 what I would like to have, is some env variable, that when switched on, does
 the following:

 man -k runs apropos -C instead of the new form
 man -k returns unlimited matches
 man -k does not invoke a pager

 This way, I can set the env variable, and get man -k output the way I expect
 (ok, prefer) it to look, and not break the new stuff for people who prefer it. 
 It will use the new matching algo, but return output in the old format.

 I'm not trying to be a no-changenik here, but I prefer the old format, and
 would just like to have a setting or something so I can have it back.

 Perhaps instead of the above, some env var that sets the arguments sent to
 apropos? Then people can tune it for whatever format they prefer. Though I would
 like an option added that does unlimited matches without invoking the pager.  I
 guess -n 99999 would work. 

 ---
 Tim Rightnour <root@garbled.net>
 NetBSD: Free multi-architecture OS http://www.netbsd.org/
 Genecys: Open Source 3D MMORPG: http://www.genecys.org/

From: Dave Huang <khym@azeotrope.org>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 15:53:53 -0500

 Agreed that apropos -p is pretty much useless for me, due to all the
 ESC codes being displayed. E.g., if TERM=3Dxterm and PAGER=3Dless, =
 apropos
 -p usb displays:

 ESC[4musbESC[24m (ESC[4m4ESC[24m)       ESC[4mUniversal Serial Bus =
 driverESC[24m
 ...ESC[1mUSBESC(BESC[m serial adapter uchcom(4) WinChipHead CH341/340 =
 based ESC[1mUSBESC(BESC[m serial adapter ucom(4) ESC[1mUSBESC(BESC[m tty =
 support ucycom(4) Cypress microcontroller based ESC[1mUSBESC(BESC[m =
 serial adapter uftdi(4) FT8U100AX ESC[1mUSBESC(BESC[m serial adapter =
 ugensa(4) ESC[1mUSBESC(BESC[m generic serial adapter uhmodem(4) =
 ESC[1mUSBESC(BESC[m...

 I think if -p is given, or stdout is not a tty, no terminal control
 codes should be output (or perhaps it should do strikeouts using
 ^H--that's what man/mandoc/groff does).

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	root@garbled.net
Cc: 
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 16:59:17 -0400

 On Mar 28,  8:45pm, root@garbled.net (Tim Rightnour) wrote:
 -- Subject: Re: bin/47701: apropos doesn't work

 |  man -k runs apropos -C instead of the new form
 |  man -k returns unlimited matches
 |  man -k does not invoke a pager

 I agree with all 3, and this can be controlled via an environment variable.

 christos

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/47701: apropos doesn't work
Date: Fri, 29 Mar 2013 01:52:35 +0400

 On Thu, Mar 28, 2013 at 20:35:12 +0000, Abhinav Upadhyay wrote:

 >  On Thu, Mar 28, 2013 at 10:05 AM, Valery Ushakov <uwe@stderr.spb.ru> wrote:
 >
 >  >  You need to use -p to tell it to return everything.  Except the way -p
 >  >  invokes pager seems broken since it uses popen.
 >  
 >  I looked at how git-log achieves the same. It seems, it forks less as
 >  a child process and creates a pipe between less' s stdin and its own
 >  stdout using pipe and dup2. I will try that as well.

 The fundamental problem is, really, that 1) unlimited number of
 results and 2) launching a pager MUST NOT be conflated in the single
 option.

 #1 - whether1 unlimited number of results should be the default (at
 least for the short format) - may be argued.

 #2 is absurd (especially so when enforced along with #1).  This is
 Unix.  We know how to pipe output to a pager, or some other program if
 need be.

 -uwe

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	root@garbled.net
Cc: 
Subject: Re: bin/47701: apropos doesn't work
Date: Thu, 28 Mar 2013 19:48:34 -0400

 On Mar 28,  9:55pm, uwe@stderr.spb.ru (Valery Ushakov) wrote:
 -- Subject: Re: bin/47701: apropos doesn't work

 | The following reply was made to PR bin/47701; it has been noted by GNATS.
 | 
 | From: Valery Ushakov <uwe@stderr.spb.ru>
 | To: gnats-bugs@NetBSD.org
 | Cc: 
 | Subject: Re: bin/47701: apropos doesn't work
 | Date: Fri, 29 Mar 2013 01:52:35 +0400
 | 
 |  On Thu, Mar 28, 2013 at 20:35:12 +0000, Abhinav Upadhyay wrote:
 |  
 |  >  On Thu, Mar 28, 2013 at 10:05 AM, Valery Ushakov <uwe@stderr.spb.ru> wrote:
 |  >
 |  >  >  You need to use -p to tell it to return everything.  Except the way -p
 |  >  >  invokes pager seems broken since it uses popen.
 |  >  
 |  >  I looked at how git-log achieves the same. It seems, it forks less as
 |  >  a child process and creates a pipe between less' s stdin and its own
 |  >  stdout using pipe and dup2. I will try that as well.
 |  
 |  The fundamental problem is, really, that 1) unlimited number of
 |  results and 2) launching a pager MUST NOT be conflated in the single
 |  option.
 |  
 |  #1 - whether1 unlimited number of results should be the default (at
 |  least for the short format) - may be argued.
 |  
 |  #2 is absurd (especially so when enforced along with #1).  This is
 |  Unix.  We know how to pipe output to a pager, or some other program if
 |  need be.

 Yes, the pipe through pager just needs to go!

 christos

State-Changed-From-To: open->feedback
State-Changed-By: snj@NetBSD.org
State-Changed-When: Tue, 04 Nov 2014 07:55:41 +0000
State-Changed-Why:
I believe christos addressed all of these issues back in March of 2013.
Rather than "OLDMAN=yes", we have "APROPOS=-l", which takes care of both
the man -k case and direct invocation of apropos.  This mode:
1. searches only name and name_desc, prints name(section) - name_description
2. turns off escape formatting (can be forced on with -i)
3. turns off context printing (can be forced on with -c)

In addition, the default behavior even without -l is now to print all
results instead of just the first 10.

Also, it now only pipes to a pager if specifically requested.

Sanity has been restored.  OK to close?


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 29 May 2016 23:51:05 +0000
State-Changed-Why:
1.5 year feedback timeout
fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.