[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt-cache regex question



On 12/03/11 19:25, Camaleón wrote:
On Sat, 12 Mar 2011 18:17:47 +0000, Camaleón wrote:

On Sun, 13 Mar 2011 19:22:38 +0200, Πρεκατές Αλέξανδρος wrote:

apt-cache --names-only  search  '^a'  except from packages name started
with 'a' (intented)  will also  give packages that they have a source
file whos name starts with 'a'. is that an error?

(...)

Hum... from man "apt-cache" page:

search regex [ regex ... ]
search performs a full text search on all available package lists for
the POSIX regex pattern given, see regex(7). *It searches the package
names and the descriptions for an occurrence of the regular expression*
       ^^^^^^^^^^^^^^^^^^^^
(...)

(bolded text is mine)

So, no, I think you are getting the documented behaviour ;-)

No, wait, the above argument has a big hole. Man page continues (I did
not carefully read, my bad...):

***
If --full is given then output identical to show is produced for each
matched package, and if --names-only is given then the long description
is not searched, only the package name is.
***

So indeed, only package name should be queried in the regex which does
not seem to be the case. I also get false positives, for example:

sm01@stt008:~$ apt-cache --names-only search "^a" | grep sleepd
sleepd - puts an inactive or low battery laptop to sleep

But here, even the source package is named "sleepd", why the regex is
catching this? A bug? :-?

I suspect the man page is a bit ambiguous. It looks like --names-only searches on things other than package name, but not the long description. Possibly matching on "Provides: apm-sleep"

--
Dom


Reply to: