[Bug 927028] Re: 'apropos' maxes out CPU when run with '/bin/*' as argument

Colin Watson cjwatson at canonical.com
Wed Feb 22 03:07:57 UTC 2012


If "nc.openbsd" only appears in the description rather than in the page
name, then apropos will show it but whatis won't; that's the essence of
the distinction between those two programs.  It rather depends what you
want, but mostly, apropos is more useful for queries where you can
remember a keyword but not exactly what the page is called.  It
typically produces far too much noise when given a command name,
particularly for some of the short ones.

There's actually a bug where apropos never prints "nothing appropriate"
even when it couldn't find any matches for an argument, which I noticed
and fixed while fixing this bug.

There should be no need to restrict apropos' input.  I've fixed this
properly for man-db 2.6.2:

Wed Feb 22 03:04:45 GMT 2012  Colin Watson  <cjwatson at debian.org>

        Optimise apropos when given many arguments (Ubuntu bug #927028).

        * src/whatis.c (use_grep, do_whatis, parse_name, parse_whatis,
          do_apropos, search): Operate on multiple pages.
          (use_grep, do_whatis, do_apropos): Update an output array rather
          than returning an int.
          (parse_name, parse_whatis): Update an output array as well as
          returning an int.
          (display, do_whatis_section): Constify page argument.
          (match): Constify lowpage and whatis arguments.
          (main): Process all arguments using a single call to search.
        * NEWS: Document this.

I've yet to work on path resolution in whatis, but that should be easy.

** Changed in: man-db (Ubuntu)
       Status: Triaged => Fix Committed

** Changed in: man-db (Ubuntu)
     Assignee: (unassigned) => Colin Watson (cjwatson)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to man-db in Ubuntu.
https://bugs.launchpad.net/bugs/927028

Title:
  'apropos' maxes out CPU when run with '/bin/*' as argument

Status in “man-db” package in Ubuntu:
  Fix Committed

Bug description:
  When 'apropos' is executed with an argument containing a list of files
  in a directory (e.g., '/bin/*'), it maxes out the CPU for a good long
  while (~40 seconds for /bin/*, about 9.5 minutes for /usr/bin/[a-z]*).

  --------------------------------------------------------------------------------------------------------------------------------------------
  ben at feynman:~$ apropos ~/bin/* & sleep 2; top -b -p $! -d 1 -n 3
  [2] 9671

    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                             
   9671 ben       20   0  7080 2224  928 R   100  0.2   0:02.46 apropos                                             

  
    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                             
   9671 ben       20   0  7012 2160  928 R   101  0.2   0:03.45 apropos                                             

  
    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                             
   9671 ben       20   0  7012 2164  928 R   100  0.2   0:04.44 apropos                                             
  --------------------------------------------------------------------------------------------------------------------------------------------

  ben at feynman:~$ dpkg -S /usr/bin/apropos
  man-db: /usr/bin/apropos

  ben at feynman:~$ lsb_release -rd
  Description:    Ubuntu 11.10
  Release:        11.10

  ben at feynman:~$ apt-cache policy man-db
  man-db:
    Installed: 2.6.0.2-2
    Candidate: 2.6.0.2-2
    Version table:
   *** 2.6.0.2-2 0
          500 http://us.archive.ubuntu.com/ubuntu/ oneiric/main i386 Packages
          100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/man-db/+bug/927028/+subscriptions




More information about the foundations-bugs mailing list