dpkg -S /usr/share/doc/tasksel-data # fine
dpkg -S usr/share/doc/tasksel-data # fine
dpkg -S /share/doc/tasksel-data # not found
dpkg -S share/doc/tasksel-data # fine
dpkg -S are/doc/tasksel # fine
Run Code Online (Sandbox Code Playgroud)
为什么上面的第三行会失败?请注意,第一行以斜杠( /
)开头,因此这似乎不是问题所在。
这不就证明我可以告诉,但领先的/
品牌dpkg
治疗参数作为一个路径,而不是一个模式。换句话说,如果您告诉它搜索以 开头的内容/
,它会假定它应该在具有该确切路径的已安装软件包之一中查找文件。
你可以很容易地确认它
$ dpkg -S nonmatching
dpkg-query: no path found matching pattern *nonmatching*
$ dpkg -S /nonmatching
dpkg-query: no path found matching pattern /nonmatching
Run Code Online (Sandbox Code Playgroud)
请注意,在第一种情况下,使用 no 时/
,错误显示它搜索了*nomatching*
,而使用/
搜索了确切路径/nonmatching
。例如,/doc
尽管存在以下目录,它也无法找到/usr/share/doc
:
$ dpkg -S /doc
dpkg-query: no path found matching pattern /doc
Run Code Online (Sandbox Code Playgroud)
虽然我在手册页中找不到任何提及,但我确实通过检查来源进行了确认。以下几行来自(dpkg 1.17.13) 中searchfiles
定义的函数querycmd.c
$ dpkg -S nonmatching
dpkg-query: no path found matching pattern *nonmatching*
$ dpkg -S /nonmatching
dpkg-query: no path found matching pattern /nonmatching
Run Code Online (Sandbox Code Playgroud)
这将*
在传递的参数周围添加,除非该参数以 a 开头/
。因此,这会导致dpkg-query
将任何/
以绝对路径开头的任何内容和任何不作为要匹配的模式的内容。
归档时间: |
|
查看次数: |
97 次 |
最近记录: |