apt-cache 的 --names-only 选项究竟有什么作用?

ter*_*don 8 debian apt package-management

根据手册,它

   search 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 and prints out the package name and the short
       description, including virtual package names. 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.
[...]

   --names-only, -n
       Only search on the package names, not the long descriptions.
       Configuration Item: APT::Cache::NamesOnly.
Run Code Online (Sandbox Code Playgroud)

然而,我遇到了一个奇怪的情况:

$ apt-cache search --names-only 'kde*' | grep tkcv
tkcvs - Graphical front-end to CVS and Subversion
Run Code Online (Sandbox Code Playgroud)

为什么上面的命令会匹配tk8.6-docBraiam和我花了几分钟聊这个,他注意到

$ apt-cache show tkcvs | grep -i kd
Replaces: tkdiff
Provides: tkdiff
Run Code Online (Sandbox Code Playgroud)

因此,Braiam 建议它也匹配该Replaces字段,这在更改包名称的情况下具有一定的意义。好的,但是呢:

$ apt-cache search --names-only 'kde*' | grep tk8.6
tk8.6-doc - Tk toolkit for Tcl and X11, v8.6 - manual pages
$ apt-cache show tk8.6-doc | grep -i kd
Provides: tkdoc
Conflicts: tkdoc
Run Code Online (Sandbox Code Playgroud)

这要么匹配ConflictsProvides领域,我不能扭转的意义--names-only,使其符合这些领域。那么,究竟--names-only搜索通过什么?它是包描述中提到的所有名称吗?它显然与单独的包名称不匹配。

dev*_*ull 8

事实证明,apt-cache search --names-only它还搜索Provides. 手册页需要更新。 是有关相同的错误报告的链接。

根据错误 #98695¹,似乎“apt-cache search --names-only”也在查看“Provides”字段,而手册页建议只查询包名称。

我认为 apt-cache 的手册页应该相应地更新以反映参数的当前状态。

¹ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=98695

是愿望清单,导致除了包名称外,将行为apt-cache search更改为搜索Provides