[Docker-maint] Bug#784536: golang-go: leaves alternatives after purge: /usr/bin/{go, gofmt}

Andreas Beckmann anbe at debian.org
Wed May 6 13:43:03 UTC 2015


Package: golang-go
Version: 2:1.4.2-2
Severity: important
User: debian-qa at lists.debian.org
Usertags: piuparts

Hi,

during a test with piuparts I noticed your package left unowned files on
the system after purge, which is a violation of policy 6.8:

https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-removedetails

The leftover files are actually alternatives that were installed by the
package but have not been properly removed.

While there is ongoing discussion how to remove alternatives correctly
(see https://bugs.debian.org/71621 for details) the following strategy
should work for regular cases:
* 'postinst configure' always installs the alternative
* 'prerm remove' removes the alternative
* 'postrm remove' and 'postrm disappear' remove the alternative
In all other cases a maintainer script is invoked (e.g. upgrade,
deconfigure) the alternatives are not modified to preserve user
configuration.
Removing the alternative in 'prerm remove' avoids having a dangling link
once the actual file gets removed, but 'prerm remove' is not called in
all cases (e.g. unpacked but not configured packages or disappearing
packages) so the postrm must remove the alternative again
(update-alternatives gracefully handles removal of non-existing
alternatives).

Note that the arguments for adding and removing alternatives differ, for
removal it's 'update-alternatives --remove <name> <path>'.

Filing this as important as having a piuparts clean archive is a release
goal since lenny.

>From the attached log (scroll to the bottom...):

0m46.0s ERROR: WARN: Broken symlinks:
  /usr/bin/gofmt -> /etc/alternatives/gofmt
  /usr/bin/go -> /etc/alternatives/go
  /etc/alternatives/gofmt -> /usr/lib/go/bin/gofmt
  /etc/alternatives/go -> /usr/lib/go/bin/go

0m50.1s ERROR: FAIL: Package purging left files on system:
  /etc/alternatives/go -> /usr/lib/go/bin/go	 not owned
  /etc/alternatives/gofmt -> /usr/lib/go/bin/gofmt	 not owned
  /usr/bin/go -> /etc/alternatives/go	 not owned
  /usr/bin/gofmt -> /etc/alternatives/gofmt	 not owned

Also the postrm spews 

  Removing golang-go (2:1.4.2-2) ...
  Purging configuration files for golang-go (2:1.4.2-2) ...
  rmdir: failed to remove '/etc/golang': No such file or directory
  rmdir: failed to remove '/etc/golang': No such file or directory

which does not result in an error (good!) but the error messages
could be avoided, too. Also trying to rmdir it twice sounds wrong.


cheers,

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: golang-go_2:1.4.2-2.log.gz
Type: application/gzip
Size: 10197 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/docker-maint/attachments/20150506/43188565/attachment.bin>


More information about the Docker-maint mailing list