mint-configuration-kde overwrites configuration files (eg /etc/bash.bashrc) without creating backups

Bug #1196553 reported by Zorael
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linux Mint
Confirmed
Undecided
Unassigned

Bug Description

Mint KDE 15 RC amd64. mint-configuration-kde=5.0.16 from olivia/main.

When updating mint-configuration-kde, many configuration files are overwritten without creating backups like .dpkg-old.

Since the point of the package is to adjust config files installed by other packages -- so as to apply branding and other distro defaults -- it would be pointless if it conservatively ignored the existence of said files outright. But as a result, system-wide changes to them cannot be kept by the administrator without manually restoring backups of them after every update to the package.

The postinst file tests if the target file exists, and only then overwrites it.

    if [ -e $original ]
    then
        cp /usr/lib/linuxmint/mintSystem/adjustments/kde/$file_basename $original
    fi

These files include:
    /etc/bashrc
    /etc/kde4rc
    /etc/xdg/user-dirs.defaults
    /etc/gnome/defaults.list
    /etc/skel/.bashrc
    /root/.bashrc
    /root/.gtkrc-2.0{,-kde4}
    /root/.config/gtk-3.0/settings.ini

Said files are not defined in the package's conffiles so debconf doesn't intervene; they aren't dpkg-diverted, so the originals are lost. Automatically backing them up prior to overwriting is an easy workaround, but that still requires manual restoration.

Logic such as this could be employed in postinst:

    #!/bin/sh
    ADJFILE_DIR=/usr/lib/linuxmint/mintSystem/adjustments/kde
    BACKUP_DIR=/etc/linuxmint/backups
    mkdir -p $BACKUP_DIR

    # sh doesn't support arrays
    IFS=$'\n'
    while read newfile; do
        [ -f "$newfile" ] || continue

        timestamp="$(date "+%F_%T")"
        mangled="${newfile//\//-}"
        backup="${BACKUP_DIR}/${timestamp}_${mangled}"
        # eg for /etc/bashrc, this produces:
        # /etc/linuxmint/backups/2013-07-01_16:14:29_-etc-bashrc

        echo "backing up $newfile as $backup" >&2
        mv "$newfile" "$backup" || true

        echo "installing adjusted file to $newfile" >&2
        cp "${ADJFILE_DIR}/$(basename "$newfile")" "$newfile" || true
    done <<- EOF
    # files to be adjusted go here, indentation ignored
        /etc/bashrc
        /etc/kde4rc
        /etc/xdg/user-dirs.defaults
    # ...
    EOF

There is also /usr/lib/inuxmint/mintSystem/mint-adjust.py, which seems at first glance to be supposed to do this instead of postinst, but as far as I can tell it doesn't work. If so that's a different bug, though.

Revision history for this message
LinuxMintUser1729 (linuxmintuser1729) wrote :

It is still having at mint-configuration-kde=5.0.40.

I am a new user of LinuxMint, but have been using Linux for over a decade. I was caught by this bug, and anyone using KDE Desktop on Linux Mint is adversely affected.

For me, I had made changes to /etc/bash.bashrc and to /root/.bashrc...., customizing and getting use to LinuxMint. And then, wham, all my user customizations/changes were gone and I'm back at square one. I finally started making backups and would restore the files. I verified that is it is the Update process that is doing this.

This is a huge issue ---- Overlaying a system's configuration files without any notice or back up.

Environment: Linux MInt 17.1, KDE

lsteeger (lsteeger)
Changed in linuxmint:
status: New → Confirmed
Revision history for this message
Steve A (stevenaaus) wrote :

This is driving me crazy. Why should the system silently overwrite /root/.bashrc.
Very nasty

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.