On Fri, 07 Sep 2012 21:54:11 +0200, Salvatore Bonaccorso wrote: > > Attached is a first attempt to handle the config file in a better > > way. > I found a problem on handling of debconf values
> root@wheezy:/etc/conserver# cat console.cf > # default config for console > config * { > master localhost; > portY09; > } > (I have not yet checked where the problem comes from, Gregor can you reproduce > this?) Yes, I can confirm it, and I found the problem: it's the \1$RET substitutions in postinst (mixing shell and perl -- and \1$RET is not good when $RET is the port, i.e. numerical). What ssems to work works is: db_get conserver-client/server perl -pi -e "s/master(?<space>\s+)([^;]+);/master$+{space}$RET;/" $conf db_get conserver-client/port perl -pi -e "s/port(?<space>\s+)([^;]+);/port$+{space}$RET;/" $conf Names capture groups exist since perl 5.10, so that should be fine. - New debdiff attached. Further tests welcome :) Thanks a lot for checking my patch and finding this problem! Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Chavela Vargas: La Llorona
diff -u conserver-8.1.18/debian/changelog conserver-8.1.18/debian/changelog --- conserver-8.1.18/debian/changelog +++ conserver-8.1.18/debian/changelog @@ -1,3 +1,17 @@ +conserver (8.1.18-2.1) UNRELEASED; urgency=low + + * Non-maintainer upload. + * Fix "prompting due to modified conffiles which where not modified by + the user": + - don't install the conffile (but an example that's used in .postinst if + the file doesn't exist yet) + - read existing values in .config + - fix replacement in .postinst + - remove the correct file in .postrm + (Closes: #657465) + + -- gregor herrmann <gre...@debian.org> Mon, 03 Sep 2012 23:44:53 +0200 + conserver (8.1.18-2) unstable; urgency=low * added lsb-init patch from Bernhard Schmidt (closes: #672468) diff -u conserver-8.1.18/debian/conserver-client.config conserver-8.1.18/debian/conserver-client.config --- conserver-8.1.18/debian/conserver-client.config +++ conserver-8.1.18/debian/conserver-client.config @@ -2,6 +2,16 @@ . /usr/share/debconf/confmodule +conf=/etc/conserver/console.cf + +if [ -r $conf ]; then + SERVER=$(perl -ne 'print $1 if /master\s+([^;]+);/' $conf) + PORT=$(perl -ne 'print $1 if /port\s+([^;]+);/' $conf) + + db_set conserver-client/server "$SERVER" + db_set conserver-client/port "$PORT" +fi + db_input medium conserver-client/config || true db_go diff -u conserver-8.1.18/debian/conserver-client.install conserver-8.1.18/debian/conserver-client.install --- conserver-8.1.18/debian/conserver-client.install +++ conserver-8.1.18/debian/conserver-client.install @@ -1,2 +1,2 @@ -debian/console.cf /etc/conserver +debian/console.cf.ex /etc/conserver console/console /usr/bin diff -u conserver-8.1.18/debian/conserver-client.postinst conserver-8.1.18/debian/conserver-client.postinst --- conserver-8.1.18/debian/conserver-client.postinst +++ conserver-8.1.18/debian/conserver-client.postinst @@ -6,14 +6,18 @@ if [ "$1" = "configure" -a -e /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule + if [ ! -e $conf ]; then + cp $conf.ex $conf + fi + db_get conserver-client/config if [ "$RET" = "true" ]; then touch $conf db_get conserver-client/server - perl -pi -e "s/\w+;$/$RET;/ if /^master\s/" $conf + perl -pi -e "s/master(?<space>\s+)([^;]+);/master$+{space}$RET;/" $conf db_get conserver-client/port - perl -pi -e "s/\w+;$/$RET;/ if /^port\s/" $conf + perl -pi -e "s/port(?<space>\s+)([^;]+);/port$+{space}$RET;/" $conf fi fi diff -u conserver-8.1.18/debian/conserver-client.postrm conserver-8.1.18/debian/conserver-client.postrm --- conserver-8.1.18/debian/conserver-client.postrm +++ conserver-8.1.18/debian/conserver-client.postrm @@ -5,7 +5,7 @@ case "$1" in purge) - rm -f /etc/conserver/console.conf + rm -f /etc/conserver/console.cf # try remove the confdirectory (why isn't there a 'prerm purge'?) if [ -d /etc/conserver ]; then rmdir --ignore-fail-on-non-empty /etc/conserver reverted: --- conserver-8.1.18/debian/console.cf +++ conserver-8.1.18.orig/debian/console.cf @@ -1,6 +0,0 @@ - -# default config for console -config * { - master CONSERVER_MASTER; - port CONSERVER_PORT; -} only in patch2: unchanged: --- conserver-8.1.18.orig/debian/console.cf.ex +++ conserver-8.1.18/debian/console.cf.ex @@ -0,0 +1,6 @@ + +# default config for console +config * { + master CONSERVER_MASTER; + port CONSERVER_PORT; +}
signature.asc
Description: Digital signature