[Bug 37435] Re: maintainer of /var/lib/dpkg/alternatives/ doesn't do updates safely

Ian Jackson iwj at ubuntu.com
Wed May 10 15:03:25 UTC 2006


** Changed in: dpkg (Ubuntu)
Sourcepackagename: dpkg => linux-source-2.6.15

** Summary changed:

- maintainer of /var/lib/dpkg/alternatives/ doesn't do updates safely
+ XFS leaves garbage in file if app does write-new-then-rename without f(data)sync

** Description changed:

- This is because i hit BUG#37430.
+ update-alternatives, like many other programs, uses the standard
+ technique of writing updated data to a new file, and then renaming the
+ new file over the top of the old one.
  
- Now, I have a bunch of files in /var/lib/dpkg/alternatives that are
- corrupted.
+ XFS commits metadata (the rename) to disk before data (the file
+ contents) so that an unfortunately-timed crash leaves the file
+ containing garbage (ie whatever those disk blocks happened to contain
+ before).
  
- This is because (obviously to me at least) that whatever maintains this
- list is not creating a new file, syncing and renaming it to do updates
- to the files in this directory. If it did, no files would be corrupted
- and recoving from this crash would be a lot easier.
- 
- What I really need now is a program that will regenerate the files in
- this directory. Or at least point out the corrupted ones and regenerate
- those.
+ Either XFS needs to not do this, or all programs that use the above-
+ described technique to update files (practically all of them) have to be
+ changed to call f(data)sync at an appropriate point - otherwise there is
+ a risk that those programs will break later because their data files
+ contain nonsense.  Note that the latter change would probably
+ significantly slow down installation and upgrade as well as other
+ functions and would involve the editing of many applications.

-- 
XFS leaves garbage in file if app does write-new-then-rename without f(data)sync
https://launchpad.net/bugs/37435




More information about the kernel-bugs mailing list