apt aptitude inconsistent search results (regex)
apt 0.8.16
aptitude 0.6.4
If I search for a package name (~n) then using '$' should prevent -dbg -doc -multi.
So I would consider the following results wrong:
$ aptitude search "~ngstreamer(.+)-(ffmpeg|plugins-(ugly|bad))$"
i gstreamer0.10-ffmpeg - FFmpeg plugin for GStreamer
p gstreamer0.10-ffmpeg-dbg - FFmpeg plugin for GStreamer (debug symbols
i gstreamer0.10-plugins-bad - GStreamer plugins from the "bad" set
p gstreamer0.10-plugins-bad-dbg - GStreamer plugins from the "bad" set (debu
p gstreamer0.10-plugins-bad-doc - GStreamer documentation for plugins from t
p gstreamer0.10-plugins-bad-multi - GStreamer plugins from the "bad" set (Mult
p gstreamer0.10-plugins-bad-multi - GStreamer plugins from the "bad" set (Mult
i gstreamer0.10-plugins-ugly - GStreamer plugins from the "ugly" set
p gstreamer0.10-plugins-ugly-dbg - GStreamer plugins from the "ugly" set (deb
p gstreamer0.10-plugins-ugly-doc - GStreamer documentation for plugins from t
However, using the same regex with apt-cache yields the correct result:
$ apt-cache search "^gstreamer(.+)-(ffmpeg|plugins-(ugly|bad|good))$"
gstreamer0.10-ffmpeg - FFmpeg plugin for GStreamer
gstreamer0.10-plugins-bad - GStreamer plugins from the "bad" set
gstreamer0.10-plugins-ugly - GStreamer plugins from the "ugly" set
gstreamer0.10-plugins-good - GStreamer plugins from the "good" set
The only way I can get aptitude to perform properly is by using the following regex:
$ aptitude search "~ngstreamer(.+)-(ffmpeg$|plugins-(ugly$|bad$|good$))"
Which I would consider as wrong.
Another example, where aptitude is right and apt-cache is wrong:
$ apt-cache search "^mp\w*r$"
mp3blaster - Full-screen console mp3 and Ogg Vorbis player
mp3roaster - A Perl hack for burning audio CDs out of MP3/OGG/FLAC/WAV files
mplayer2 - next generation movie player for Unix-like systems
mplayer - movie player for Unix-like systems
"mplayer2" should have been excluded.
$ aptitude search "~n^mp\w*r$"
p mp3blaster - Full-screen console mp3 and Ogg Vorbis pla
p mp3roaster - A Perl hack for burning audio CDs out of M
i mplayer - movie player for Unix-like systems
For package names, ~n or ?name with aptitude is unnecessary, I used it in the previous examples for clarification.
I've read man 7 regex and I'm fairly sure those regexes are fine but many instances give wrong results.
An application that gives expected results is grep, in particular grep -E.
Is this a known issue, or where am I going wrong?
Reply to: