Bug#822462: dpkg should automatically clean up obsolete conffiles (make rm_conffile unnecessary)

2017-03-21 Thread Daniel Kahn Gillmor
On Tue 2017-03-21 21:11:43 -0400, Clint Adams wrote:
> On Sun, Apr 24, 2016 at 02:20:50PM -0400, Daniel Kahn Gillmor wrote:
>> Currently, if a package drops a config file, the package maintainer
>> has to invoke:
>> 
>>   dpkg-maintscript-helper rm_conffile $CONFFILE $PRIOR_VERSION $PKGNAME -- 
>> "$@"
>> 
>> in the package's prinst, postinst, and postrm maintainer scripts.
>> 
>> Instead, dpkg should be aware of the dropped config file and handle it
>> automatically.
>
> Are you suggesting that dpkg would diff the prior .conffiles with the in-.deb
> control file, and perform the equivalent of dpkg-maintscript-helper 
> rm_conffile
> on each line that is deleted, and then make `dpkg-maintscript-helper 
> rm_conffile`
> a no-op?

That sounds like a reasonable approach to me.  Thanks for the
suggestion!

--dkg



Bug#822462: dpkg should automatically clean up obsolete conffiles (make rm_conffile unnecessary)

2017-03-21 Thread Guillem Jover
Hi!

On Wed, 2017-03-22 at 01:11:43 +, Clint Adams wrote:
> On Sun, Apr 24, 2016 at 02:20:50PM -0400, Daniel Kahn Gillmor wrote:
> > Currently, if a package drops a config file, the package maintainer
> > has to invoke:
> > 
> >   dpkg-maintscript-helper rm_conffile $CONFFILE $PRIOR_VERSION $PKGNAME -- 
> > "$@"
> > 
> > in the package's prinst, postinst, and postrm maintainer scripts.
> > 
> > Instead, dpkg should be aware of the dropped config file and handle it
> > automatically.

> Are you suggesting that dpkg would diff the prior .conffiles with the in-.deb
> control file, and perform the equivalent of dpkg-maintscript-helper 
> rm_conffile
> on each line that is deleted, and then make `dpkg-maintscript-helper 
> rm_conffile`
> a no-op?

dpkg already knows when a conffile gets dropped, and marks it
appropriately as "obsolete" in its Conffiles field on the db. It could
already remove those whenever they have not been locally modified, which
is something I should probably do for 1.19.x, after some careful
consideration (that would be #330256).

> > This will help us to reduce some of the need for maintainer scripts,
> > making the archive more maintainable and auditable.

Not really, because even if dpkg can handle the case of unmodified
conffiles, it cannot handle the case of modified ones. As it does not
know if those are intended to be renamed, removed, switched to manual
config-files or are changing package ownership.

I've not merged this bug with #330256, because I understand the
underlaying request here is not covered by the other bug, i.e. make
dpkg-maintscript-helper unnecessary. So that we can switch to more
declarative packages.

This could be solved by marking such actions in the conffile control
file when packaging the .deb, and then making dpkg itself perform the
actions now done by the helper. For example, this completely made-up
and not thought-very-deeply syntax:

,--- DEBIAN/conffiles ---
/etc/some-file
/etc/other-file
/etc/obsolete-file remove
/etc/old-file rename /etc/new-file
/etc/move-file move new-package
/etc/manual-file handled
`---

Thanks,
Guillem



Bug#822462: dpkg should automatically clean up obsolete conffiles (make rm_conffile unnecessary)

2017-03-21 Thread Clint Adams
On Sun, Apr 24, 2016 at 02:20:50PM -0400, Daniel Kahn Gillmor wrote:
> Currently, if a package drops a config file, the package maintainer
> has to invoke:
> 
>   dpkg-maintscript-helper rm_conffile $CONFFILE $PRIOR_VERSION $PKGNAME -- 
> "$@"
> 
> in the package's prinst, postinst, and postrm maintainer scripts.
> 
> Instead, dpkg should be aware of the dropped config file and handle it
> automatically.

Are you suggesting that dpkg would diff the prior .conffiles with the in-.deb
control file, and perform the equivalent of dpkg-maintscript-helper rm_conffile
on each line that is deleted, and then make `dpkg-maintscript-helper 
rm_conffile`
a no-op?



Bug#822462: dpkg should automatically clean up obsolete conffiles (make rm_conffile unnecessary)

2016-04-24 Thread Daniel Kahn Gillmor
Package: dpkg
Version: 1.18.4
Severity: normal
Control: user debian-d...@lists.debian.org
Control: usertag -1 declarative-packaging

Currently, if a package drops a config file, the package maintainer
has to invoke:

  dpkg-maintscript-helper rm_conffile $CONFFILE $PRIOR_VERSION $PKGNAME -- "$@"

in the package's prinst, postinst, and postrm maintainer scripts.

Instead, dpkg should be aware of the dropped config file and handle it
automatically.

This will help us to reduce some of the need for maintainer scripts,
making the archive more maintainable and auditable.

 --dkg

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing'), (200, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dpkg depends on:
ii  libbz2-1.0   1.0.6-8
ii  libc62.22-6
ii  liblzma5 5.1.1alpha+20120614-2.1
ii  libselinux1  2.4-3+b1
ii  tar  1.28-2.1
ii  zlib1g   1:1.2.8.dfsg-2+b1

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt  1.2.10

-- debconf-show failed