On 06/05/2024 21:24, Max Nikulin wrote:
It seems there are a couple of bugs in update-mime:
1. It does not perform an unquote pass that should retain only a half of
backslashes from Exec field of .desktop file.
I was wrong here. mailcap(5):
(In fact, the backslash can be used to quote any character, including itself.)
So doubled backslashes (as in .desktop files) are correct.
What is wrong is lack of backslashes added before ";" and it is a bug.
grep Exec /usr/share/applications/emacsclient.desktop
Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient
--alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec
emacsclient --alternate-editor= --create-frame; fi" sh %F
should be converted to /etc/mailcap entry
application/x-shellscript; sh -c "if [ -n \\"\\$*\\" ]\; then exec
emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"\;
else exec emacsclient --alternate-editor= --create-frame\; fi" sh %s;
test=test -n "$DISPLAY"