Bug#983886: libgvc6: fails foreign package installation
Package: libgvc6
Version: 2.42.2-4+b2
Tags: patch
User: debian-cross@lists.debian.org
Usertags: cross-satisfiability
Control: affects -1 + src:gammaray src:gazebo src:ggobi src:k3d src:ladish src:nip2 src:ns3 src:python-pygraphviz src:radare2-cutter src:regina-normal src:vala
The affected packages cannot install their cross Build-Depends, because
they request the host architecture libgvc6 and installing this package
for foreign architectures fails postinst, because running
libgvc6-config-update fails with an Exec format error.
You can easily reproducibe this failure on amd64 in an essential chroot
if you don't have qemu installed:
# dpkg --print-architecture
amd64
# dpkg --add-architecture ppc64el
# apt-get update
...
# apt-get -y install libgvc6:ppc64el
...
Setting up libgvc6:ppc64el (2.42.2-4+b2) ...
/var/lib/dpkg/info/libgvc6.postinst: 8: libgvc6-config-update: Exec format error
dpkg: error processing package libgvc6:ppc64el (--configure):
installed libgvc6:ppc64el package post-installation script subprocess returned error exit status 126
...
#
I looked into this for a while and found that:
* libgvc6-config-update is the same binary as dot (indeed dot is a
symlink to it).
* The generated /usr/lib/<triplet>/config6a is used by dot.
* As such it seems to me that generating it from graphviz would make
more sense (and since graphviz is Multi-Arch: foreign, it is never
installed for foreign architectures by accident.)
If that makes sense to you, then the attached patch should do the trick.
It discards libgvc6-plugin-config and instead creates a dpkg trigger in
graphviz. Installing any plugin will automatically invoke the trigger
and cause the config6a to be regenerated. For foreign plugins, no config
is generated at all anymore as that doesn't work anyway if the
architecture is not runnable.
Irrespective of which package takes care of this config file, using
dpkg triggers seems like a good idea, because it nicely centralizes the
responsibility of the file.
What do you think about this proposed change?
Helmut
diff --minimal -Nru graphviz-2.42.2/debian/README.Debian-packaging graphviz-2.42.2/debian/README.Debian-packaging
--- graphviz-2.42.2/debian/README.Debian-packaging 2014-12-10 16:25:41.000000000 +0100
+++ graphviz-2.42.2/debian/README.Debian-packaging 2021-03-02 15:11:52.000000000 +0100
@@ -28,13 +28,8 @@
[ Plugins & config file ]
* They are/will be named libgraphvizN-*-plugin.
- * They have to use this mechanism in post{inst,rm} scripts to ensure that
- they are correctly registered. Copying the first stanza (about
- libgraphvizN-dev-config-update) of libgraphvizN's postinst to both plugin's
- postinst and postrm should be sufficient.
- * Each libgraphvizN should take care of its own "configN" file (creation,
- update, removal). In addition, "config" file should be removed (e.g. in
- postinst), since it may have subsisted during 2.8 -> 2.12 migration.
+ * They are automatically registered by means of dpkg-triggers once installed
+ into the appropriate directory.
* Care must be taken about the plugin files, they have to be excluded from
the libgraphvizN package (see libgraphvizN.install), that's why the content
of this latter package has to be listed in extenso, and that's why jokers
diff --minimal -Nru graphviz-2.42.2/debian/README.source graphviz-2.42.2/debian/README.source
--- graphviz-2.42.2/debian/README.source 2014-12-10 16:25:41.000000000 +0100
+++ graphviz-2.42.2/debian/README.source 2021-03-02 15:11:52.000000000 +0100
@@ -28,13 +28,8 @@
[ Plugins & config file ]
* They are/will be named libgraphvizN-*-plugin.
- * They have to use this mechanism in post{inst,rm} scripts to ensure that
- they are correctly registered. Copying the first stanza (about
- libgraphvizN-dev-config-update) of libgraphvizN's postinst to both plugin's
- postinst and postrm should be sufficient.
- * Each libgraphvizN should take care of its own "configN" file (creation,
- update, removal). In addition, "config" file should be removed (e.g. in
- postinst), since it may have subsisted during 2.8 -> 2.12 migration.
+ * They are automatically registered by means of dpkg-triggers once installed
+ into the appropriate directory.
* Care must be taken about the plugin files, they have to be excluded from
the libgraphvizN package (see libgraphvizN.install), that's why the content
of this latter package has to be listed in extenso, and that's why jokers
diff --minimal -Nru graphviz-2.42.2/debian/changelog graphviz-2.42.2/debian/changelog
--- graphviz-2.42.2/debian/changelog 2020-04-26 07:25:24.000000000 +0200
+++ graphviz-2.42.2/debian/changelog 2021-03-02 15:11:52.000000000 +0100
@@ -1,3 +1,11 @@
+graphviz (2.42.2-4.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Regenerate config6a from graphviz.postinst using dpkg triggers.
+ (Closes: #-1)
+
+ -- Helmut Grohne <helmut@subdivi.de> Tue, 02 Mar 2021 15:11:52 +0100
+
graphviz (2.42.2-4) unstable; urgency=medium
* Build with Guile 3.0 (closes: #885198).
diff --minimal -Nru graphviz-2.42.2/debian/graphviz.postinst.in graphviz-2.42.2/debian/graphviz.postinst.in
--- graphviz-2.42.2/debian/graphviz.postinst.in 1970-01-01 01:00:00.000000000 +0100
+++ graphviz-2.42.2/debian/graphviz.postinst.in 2021-03-02 15:11:52.000000000 +0100
@@ -0,0 +1,24 @@
+#!/bin/sh
+set -e
+
+echo "graphviz.postinst $*"
+
+if test "$1" = configure; then
+ # Remove previous locations of these files such that we never have to
+ # care about these again.
+ if [ -f /usr/lib/graphviz/config6 ]; then
+ rm -f /usr/lib/graphviz/config6
+ fi
+ if [ -f /usr/lib/graphviz/config6a ]; then
+ rm -f /usr/lib/graphviz/config6a
+ fi
+fi
+
+if test "$1" = triggered || test "$1" = configure; then
+ if [ -f /usr/lib/@TRIPLET@/graphviz/config6a]; then
+ rm -f /usr/lib/@TRIPLET@/graphviz/config6a
+ fi
+ dot -c
+fi
+
+#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/graphviz.postrm.in graphviz-2.42.2/debian/graphviz.postrm.in
--- graphviz-2.42.2/debian/graphviz.postrm.in 1970-01-01 01:00:00.000000000 +0100
+++ graphviz-2.42.2/debian/graphviz.postrm.in 2021-03-02 15:11:52.000000000 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ abort-install|remove)
+ if [ -f /usr/lib/@TRIPLET@/graphviz/config6a ]; then
+ rm -f /usr/lib/@TRIPLET@/graphviz/config6a
+ fi
+ ;;
+esac
+
+#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/graphviz.triggers.in graphviz-2.42.2/debian/graphviz.triggers.in
--- graphviz-2.42.2/debian/graphviz.triggers.in 1970-01-01 01:00:00.000000000 +0100
+++ graphviz-2.42.2/debian/graphviz.triggers.in 2021-03-02 15:11:52.000000000 +0100
@@ -0,0 +1 @@
+interest-noawait /usr/lib/@TRIPLET@/graphviz
diff --minimal -Nru graphviz-2.42.2/debian/libgraphviz-config-update.pod.in graphviz-2.42.2/debian/libgraphviz-config-update.pod.in
--- graphviz-2.42.2/debian/libgraphviz-config-update.pod.in 2014-12-10 16:25:41.000000000 +0100
+++ graphviz-2.42.2/debian/libgraphviz-config-update.pod.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-=head1 NAME
-
-libgraphviz##SONAME##-config-update - maintain libgraphviz's configuration file
-
-
-=head1 SYNOPSIS
-
-B<libgraphviz##SONAME##-config-update> B<-c>
-
-
-=head1 DESCRIPTION
-
-Graphviz tools are using a configuration file
-(F</usr/lib/graphviz/config##SONAME##> at the moment) to get some
-plugin options. This command is used in B<libgraphviz##SONAME##> and
-B<libgraphviz##SONAME##-*-plugin> packages' maintainer scripts to
-update this configuration file when plugins are installed, updated, or
-removed.
-
-
-=head1 NOTE
-
-This tool is intended to be used only in maintainer scripts and it
-shouldn't be needed to run it manually.
-
-
-=head1 AUTHOR
-
-This manual page was written by Cyril Brulebois
-<cyril.brulebois@enst-bretagne.fr>.
-
-It can be distributed under the same terms as the graphviz package.
diff --minimal -Nru graphviz-2.42.2/debian/libgvc-config-update.pod.in graphviz-2.42.2/debian/libgvc-config-update.pod.in
--- graphviz-2.42.2/debian/libgvc-config-update.pod.in 2014-12-10 16:25:41.000000000 +0100
+++ graphviz-2.42.2/debian/libgvc-config-update.pod.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-=head1 NAME
-
-libgvc##SONAME##-config-update - maintain libgvc's configuration file
-
-
-=head1 SYNOPSIS
-
-B<libgvc##SONAME##-config-update> B<-c>
-
-
-=head1 DESCRIPTION
-
-Graphviz tools are using a configuration file
-(F</usr/lib/graphviz/config##SONAME##> at the moment) to get some
-plugin options. This command is used in B<libgvc##SONAME##> and
-B<libgvc##SONAME##-*-plugin> packages' maintainer scripts to
-update this configuration file when plugins are installed, updated, or
-removed.
-
-
-=head1 NOTE
-
-This tool is intended to be used only in maintainer scripts and it
-shouldn't be needed to run it manually.
-
-
-=head1 AUTHOR
-
-This manual page was written by Cyril Brulebois
-<cyril.brulebois@enst-bretagne.fr>.
-
-It can be distributed under the same terms as the graphviz package.
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6-plugins-gtk.lintian-overrides graphviz-2.42.2/debian/libgvc6-plugins-gtk.lintian-overrides
--- graphviz-2.42.2/debian/libgvc6-plugins-gtk.lintian-overrides 2016-04-11 17:09:21.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6-plugins-gtk.lintian-overrides 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-command-with-path-in-maintainer-script postinst:6 /usr/sbin/libgvc6-config-update
-command-with-path-in-maintainer-script postrm:6 /usr/sbin/libgvc6-config-update
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6-plugins-gtk.postinst graphviz-2.42.2/debian/libgvc6-plugins-gtk.postinst
--- graphviz-2.42.2/debian/libgvc6-plugins-gtk.postinst 2018-04-02 19:22:54.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6-plugins-gtk.postinst 1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Update the configuration file (/usr/lib/[MULTIARCH]/graphviz/config6a)
-if [ -x /usr/sbin/libgvc6-config-update ]; then
- libgvc6-config-update -c
-fi
-
-#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6-plugins-gtk.postrm graphviz-2.42.2/debian/libgvc6-plugins-gtk.postrm
--- graphviz-2.42.2/debian/libgvc6-plugins-gtk.postrm 2018-04-02 19:22:54.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6-plugins-gtk.postrm 1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Update the configuration file (/usr/lib/[MULTIARCH]/graphviz/config6a)
-if [ -x /usr/sbin/libgvc6-config-update ]; then
- libgvc6-config-update -c
-fi
-
-#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6.install graphviz-2.42.2/debian/libgvc6.install
--- graphviz-2.42.2/debian/libgvc6.install 2019-10-09 18:24:32.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6.install 2021-03-02 15:11:52.000000000 +0100
@@ -8,6 +8,3 @@
usr/lib/*/graphviz/libgvplugin_dot_layout.so.*
usr/lib/*/graphviz/libgvplugin_visio.so.*
usr/lib/*/libgvc*.so.*
-
-# Renamed afterwards to libgvcN-config-update in debian/rules
-usr/bin/dot usr/sbin
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6.lintian-overrides graphviz-2.42.2/debian/libgvc6.lintian-overrides
--- graphviz-2.42.2/debian/libgvc6.lintian-overrides 2016-04-11 17:08:44.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6.lintian-overrides 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-command-with-path-in-maintainer-script postinst:7 /usr/sbin/libgvc6-config-update
-
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6.postinst graphviz-2.42.2/debian/libgvc6.postinst
--- graphviz-2.42.2/debian/libgvc6.postinst 2018-04-02 19:22:54.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6.postinst 1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Update the configuration file (/usr/lib/[MULTIARCH]/graphviz/config6a)
-# Needed for the plugins too
-if [ -x /usr/sbin/libgvc6-config-update ]; then
- libgvc6-config-update -c
-fi
-
-# Remove the old configuration file if present, see README.Debian-packaging
-# Needed only in libgraphivzN
-if [ -f /usr/lib/graphviz/config ]; then
- rm -f /usr/lib/graphviz/config6
-fi
-if [ -f /usr/lib/graphviz/config6a ]; then
- rm -f /usr/lib/graphviz/config6a
-fi
-
-#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6.postinst.in graphviz-2.42.2/debian/libgvc6.postinst.in
--- graphviz-2.42.2/debian/libgvc6.postinst.in 1970-01-01 01:00:00.000000000 +0100
+++ graphviz-2.42.2/debian/libgvc6.postinst.in 2021-03-02 15:11:52.000000000 +0100
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+# Remove the old configuration file if present, see README.Debian-packaging
+# Needed only in libgraphivzN
+if [ -f /usr/lib/graphviz/config ]; then
+ rm -f /usr/lib/graphviz/config6
+fi
+if [ -f /usr/lib/graphviz/config6a ]; then
+ rm -f /usr/lib/graphviz/config6a
+fi
+
+if test "$1" = configure && dpkg --compare-versions "$2" lt 2.42.2-4.1 && ! dpkg-query -f '${Status}' -W graphviz | egrep -q 'installed|triggers-awaited|triggers-pending'; then
+ # If we upgrade from a pre-trigger version of graphviz and graphviz is absent, we must delete the config file.
+ if [ -f /usr/lib/@TRIPLET@/graphviz/config6a ]; then
+ rm -f /usr/lib/@TRIPLET@/graphviz/config6a
+ fi
+fi
+
+#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/libgvc6.postrm.in graphviz-2.42.2/debian/libgvc6.postrm.in
--- graphviz-2.42.2/debian/libgvc6.postrm.in 2018-04-02 19:22:54.000000000 +0200
+++ graphviz-2.42.2/debian/libgvc6.postrm.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Remove the configuration file if present, see README.Debian-packaging
-# Needed only in libgraphivzN
-if [ -f /usr/lib/graphviz/config6 ]; then
- rm -f /usr/lib/graphviz/config6
-fi
-if [ -f /usr/lib/graphviz/config6a ]; then
- rm -f /usr/lib/graphviz/config6a
-fi
-
-if [ -f /usr/lib/@TRIPLET@/graphviz/config6a ]; then
- rm -f /usr/lib/@TRIPLET@/graphviz/config6a
-fi
-
-#DEBHELPER#
diff --minimal -Nru graphviz-2.42.2/debian/rules graphviz-2.42.2/debian/rules
--- graphviz-2.42.2/debian/rules 2019-10-09 18:24:32.000000000 +0200
+++ graphviz-2.42.2/debian/rules 2021-03-02 15:11:52.000000000 +0100
@@ -7,7 +7,7 @@
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
-AUTOGENERATED = libgvc6.postrm
+AUTOGENERATED = graphviz.postinst graphviz.postrm graphviz.triggers libgvc6.postinst
ifeq ($(DEB_HOST_ARCH_OS),hurd)
CONFIGURE_LIBS = LIBS="-Wl,--no-as-needed -Wl,-lpthread -Wl,--as-needed"
@@ -96,12 +96,6 @@
override_dh_install-arch:
dh_install --arch
- mv $(CURDIR)/debian/libgvc$(SO_GVC)/usr/sbin/dot \
- $(CURDIR)/debian/libgvc$(SO_GVC)/usr/sbin/libgvc$(SO_GVC)-config-update
- # Symlink dot due to #868546 (debug packages conflict)
- rm $(CURDIR)/debian/graphviz/usr/bin/dot
- ln -s /usr/sbin/libgvc$(SO_GVC)-config-update \
- $(CURDIR)/debian/graphviz/usr/bin/dot
# NFU
rm -rf $(CURDIR)/debian/tmp/usr/lib64/
Reply to: