Bug#1112077: /usr/bin/mimeopen: Change in mimeopen breaks other applications, as it uses now run instead of exec
Jean Louis
bugs at gnu.support
Tue Aug 26 01:01:56 BST 2025
Package: libfile-mimeinfo-perl
Version: 0.35-1
Severity: normal
File: /usr/bin/mimeopen
Dear Maintainer,
* What led up to the situation?
Update to Trixie discovered that mimeopen has changes:
# ########## #
@@ -174,15 +174,16 @@
. ' with '.$default->get_value('Name')." ($mimetype)\n";
#print STDERR "exec string: ".$default->parse_Exec(@ARGV)."\n";
if (@ARGV == 1 or $default->wants_list) {
- $default->exec(@ARGV);
+ $default->run(@ARGV);
}
else {
my $last = pop @ARGV;
fork or $default->exec($_) for @ARGV;
- $default->exec($last);
+ $default->run($last);
}
and those changes break unrelated non-system software relying on it.
* What exactly did you do (or not do) that was effective (or
ineffective)?
I just upgraded, but then opening files (mass of files) became impossible, as program relied on mimeopen.
* What was the outcome of this action?
Programs can't open in asynchronous way, because process is not replaced but exits too early.
* What outcome did you expect instead?
That it works like it was before.
Before I could invoke from within Emacs:
(start-process (concat "MIME Open " file) (concat "MIME Open " file) "mimeopen" file)))))))
and it worked
but now I must do
(call-process-shell-command (concat "mimeopen" " '" file "'"))))))))
this later change is insecure as I cannot send securely parameters to mimeopen.
I am encountering a behavior change in the `mimeopen` script due to a
recent update — specifically from version 0.32 to 0.35, as shown in
the diff. The key changes are:
1. `.exec(...)` → `.run(...)`
2. `exit 7` → `exit 0`, with a comment explaining that `.run()` will "fork and fall through"
In the old version:
```perl
$default->exec(@ARGV);
```
In the new version:
```perl
$default->run(@ARGV);
```
→ Based on the diff and comment:
> `# run() will fork and fall through to here`
This means `run()` now uses `fork()` to start a child process, but
does not replace the current process. The parent process
continues, and eventually hits `exit 0`.
So:
- `exec()` → blocks, runs command, exits (synchronous)
- `run()` → forks, returns immediately, parent exits (asynchronous)
Personally, I find such undocumented and unanticipated changes in
system utilities like `mimeopen` deeply detrimental to users because
they silently break assumptions that other software—especially
long-standing, script-driven workflows—rely on for correct
behavior. In this case, replacing `exec` with `run` fundamentally
alters the process execution model: where `exec` would replace the
current process and block until the application launched (allowing
callers like Emacs to safely initiate file opens without worrying
about process lifecycle), `run` now forks a child and immediately
exits the parent, making it appear as though the command completed
successfully even before the target application starts. This breaks
asynchronous integration points in editors, scripts, and automation
tools that expect the process to remain alive or behave in a certain
way, leading to failed file openings, lost context, or race
conditions. Worse, it forces users into workarounds like using
`call-process-shell-command`, which introduces security risks by
requiring shell interpolation of filenames—something that should be
avoidable in a well-behaved system tool. Changes of this nature,
especially in widely-used plumbing commands, should never happen
without clear documentation, deprecation periods, or versioned
transitions, because they erode trust in the stability and
predictability of the entire system.
-- System Information: Debian Release: 13.0 APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500,
'stable') Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-38-amd64 (SMP w/24 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libfile-mimeinfo-perl depends on:
ii libencode-locale-perl 1.05-3
ii libfile-basedir-perl 0.09-2
ii libfile-desktopentry-perl 0.22-3
ii perl 5.40.1-6
ii shared-mime-info 2.4-5+b2
Versions of packages libfile-mimeinfo-perl recommends:
ii libio-stringy-perl 2.113-2
libfile-mimeinfo-perl suggests no packages.
-- no debconf information
More information about the pkg-perl-maintainers
mailing list