Package: debconf-doc Version: 1.5.73 Severity: normal There appears to be an error in the debconf-devel(7) man page. In the 'ADVANCED PROGRAMMING WITH DEBCONF'/'Config file handling' section there's the following example:
... cp -a -f $CONFIGFILE $CONFIGFILE.tmp # If the admin deleted or commented some variables but then set # them via debconf, (re-)add them to the conffile. test -z "$FOO" || grep -Eq '^ *FOO=' $CONFIGFILE || \ echo "FOO=" >> $CONFIGFILE test -z "$BAR" || grep -Eq '^ *BAR=' $CONFIGFILE || \ echo "BAR=" >> $CONFIGFILE sed -e "s/^ *FOO=.*/FOO=\"$FOO\"/" \ -e "s/^ *BAR=.*/BAR=\"$BAR\"/" \ < $CONFIGFILE > $CONFIGFILE.tmp mv -f $CONFIGFILE.tmp $CONFIGFILE ... Note that in the second stanza it suggests writing to $CONFFILE, but then $CONFILE is overwritten by the last 'mv ...' line, so those changes will be overwritten. I think the tests just need to look at the temp file, not the main file, e.g.: ... cp -a -f $CONFIGFILE $CONFIGFILE.tmp # If the admin deleted or commented some variables but then set # them via debconf, (re-)add them to the conffile. test -z "$FOO" || grep -Eq '^ *FOO=' $CONFIGFILE.tmp || \ echo "FOO=" >> $CONFIGFILE.tmp test -z "$BAR" || grep -Eq '^ *BAR=' $CONFIGFILE.tmp || \ echo "BAR=" >> $CONFIGFILE.tmp sed -e "s/^ *FOO=.*/FOO=\"$FOO\"/" \ -e "s/^ *BAR=.*/BAR=\"$BAR\"/" \ < $CONFIGFILE > $CONFIGFILE.tmp mv -f $CONFIGFILE.tmp $CONFIGFILE ... Thanks. jamie. -- System Information: Debian Release: bullseye/sid APT prefers testing APT policy: (600, 'testing'), (500, 'stable'), (200, 'unstable'), (101, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.4.0-4-amd64 (SMP w/8 CPU cores) Kernel taint flags: TAINT_WARN Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled debconf-doc depends on no packages. debconf-doc recommends no packages. Versions of packages debconf-doc suggests: pn debian-policy <none> -- no debconf information