Bug#582612: prompting due to modified conffiles which where not modified by the user
On Sat, May 22, 2010 at 10:44:25AM +0200, Holger Levsen wrote:
> Package: wdm
> Version: 1.28-3.5
> Severity: serious
> User: debian-qa@lists.debian.org
> Usertags: piuparts piuparts.d.o
>
> Hi,
>
> during a test with piuparts I noticed your package failed the piuparts upgrade
> test because dpkg detected a conffile as being modified and then prompted the
> user for an action. As there is no user input, this fails. But this is not
> the real problem, the real problem is that this prompt shows up in the first
> place, as there was nobody modifying this conffile at all, the package has
> just been installed and upgraded...
Hi, Holger
This is caused by the insane way wdm handles refreshing of wm list, it
directly modifies entry in wdm-config everytime wdm is started or stopped.
I am attaching a first cut of a patch to care of this. Instead of directly
modifying wdm-config itself, a new detached file is used to hold that info.
That file is automatically regenerated on each wdm start/stop and loaded
from wdm-config. Sysadmins can override automatic selection by setting that
value again after that file is loaded, as pointed out in directions added to
wdm-config.
This will not prevent prompting when upgrading from previous versions, but
should leave this problem addressed for the future.
I will test a bit more, and if everything works as expected I will upload a
fixed package. Since wdm is under QA team maintenance, one question, do I
version it as a NMU or as a QA upload? (although I am not member of the QA
team)
Cheers,
--
Agustin
>From 7645f1ed7d107d3befa7540ce8b7a5c0f71a6bcd Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <agmartin@debian.org>
Date: Tue, 25 May 2010 14:51:58 +0200
Subject: [PATCH] Move 'DisplayManager*wdmWm' automatic regeneration to a separate file.
This is needed so wdm-config conffile is not modified on every wdm
start/stop. We make wdm-config file load the other file (wdm.wmlist)
containing autogenerated entry, and allow further override to sysadmins
in case they want this value hardcoded.
---
debian/changelog | 8 ++++++
debian/config/wdm-config | 16 ++++++++++---
debian/update_wdm_wmlist | 55 +++++++++++++++++++++++++---------------------
debian/wdm.postrm | 1 +
4 files changed, 51 insertions(+), 29 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index aa4dd85..92a0b07 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+wdm (1.28-3.6) unstable; urgency=low
+
+ * Move 'DisplayManager*wdmWm' automatic regeneration to a separate
+ file, so wdm-config conffile is not automatically changed
+ (Closes: #582612).
+
+ -- Agustin Martin Domingo <agmartin@debian.org> Tue, 25 May 2010 15:17:11 +0200
+
wdm (1.28-3.5) unstable; urgency=low
* Non-maintainer upload.
diff --git a/debian/config/wdm-config b/debian/config/wdm-config
index 987e4ef..06f3685 100644
--- a/debian/config/wdm-config
+++ b/debian/config/wdm-config
@@ -33,10 +33,6 @@ DisplayManager*wdmLogin: /usr/bin/wdmLogin
DisplayManager*wdmBg: solid:Gray85
! DisplayManager*wdmLogo: /usr/share/pixmaps/gnuLogo.xpm
DisplayManager*wdmLogo: /usr/share/pixmaps/wdmDebianSwirl.xpm
-! BEWARE: the wdmWm setting will be overwritten on every wdm (re)start
-! and reload. Please see wdm.options(5) for info on disabling
-! this behavior if you want to specify the list manually.
-! DisplayManager*wdmWm: twm:wmaker:afterstep
DisplayManager*wdmReboot: /sbin/reboot
DisplayManager*wdmHalt: /sbin/halt
DisplayManager*wdmVerify: true
@@ -46,3 +42,15 @@ DisplayManager*wdmLoginConfig: /etc/X11/wdm/wdmlogin.conf
DisplayManager*useSyslog: true
DisplayManager*syslogFacility: LOG_AUTHPRIV
DisplayManager*terminateServer: true
+
+! Load wm list from autogenerated file
+
+#include "wdm.wmlist"
+
+! BEWARE: the wdmWm setting in that file will be overwritten on every wdm
+! (re)start and reload. If you want to hardcode your choice, do that
+! in the line below, to be processed after previous automatic definition.
+
+! DisplayManager*wdmWm: twm:wmaker:afterstep
+
+! Please see wdm.options(5) for info on disabling automatic generation.
diff --git a/debian/update_wdm_wmlist b/debian/update_wdm_wmlist
index 3e795d6..90aa47d 100644
--- a/debian/update_wdm_wmlist
+++ b/debian/update_wdm_wmlist
@@ -1,52 +1,57 @@
#!/usr/bin/perl -w
#
-# update_wdm_wmlist, (c) 1998 Marcelo Magallón <mmagallo@debian.org>
-# rewriten to use the x-window-manager alternative
-# modified to also use the x-session-manager alternative by Arthur Korn
-# Copyright 2000 Wichert Akkerman <wakkerma@debian.org>
+# update_wdm_wmlist,
#
# This script will read the list of installed window managers from
# the update-alternatives output for the x-window-manager alternative
-# and update the DisplayManager*wdmWm resource in /etc/X11/wdm/wdm-config.
+# and update the DisplayManager*wdmWm resource in $wdm_list_file (see below).
# BEWARE: It doesn't ask any questions about this. It just does it. It
# takes an optional list of window managers.
+#
+# Original program:
+# Copyright (C) 1998 Marcelo Magallón <mmagallo@debian.org>
+# Rewriten to use the x-window-manager alternative.
+# Copyright (C) 2000 Wichert Akkerman <wakkerma@debian.org>
+# Modified to also use x-session-manager alternative.
+# Copyright (C) 2001 Arthur Korn.
+# Modified to write output to a separate file.
+# Copyright (C) 2010 Agustin Martin Domingo <agmartin@debian.org>
use strict;
-my $wm_list='';
+my $wm_list = '';
+my $wdm_list_file = "/etc/X11/wdm/wdm.wmlist";
-unless (@ARGV) {
+if (@ARGV) {
+ $wm_list = join (':', sort @ARGV);
+} else {
my @wm_list = ('default');
foreach my $alternative ( qw(x-window-manager x-session-manager) ) {
open(WINDOW_MANAGERS, "update-alternatives --display $alternative |")
or die "Can't run update-alternatives: $!";
-
+
while (<WINDOW_MANAGERS>) {
push(@wm_list, $1) if ( m,^/.*/([^/]+) - ,);
}
-
+
close(WINDOW_MANAGERS);
}
-
+
$wm_list = join (':', sort @wm_list);
-} else {
- $wm_list = join (':', sort @ARGV);
}
-open (WDM_CONFIG_FILE, '</etc/X11/wdm/wdm-config')
- or die "Can't open /etc/X11/wdm/wdm-config for reading: $!";
-open (NEW_WDM_CONFIG_FILE, '>/etc/X11/wdm/wdm-config.new')
- or die "Can't open /etc/X11/wdm/wdm-config.new for writing: $!";
-
-while (<WDM_CONFIG_FILE>) {
- s|^!?\s*(.*wdmWm:\s*).*|$1$wm_list|;
- print NEW_WDM_CONFIG_FILE;
-}
+open (WDM_WMLIST_FILE, ">$wdm_list_file")
+ or die "Can't open $wdm_list_file for writing: $!";
-close(WDM_CONFIG_FILE);
-close(NEW_WDM_CONFIG_FILE);
+print WDM_WMLIST_FILE
+ "! This file has been autogenerated by $0 script.
+!
+! Manual changes here will be overwritten on new invocation.
+! See wdm-config file to override values set here.
+!
+DisplayManager*wdmWm: $wm_list
+";
-rename '/etc/X11/wdm/wdm-config.new', '/etc/X11/wdm/wdm-config'
- or die "Can't rename /etc/X11/wdm/window-managers.new: $!";
+close(WDM_WMLIST_FILE);
exit 0;
diff --git a/debian/wdm.postrm b/debian/wdm.postrm
index cc7f403..52672f2 100644
--- a/debian/wdm.postrm
+++ b/debian/wdm.postrm
@@ -31,6 +31,7 @@ case "$1" in
rmdir /var/lib/wdm/authdir/authfiles || true
rmdir /var/lib/wdm/authdir || true
rmdir /var/lib/wdm || true
+ rm -f /etc/X11/wdm/wdm.wmlist
update-rc.d wdm remove >/dev/null
;;
upgrade|failed-upgrade)
--
1.7.1
Reply to: