Bug#704089: tzdata config script prevents non-interactive (re)configuration

2019-02-24 Thread Aurelien Jarno
On 2019-01-17 11:14, Adam Bolte wrote:
> On Wed, Jan 16, 2019 at 11:43:57AM +0100, Aurelien Jarno wrote:
> > I don't think the patch is correct. Debconf is not a registry, the
> > canonical location for the configuration is the configuration files, not
> > the debconf database. Quoting debconf-devel(7):
> > 
> > "The issue to watch out for here is that debconf is not intended to be,
> > and must not be used as a registry."
> > 
> > I think it also applies when DEBCONF_RECONFIGURE is set.
> 
> That's interesting, but also very confusing. If your assumption is
> correct, what is the point of being able to run dpkg-reconfigure in
> non-interactive mode?

Re-execute the postinst script with the new configuration. In the case
of postinst, it would mean for example:

$ echo Europe/London > /etc/timezone
$ dpkg-reconfigure -fnoninteractive tzdata

This ensures that the /etc/localtime symlink is correctly configured. If
you look a bit on a search engine, it looks like a very common method to
configure the timezone.

> You can only reconfigure a package that is already installed, so (as I
> understand it) if the debconf registry is supposed to be clobbered by
> whatever the actual system configuration is before use, that would
> mean `dpkg-reconfigure -fnoninteractive ` is a completely
> useless and pointless command.
> 
> Let's look at the dash package
> 
> $ sudo debconf-get-selections | grep dash
> # Use dash as the default system shell (/bin/sh)?
> dash  dash/sh boolean true
> $ ls -l /bin/sh
> lrwxrwxrwx 1 root root 4 Jan 24  2017 /bin/sh -> dash
> $ echo dash dash/sh boolean false | sudo debconf-set-selections
> $ sudo debconf-get-selections | grep dash
> # Use dash as the default system shell (/bin/sh)?
> dash  dash/sh boolean false
> $ sudo dpkg-reconfigure -fnoninteractive dash
> Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
> Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
> Removing 'diversion of /usr/share/man/man1/sh.1.gz to 
> /usr/share/man/man1/sh.distrib.1.gz by dash'
> Adding 'diversion of /usr/share/man/man1/sh.1.gz to 
> /usr/share/man/man1/sh.distrib.1.gz by bash'
> $ ls -l /bin/sh
> lrwxrwxrwx 1 root root 4 Jan 17 10:55 /bin/sh -> bash
> $ 
> 
> The dash package reconfiguration has no issues modifying the system
> configuration based on debconf. I would expect tzdata to behave in a
> consistent manner with other packages.

Let's look at another example, the locales package prefers debconf to the
file configuration, just like to ask for tzdata. People consider that as
a bug, see for example bug #793368.

It doesn't seem to be possible to support both reconfiguration from
preseed and from a config file at the same time. It seems some people
expect one to work the other expect the other. I therefore prefer to not
change the current behavior and keep the status quo. Also the current
behavior implemented in tzdata seems to more or less match the "debconf
... must not be used as a registry".

Aurelien

-- 
Aurelien Jarno  GPG: 4096R/1DDD8C9B
aurel...@aurel32.net http://www.aurel32.net


signature.asc
Description: PGP signature


Bug#704089: tzdata config script prevents non-interactive (re)configuration

2019-01-16 Thread Adam Bolte
On Wed, Jan 16, 2019 at 11:43:57AM +0100, Aurelien Jarno wrote:
> I don't think the patch is correct. Debconf is not a registry, the
> canonical location for the configuration is the configuration files, not
> the debconf database. Quoting debconf-devel(7):
> 
> "The issue to watch out for here is that debconf is not intended to be,
> and must not be used as a registry."
> 
> I think it also applies when DEBCONF_RECONFIGURE is set.

That's interesting, but also very confusing. If your assumption is
correct, what is the point of being able to run dpkg-reconfigure in
non-interactive mode?

You can only reconfigure a package that is already installed, so (as I
understand it) if the debconf registry is supposed to be clobbered by
whatever the actual system configuration is before use, that would
mean `dpkg-reconfigure -fnoninteractive ` is a completely
useless and pointless command.

Let's look at the dash package

$ sudo debconf-get-selections | grep dash
# Use dash as the default system shell (/bin/sh)?
dashdash/sh boolean true
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 24  2017 /bin/sh -> dash
$ echo dash dash/sh boolean false | sudo debconf-set-selections
$ sudo debconf-get-selections | grep dash
# Use dash as the default system shell (/bin/sh)?
dashdash/sh boolean false
$ sudo dpkg-reconfigure -fnoninteractive dash
Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
Removing 'diversion of /usr/share/man/man1/sh.1.gz to 
/usr/share/man/man1/sh.distrib.1.gz by dash'
Adding 'diversion of /usr/share/man/man1/sh.1.gz to 
/usr/share/man/man1/sh.distrib.1.gz by bash'
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 17 10:55 /bin/sh -> bash
$ 

The dash package reconfiguration has no issues modifying the system
configuration based on debconf. I would expect tzdata to behave in a
consistent manner with other packages.

Regards,
Adam


signature.asc
Description: PGP signature


Bug#704089: tzdata config script prevents non-interactive (re)configuration

2019-01-16 Thread Aurelien Jarno
On 2019-01-15 12:40, Adam Bolte wrote:
> Package: tzdata
> Version: 2018i-0+deb9u1
> Followup-For: Bug #704089
> 
> Dear Maintainer,
> 
> This is still a problem 4 years later, and I unexpectedly found myself
> spending time to track it down when doing configuration
> management. Can we please get the above patch applied *before* the
> Buster soft-freeze on 2019-02-12 (just over a month away)?

I don't think the patch is correct. Debconf is not a registry, the
canonical location for the configuration is the configuration files, not
the debconf database. Quoting debconf-devel(7):

"The issue to watch out for here is that debconf is not intended to be,
and must not be used as a registry."

I think it also applies when DEBCONF_RECONFIGURE is set.

-- 
Aurelien Jarno  GPG: 4096R/1DDD8C9B
aurel...@aurel32.net http://www.aurel32.net


signature.asc
Description: PGP signature


Bug#704089: tzdata config script prevents non-interactive (re)configuration

2019-01-14 Thread Adam Bolte
Package: tzdata
Version: 2018i-0+deb9u1
Followup-For: Bug #704089

Dear Maintainer,

This is still a problem 4 years later, and I unexpectedly found myself
spending time to track it down when doing configuration
management. Can we please get the above patch applied *before* the
Buster soft-freeze on 2019-02-12 (just over a month away)?

It seems the only work-around for now (aside from patching
tzdata.config before executing dpkg-reconfigure in non-interactive
mode) is to delete /etc/timezone first. As discussed in #516755, that
has the effect of causing a race condition that can lead to things
like log files showing wrong timestamps. Not great.

Thanks,
Adam

-- System Information:
Debian Release: 9.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable'), (400, 
'proposed-updates'), (50, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-0.bpo.1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8), LANGUAGE=en:ja 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages tzdata depends on:
ii  debconf [debconf-2.0]  1.5.61

tzdata recommends no packages.

tzdata suggests no packages.

-- debconf-show failed


signature.asc
Description: PGP signature


Bug#704089: tzdata config script prevents non-interactive (re)configuration

2014-02-20 Thread Paul Menzel
Control: found -1 2013i-0wheezy1
Control: tags -1 patch


Dear Sébastien and Debian folks,


Am Mittwoch, den 27.03.2013, 18:41 + schrieb Sébastien Bocahu:
 Package: tzdata
 Version: 2012j-1
 
 The configuration script of the tzdata package, wich uses debconf, prevents
 non-interactive (re)configuration of the package.
 
 To reproduce:
 
 - feed debconf with new values for tzdata keys (ex. debconf-set-selections)
 - run 'dpkg-reconfigure -fnoninteractive tzdata'
 - configuration is unchanged
 
 I propose the following change which makes non-interactive reconfiguration 
 possible:
 
   
   --- /var/lib/dpkg/info/tzdata.config.orig   2013-03-27 
 18:58:53.0 +0100
   +++ /var/lib/dpkg/info/tzdata.config2013-03-27 18:35:53.0 +0100
   @@ -370,8 +370,10 @@

# Initializes debconf default values from the ones found in
# configuration files
   -db_set tzdata/Areas $AREA
   -db_set tzdata/Zones/$AREA $ZONE
   +if [ -z $DEBCONF_RECONFIGURE ]; then
   +  db_set tzdata/Areas $AREA
   +  db_set tzdata/Zones/$AREA $ZONE
   +fi

STATE=1
while [ $STATE -ge 0 ]; do
   
 
 Note: the comment could make us believe that keys are initialized with the
 current values of the debconf database, but it is not the case. These values
 are computed from /etc/timezone.

thank you for your report and patch.

I am able to reproduce this on Debian Wheezy. It would be great if the
patch could be applied to make non-interactive installations easier.


Thanks,

Paul


signature.asc
Description: This is a digitally signed message part


Bug#704089: tzdata config script prevents non-interactive (re)configuration

2013-03-27 Thread Sébastien Bocahu
Package: tzdata
Version: 2012j-1

The configuration script of the tzdata package, wich uses debconf, prevents
non-interactive (re)configuration of the package.

To reproduce:

- feed debconf with new values for tzdata keys (ex. debconf-set-selections)
- run 'dpkg-reconfigure -fnoninteractive tzdata'
- configuration is unchanged

I propose the following change which makes non-interactive reconfiguration 
possible:

  
  --- /var/lib/dpkg/info/tzdata.config.orig   2013-03-27 18:58:53.0 
+0100
  +++ /var/lib/dpkg/info/tzdata.config2013-03-27 18:35:53.0 +0100
  @@ -370,8 +370,10 @@
   
   # Initializes debconf default values from the ones found in
   # configuration files
  -db_set tzdata/Areas $AREA
  -db_set tzdata/Zones/$AREA $ZONE
  +if [ -z $DEBCONF_RECONFIGURE ]; then
  +  db_set tzdata/Areas $AREA
  +  db_set tzdata/Zones/$AREA $ZONE
  +fi
   
   STATE=1
   while [ $STATE -ge 0 ]; do
  

Note: the comment could make us believe that keys are initialized with the
current values of the debconf database, but it is not the case. These values
are computed from /etc/timezone.

Thanks,

-- 
Sebastien Bocahu


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org