From f7f02fb6cbf0d048adb42acc9250868420f2d3e8 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 30 Aug 2012 15:44:29 +0300 Subject: [PATCH] Avoid unnecessary calculations on %ghost %config - If the replacing %config file is a %ghost, then we'll just leave whatever might be on disk alone. - OTOH in the opposite case we probably *should* take backups, if the file exists on disk and is differs from the new non-ghost (but currently we take never take backups for %ghosts) --- lib/rpmfi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 5762009..553fc65 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -594,6 +594,12 @@ rpmFileAction rpmfiDecideFateIndex(rpmfi ofi, int oix, rpmfi nfi, int nix, int save = (newFlags & RPMFILE_NOREPLACE) ? FA_ALTNAME : FA_SAVE; int action = FA_CREATE; /* assume we can create */ + /* If the new file is a ghost, leave whatever might be on disk alone. */ + if (newFlags & RPMFILE_GHOST) { + action = FA_SKIP; + goto exit; + } + if (lstat(fn, &sb)) { /* * The file doesn't exist on the disk. Create it unless the new -- 2.7.4