Removing the offending line results in correct execution and the correct error code (0).
This is a problem since xdg-open, if it doesn't detect a known desktop environment, uses mimeopen if it's available, and checks its exit code. If it's nonzero, execution continues as if mimeopen failed, resulting in xdg-open opening the file multiple times.
This is described in more detail on Gentoo Forums, albeit nobody pointed out it was an issue with mimeopen.
For some reason, this
exit 7
is executed even if execution went correctly:https://github.com/mbeijen/File-MimeInfo/blob/cd55818f754a74e921db2e37b951b59b4916b408/mimeopen#L185
Removing the offending line results in correct execution and the correct error code (0).
This is a problem since
xdg-open
, if it doesn't detect a known desktop environment, usesmimeopen
if it's available, and checks its exit code. If it's nonzero, execution continues as ifmimeopen
failed, resulting inxdg-open
opening the file multiple times.This is described in more detail on Gentoo Forums, albeit nobody pointed out it was an issue with
mimeopen
.