[Box Backup] I have the fear....

Ben Bennett boxbackup@fluffy.co.uk
Wed, 14 Mar 2007 23:15:16 -0400

On Wed, Mar 14, 2007 at 10:44:22PM -0400, Ben Bennett wrote:
> So it is not dispatch-conf.  It is emerge itself.  I see it changing
> the timestamp of both the real file in /etc and the new config.

And I think I have the smoking gun.

Line 7190 of /usr/lib/portage/pym/portage.py 

The code says:
    # Bump the mtime in order to ensure that the old config file doesn't
    # get unmerged.  The user will have an opportunity to merge the new
    # config with the old one.
	os.utime(filename, None)
    except OSError, e:
	if e.errno != errno.ENOENT:
	del e
	# The file has disappeared, so it's not protected.
	return False
    return True

Which, when combined with the code at 7764:
    # whether config protection or not, we merge the new file the
    # same way.  Unless moveme=0 (blocking directory)
    if moveme:
        mymtime=movefile(mysrc,mydest,newmtime=thismtime,sstat=mystat, mysettings=self.settings)
        if mymtime is None:
        # We need to touch the destination so that on --update the
        # old package won't yank the file with it. (non-cfgprot related)

Leads to both the original conf file and the ._cfg... one to have a
good chance of having the same mtime if you get unlucky and it can
make it from the piece of code that sets the thismtime variable to the
subroutine that has the code from line 7190 before time moves on.