通常,我们会用 rpm -V
# mv /usr/share/zoneinfo/zone1970.tab /tmp/
# rpm -V tzdata-2019c-1.el8.noarch
missing /usr/share/zoneinfo/zone1970.tab
# rpm -V tzdata-2019c-1.el8.noarch
missing /usr/share/zoneinfo/zone1970.tab
不过,我遇到的情况是,ca-certificates 这个 rpm 包对应的 /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt 文件被意外移除后,用 rpm -V ca-certificates 这个命令没有检测到它 missing.
# rpm -ql ca-certificates | grep ca-bundle.trust.crt
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
/etc/pki/tls/certs/ca-bundle.trust.crt
# mv /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt /tmp/
# rpm -V ca-certificates | wc -l
0
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
/etc/pki/tls/certs/ca-bundle.trust.crt
# mv /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt /tmp/
# rpm -V ca-certificates | wc -l
0
查看 rpm 包的 ca-certificates.spec 可以看到,extracted 目录下的文件是后期生成了,在 %files 下,会用 %ghost 来标记 extracted 目录下的文件。于是 rpm -ql 能看到这些文件属于这个 rpm 包,但是 rpm -V 的时候不会校验这些文件。
# files extracted files
%ghost %{catrustdir}/extracted/pem/tls-ca-bundle.pem
%ghost %{catrustdir}/extracted/pem/email-ca-bundle.pem
%ghost %{catrustdir}/extracted/pem/objsign-ca-bundle.pem
%ghost %{catrustdir}/extracted/pem/tls-ca-bundle.pem
%ghost %{catrustdir}/extracted/pem/email-ca-bundle.pem
%ghost %{catrustdir}/extracted/pem/objsign-ca-bundle.pem
参考:
http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html