"pkg_info -W" useless for symlink-accessible command (was Re: how to find which port has a given executable)

Parv parv at pair.com
Wed Mar 23 18:16:05 PST 2005


in message <200503230936.54842.ringworm01 at gmail.com>,
wrote Michael C. Shultz thusly...
>
> pkg_info -W /usr/X11R6/bin/nedit
> /usr/X11R6/bin/nedit was installed by package nedit-5.5

(I tried on 5.3-p5; used to have same issue on 4.6-4.11.)

I always had problems w/ that as so far i tried only the file name,
w/o the path.  So "pkg_info -W /misc/local/bin/s2p" gives ...

  /misc/local/bin/s2p was installed by package perl-5.8.6_2


... but "pkg_info -W s2p" produces nothing, even though the man page
says ...

  -W  For the specified filename argument show which package it
      belongs to.  If the file is not in the current directory, and
      does not have an absolute path, then the PATH is searched using
      which(1).


BTW, "which s2p" gives ...

  /usr/local/bin/s2p

  (where /usr/local is symlinked to /misc/local.)


Apparently "pkg_info -W" is useless unless the *real path* is given.
A quick/dirty wrapper would be (works in bash3 & sh) then ...

  for cmd in $@
  do
    pkg_info -W  $(realpath $(which $cmd))
  done


  - Parv

-- 



More information about the freebsd-questions mailing list