mbeijen / File-MimeInfo

Perl module for determining file types using the freedesktop.org shared mime-info database
https://metacpan.org/module/File::MimeInfo
20 stars 13 forks source link

`mimeopen` uses wrong exit code even if execution went correctly #54

Closed purplebar0 closed 5 months ago

purplebar0 commented 8 months ago

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, 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.

slatian commented 5 months ago

I can confirm that this causes a problem with xdg-open.