On Wed, Oct 16, 2024 at 20:17:11 +0200, Hans wrote:
> so, if that is true, what you say (or if I understood you correctly), then a 
> reinstall or upgrade of 
> the package "base-files" should overwrite /etc/profile if the md5sum is 
> different.

No.  You have it backwards.  It only updates /etc/profile if the MD5
checksum is the same.

Here's the function that gets called:


update_to_current_default() {
  if [ -f "$2" ]; then
    md5=$(md5sum "$2" | cut -f 1 -d " ")
    if grep -q "$md5" "/usr/share/base-files/$1.md5sums"; then
      if ! cmp -s "/usr/share/base-files/$1" "$2"; then
        cp -p "/usr/share/base-files/$1" "$2"
        echo Updating $2 to current default.
      fi
    fi
  fi
}


If the output of md5sum /etc/profile appears in the
/usr/share/base-files/profile.md5sums file, then the file is eligible for
copying.

If the output of md5sum /etc/profile is NOT in the profile.md5sums file,
then nothing happens.

> md5sum /etc/profile 
> 40f068da82e55a304d8baf245600b636  /etc/profile 
> md5sum /usr/share/base-files/profile 
> 48a30a427d1794feb49f102b87ddce2b  /usr/share/base-files/profile 
> Without md5sum it can also be clearly seen, as both files got different 
> content. 

You want "cat /usr/share/base-files/profile.md5sums" probably.

Your file does not match any of the known MD5 checksums.  It has been
modified, most likely by you.  Or maybe you do not have an actual Debian
system -- perhaps you installed a derivative and then tried to "migrate"
it in place to Debian, or something like that.

In any case, it doesn't match, so Debian will not overwrite it.

If you want to merge your local /etc/profile changes into the new version
of the base-files profile, you'll have to do it yourself.  It will be
easiest if you made a backup copy of the file before you modified it.  Then
you can use "diff -u /etc/profile.my.backup.copy /etc/profile" to see
what you changed, and apply those changes to the new profile.

If you don't have a backup of the original profile, you'll have to figure
out what your changes were some other way.

> Additionally (but can not prove it), it may be, that a missing file will be 
> renewed during upgrade 
> (did not test this!).

... this topic is just going to KEEP drifting, isn't it.

A MISSING conffile will not be replaced when a package is upgraded.

This is an intentional decision by Debian, to respect the wishes of
the local system administrator.  If a conffile has been removed, Debian
has to assume this was deliberate, and that you want it to remain gone.

Now, /etc/profile is NOT a conffile.  It's a special magic thing all unto
itself, with special code to handle it.

But in general?  Missing conffiles are not replaced.

If you want to replace a missing conffile, look at "dpkg --force-confmiss",
or extract the .deb manually and copy the missing conffile into place
yourself.

Reply via email to