Package: dictionaries-common-dev
Version: 1.30.3
Severity: normal
Control: affects -1 libqt5webengine-data
Control: affects -1 libqt6webengine6-data
Control: affects -1 scowl

I have been informed that the method we used when resolving #1020387 to set the
Qt WebEngine binary dictionary location environment variable only works when
Systemd is the init system.

libqt5webengine-data installs the following file:

/etc/environment.d/90qtwebengine-dictionaries-path.conf

with contents:

QTWEBENGINE_DICTIONARIES_PATH=/usr/share/hunspell-bdic/

libqt6webengine6-data installs:

/etc/environment.d/90qt6webengine-dictionaries-path.conf

with the same contents.

However, it has been reported to me that if a system is running an init system
different than Systemd the /etc/environment.d/ directory is not parsed.  Rather,
other init systems only parse the single file /etc/environment (which, in turn,
isn't parsed by Systemd).

                    Why can't we just all get along?  ;)

The solution is probably to have the qtwebengine-data packages add this same
environment variable to /etc/environment.  My question regards the best way to
manage this, especially in the case of uninstallations.

With the current solution, it doesn't cause any problems if the environment
variable is specified twice in /etc/environment.d (as it currently is on my
system because I have both Qt 5 and Qt 6 versions of WebEngine installed).  And
each file is uninstalled with its respective package.

With /etc/environment, I assume we can use something like sed on install to
check if QTWEBENGINE_DICTIONARIES_PATH is already defined, and add it if it
isn't.  However, on uninstall it wouldn't be safe to remove the variable because
if someone has both Qt WebEngines installed and then removes one (as will
eventually happen with Qt 5), this would leave the file with no variable
defined.  I can't think of any way leaving this variable defined would cause
problems, but it does seem a bit unprofessional.

Another option might be to have each package add the variable once on install
and only delete one copy of the variable on uninstall (I'm assuming sed can be
configured to do that).  Just like with /etc/environment.d/, I assume it doesn't
cause any problems if the variable is defined multiple times.

My question is, does anyone know of a canonical way (besides sed trickery) to
manage environment variables in /etc/environment?  Or is every package on their
own to figure out how to do it?

Reply via email to