[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: imp blows away hand-edited changes in /etc/imp/defaults.php3



On Fri, Nov 19, 1999 at 12:12:30PM -0800, Joey Hess wrote:
> Craig Sanders wrote:
> > this bug highlights a very serious flaw in debconf - not in the
> > design, but in the manner in which it can be misused by a package
> > maintainer. blowing away custom edits is evil and should be
> > forbidden by policy.
>
> Imp should read in those defaults and use them for the debconf
> defaults. I know some packages go out of their way to do that.

the imp postinst appears to do that when imp is first upgraded to the
debconf-enabled version, and then every upgrade after that uses them to
regenerate the defaults.php3 file.

what this means is that it is no longer possible to reconfigure
imp by editing that file. in fact, aside from directly editing
/var/lib/debconf/debconf.db i don't know if it is possible to
reconfigure imp without losing those changes at the next upgrade.


generating config files is a useful thing to do, but it should never
blow away hand-edited files. fortunately, it is fairly easy to detect
whether a config file has been edited or not...the following is what i
do in the make-apache-conf.pl script of my virtual hosting system:

    # if the .conf file already exists, be careful about overwriting it!
    if ( -e "$outfile.conf" ) {
        # if file hasn't been edited by sysadmin, then replace it.
        # use md5sum to detect any edits.
        #
        # otherwise leave the .new file there to make it
        # easier for the system admin to manually merge in any
        # new features of this script.

        $md5sum=`md5sum $outfile.conf` ;
        $md5old=`cat $outfile.md5` ;
        
        if ($md5sum eq $md5old) {
            rename("$outfile.new","$outfile.conf") ;
            system("md5sum $outfile.conf >$outfile.md5") ;
        } ;
    } else {
        # rename the new config file and generate an md5sum
        rename("$outfile.new","$outfile.conf") ;
        system("md5sum $outfile.conf >$outfile.md5") ;
    } ;

that's perl, but it's just as easy to do in sh.

(btw, this v. hosting system is currently being re-written. the current
version works but has limitations i don't like. when i've finished
version two, i'll package it)

craig

--
craig sanders


Reply to: