Standardize BROWSER and MAILER environment variables.
Slatian
baschdel at disroot.org
Mon Oct 16 18:14:03 UTC 2023
Hello!
Trying to fix issues with the xdg-utils I've noticed, that neither the
BROWSER nor the MAILER environment variables are properly standardized
anywhere. There should be a specification on such variables.
I've already opened an issue over on the freedesktop gitlab,
with a rough description of how both are currently handled in xdg-utils:
https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/119
What both currently have in common is that:
* They are colon separated lists of commands that may have arguments.
* The URI or file-path argument is passed after the other arguments.
* Bad/broken support for quoting.
* When a command exits with an error exit code, the next one is tried.
In addition to that the BROWSER variable can have a %s somewhere in it
that will get replaced with the URL instead of the URL being appended.
Example: BROWSER="fancy-browser --open-url=%s --fancy-option"
For both the fallback mechanism is known to cause trouble i.e. when a
program was closed less gently (oom-killer, manual kill, crash) it
causes an error code that triggers a second opener, even if if hours or
days have passed. (Current proposed solution for xdg-utils are timeouts)
So a specification would have to include:
* When are those supposed to be called
* What are possible arguments
* Fancy %s syntax (or clearly state that it isn't possible)
* Quoting and escaping (or clearly state a lack of it)
* How fallbacks are supposed to be handled
I'm in favor of having as few features as possible to make it easy to
implement correctly without any libraries or helpers.
Before writing a draft, Id like to collect already existing
implementations of those variables.
The ones I currently know about are:
* xdg-utils (as described above)
* newsboat (BROWSER, with %u instead of %s, no fallback)
Greetings!
- Slatian
More information about the xdg
mailing list