element-hq / element-desktop

A glossy Matrix collaboration client for desktop.
https://element.io
GNU Affero General Public License v3.0
1.16k stars 266 forks source link

Element-Desktop: Debian package: postinst and postrm ignore args #665

Open mcg-matrix opened 2 years ago

mcg-matrix commented 2 years ago

The "maintainer scripts" postinst and postrm, which are part of the Debian package "element-desktop" offered via https://packages.riot.im/debian/, ignore any arguments they are given.

Everything will be fine if nothing goes wrong (as always ;-)), but if postinst ever gets called with "abort-upgrade", "abort-remove", "abort-deconfigure", or whatever else (other than "configure"), it will probably not do what it is expected to do. Similar for postrm.

Here's the complete contents of the postinst maintainer script found in the package file (.deb) for version 1.9.5 of the package – no distinction based on $1 to be seen:

#!/bin/bash

# Link to the binary
ln -sf '/opt/Element/element-desktop' '/usr/bin/element-desktop'

# SUID chrome-sandbox for Electron 5+
chmod 4755 '/opt/Element/chrome-sandbox' || true

update-mime-database /usr/share/mime || true
update-desktop-database /usr/share/applications || true

(I have no clue where that code is coming from.)

Some(!) of the various possible invocations to expect can be seen in these flow charts showing some(!?) of the flows likely to occur: https://www.debian.org/doc/debian-policy/ap-flowcharts.html

dbkr commented 2 years ago

I would assume this an upstream issue with electron-builder (it comes from here: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/linux/after-install.tpl) although I can't find a corresponding issue. Sounds like you may be able to explain the issue better than me: would you like to open an upstream issue & link it back here?

mcg-matrix commented 2 years ago

would you like to open an upstream issue & link it back here?

Done: https://github.com/electron-userland/electron-builder/issues/6468 Let's see what happens. :-)