Bug#919028: chrome-gnome-shell: postinst fails on reconfigure or if json already exists

Mike Miller mtmiller at debian.org
Sat Jan 12 00:08:08 GMT 2019


Package: chrome-gnome-shell
Version: 10.1-4
Severity: normal
Tags: patch

Dear Maintainer,

The postinst script fails if

  /etc/opt/chrome/native-messaging-hosts/org.gnome.chrome_gnome_shell.json

already exists on the system at the time of install. I've been able to
reproduce this two different ways so far:

1. I manually copied the file before upgrading to 10.1-4. The postinst
   attempted to symlink on top of an existing regular file and failed.

2. I ran `dpkg-reconfigure chrome-gnome-shell` after successful install.
   The postinst attempted to symlink on top an an already existing
   symlink that it had created when it was first installed.

There are probably several different ways you could address this, I'm
attaching a suggestion that works for me. In general I would think if
the destination already exists as a file or a symlink, you should avoid
trying to overwrite it at all.

Thanks!


-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 'unstable-debug'), (800, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

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

Versions of packages chrome-gnome-shell depends on:
ii  gnome-shell       3.30.1-2
ii  python3           3.7.1-3
ii  python3-gi        3.30.4-1
ii  python3-requests  2.20.0-2

chrome-gnome-shell recommends no packages.

Versions of packages chrome-gnome-shell suggests:
ii  chromium  72.0.3626.7-4
pn  firefox   <none>

-- no debconf information
-------------- next part --------------
>From d8be8ae955cf79d0835b40718476561e97d79a9f Mon Sep 17 00:00:00 2001
From: Mike Miller <mtmiller at debian.org>
Date: Fri, 11 Jan 2019 15:53:55 -0800
Subject: [PATCH] Avoid failing install on link in /etc/opt/chrome

---
 debian/postinst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/debian/postinst b/debian/postinst
index 703dfacc44a7..af0cada8695a 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -5,6 +5,8 @@ set -e
 #DEBHELPER#
 
 mkdir -p /etc/opt/chrome/native-messaging-hosts
-ln -s /usr/share/chrome-gnome-shell/org.gnome.chrome_gnome_shell.json /etc/opt/chrome/native-messaging-hosts/
+if [ ! -e /etc/opt/chrome/native-messaging-hosts/org.gnome.chrome_gnome_shell.json ]; then
+  ln -sf /usr/share/chrome-gnome-shell/org.gnome.chrome_gnome_shell.json /etc/opt/chrome/native-messaging-hosts/
+fi
 
 exit 0
-- 
2.20.1



More information about the pkg-gnome-maintainers mailing list