Fixing up .rpmnew files

January 6, 2007

For some reason, rpm in Fedora Core 6 (and I believe Fedora Core 5 too) has become overly twitchy about replacing configuration files; a lot of the time it will write .rpmnew files instead of just replacing the old version of the file even if the old file is unchanged and the new and the old file are completely identical.

While I think this is multiarch stuff in action, I still have to clean it up every so often. I use a little scriptlet for this, usually typed at the command line:

for i in *.rpmnew; do
  n=$(basename $i .rpmnew)
  if cmp -s $i $n; then
    mv -f $i $n
    diff -u $n $i

(Yes, this can be done on one line if you're crazy enough. I admit that I usually turn the if block into either 'diff -u $n $i' or, once that's shown me nothing important, 'cmp -s $i $n && mv -f $i $n'. And if it was an actual script, I would have to start making it more elaborate, with features like a dryrun option.)

At first I thought I had an idea why this was happening, but the more I look at the rpm source code and the RPMs involved in my most recent case, the more confused I get. As far as I can decode from the rpm source code, this can't happen unless either the actual file on disk has been changed (which it hasn't), or there's an existing config file before the package is installed for the first time (not applicable for package upgrades). It does seem to only involve things that have RPMs for more than one architecture installed, though, although I haven't tested that extensively.

Written on 06 January 2007.
« Henry Spencer on C's volatile
Weekly spam summary on Janury 6th, 2007 »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Jan 6 00:17:16 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.