[Rpm-maint] [rpm-software-management/rpm] Handle file install failures more gracefully (#1534)

Panu Matilainen notifications at github.com
Wed Feb 10 12:57:05 UTC 2021


Run the file installation in multiple stages:

1) gather intel
2) unpack the archive to temporary files
3) set file metadatas
4) commit files to final location
5) mop up leftovers on failure
    
This means we no longer leave behind a trail of untracked, potentially harmful junk on installation failure.
    
If commit step fails the package can still be left in an inconsistent stage, this could be further improved by first backing up old files to temporary location to allow undo on failure, but leaving that for some other day.
Also unowned directories will still be left behind.
    
And yes, this is a somewhat scary change as it's the biggest ever change to how rpm lays down files on install.
    
Fixes: #967 (+ multiple reports over the years)

Details in commit messages, there are several preparatory commits leading up to the "big switch" to this new mode of operation. This change has also been the major blocker to making the plugin API public, as this can have severe consequences on plugins which only expect to handle files one by one. Our resident plugins are not actually affected though.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1534

-- Commit Summary --

  * Clean up file unpack iteration logic a bit
  * Drop unused filename variable
  * Don't update path info if rename failed on file commit
  * Refactor file install and remove around a common struct
  * Refactor fsmMkfile() to take advantage of the new state struct
  * Clarify file installation temporary suffix rule
  * Clarify file installation temporary suffix rule
  * Handle hardlink tracking with a file state pointer
  * Handle file install failures more gracefully

-- File Changes --

    M lib/fsm.c (328)
    M lib/rpmfiles.h (3)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1534.patch
https://github.com/rpm-software-management/rpm/pull/1534.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1534
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210210/16d5d308/attachment.html>


More information about the Rpm-maint mailing list