我的rpm包中的某些文件(取决于某些条件)会在%post scriptlet中删除,这会在卸载过程中出现警告:"删除失败:没有此类文件或目录"
注意:在使用旧版RPM的系统中不会出现此问题,仅在RHEL7和SLES12上注意到这一问题。
在尝试解决这个问题时,我在RPM源代码中找到了以下代码(fsm.c):
/*
* Missing %ghost or %missingok entries are not errors.
* XXX: Are non-existent files ever an actual error here? Afterall
* that's exactly what we're trying to accomplish here,
* and complaining about job already done seems like kinderkarten
* level "But it was MY turn!" whining...
*/
if (rc == RPMERR_ENOENT && missingok) {
rc = 0;
}
/*
* Dont whine on non-empty directories for now. We might be able
* to track at least some of the expected failures though,
* such as when we knowingly left config file backups etc behind.
*/
if (rc == RPMERR_ENOTEMPTY) {
rc = 0;
}
if (rc) {
int lvl = strict_erasures ? RPMLOG_ERR : RPMLOG_WARNING;
rpmlog(lvl, _("%s %s: remove failed: %s\n"),
S_ISDIR(sb.st_mode) ? _("directory") : _("file"),
fpath, strerror(errno));
}
}
似乎%missingok 虚拟文件属性解决了这个问题,但是 实际上,没有%missingok 属性,而是%config(missingok)一个。
这让我觉得奇怪的是我们将文件标记为 config 文件,尽管AFAICS配置文件和普通文件之间没有严格的区别。
问题:对于非配置文件(对于二进制文件)使用上述属性是否可以?这会导致升级问题吗?
感谢。