Remove dead file-backup code
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 23 Aug 2012 09:00:41 +0000 (12:00 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 23 Aug 2012 09:08:12 +0000 (12:08 +0300)
- fsmVerify() never ever returns 0 for regular files because of
  multiple hacks in how this all "works": on install, we skip stat()
  but claim disk checked and file not existing, so fsmVerify() returns
  early. Good thing it does too, as otherwise it would remove the
  file we were supposed to be saving here. The actual %config backup
  occurs in fsmCommit(): regular files are first installed with a
  temporary suffix and at "commit" time we decide whether it needs
  backing up or not (involving several other hacks...)

lib/fsm.c

index 7a1628e..3b356f5 100644 (file)
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1705,24 +1705,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfi fi, FD_t cfd,
 
         if (!fsm->postpone) {
             if (S_ISREG(st->st_mode)) {
-                char * path = fsm->path;
-                if (fsm->osuffix)
-                    fsm->path = fsmFsPath(fsm, 0, NULL);
                 rc = fsmVerify(fsm);
-
-                if (rc == 0 && fsm->osuffix) {
-                    char * spath = fsmFsPath(fsm, 0, fsm->osuffix);
-                    rc = fsmRename(fsm->path, spath, fsm->mapFlags);
-                    if (!rc)
-                        rpmlog(RPMLOG_WARNING, _("%s saved as %s\n"),
-                               fsm->path, spath);
-                    free(spath);
-                }
-
-                if (fsm->osuffix)
-                    free(fsm->path);
-
-                fsm->path = path;
                 if (!(rc == CPIOERR_ENOENT)) return rc;
                 rc = expandRegular(fsm, psm, archive, nodigest);
             } else if (S_ISDIR(st->st_mode)) {