diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2014-01-08 09:28:52 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2014-01-08 09:49:33 +0200 |
commit | bcba176fbf0d2cae4d0ee01c0f1b19dde181fc59 (patch) | |
tree | 070d1e4a308dcf969bb95413198053fd2cd831f8 /lib/fprint.c | |
parent | 209cd9f04a83140f63391f40f5ccb85ac8d5836d (diff) | |
download | rpm-bcba176fbf0d2cae4d0ee01c0f1b19dde181fc59.tar.gz |
Ignore already removed links on fingerprint symlink correction
- For to-be-removed packages, we should only "correct" symlink fingerprints
if the packaged link actually exists on disk, otherwise eg %pretrans hacks
to do symlink -> directory replacement wont work as expected,
as shown here with a reproducer and all:
https://lists.fedoraproject.org/pipermail/devel/2013-December/193266.html
In the old package, "hello" is in /usr/share/javadoc/test-1/ directory,
to which the "test" symlink points to. In the new package,
/usr/share/javadoc/test/ is a directory with "hello" file in it.
Symlink correction causes the "hello" fingerprint to match between
old and new, leading to erase of the old package not removing the
"hello" file of the old package. Which is correct, except when
the symlink has been removed, as is done here by %pretrans of the
new package.
Diffstat (limited to 'lib/fprint.c')
-rw-r--r-- | lib/fprint.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/fprint.c b/lib/fprint.c index 7875d1b93..9274dcfdc 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -376,6 +376,16 @@ static void fpLookupSubdir(rpmFpHash symlinks, fingerPrintCache fpc, rpmte p, in rpmfiles foundfi = rpmteFiles(recs[i].p); char const *linktarget = rpmfilesFLink(foundfi, recs[i].fileno); char *link; + + /* Ignore already removed (by eg %pretrans) links */ + if (linktarget && rpmteType(recs[i].p) == TR_REMOVED) { + char *path = rpmfilesFN(foundfi, recs[i].fileno); + struct stat sb; + if (lstat(path, &sb) == -1) + linktarget = NULL; + free(path); + } + foundfi = rpmfilesFree(foundfi); if (linktarget && *linktarget != '\0') { |