Subject: bug#67736: closed (Re: bug#67736: 30.0.50; emacsclient.desktop fails with quoting-related error)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 18 Dec 2023 12:18:02 +0000

Your bug report

#67736: 30.0.50; emacsclient.desktop fails with quoting-related error

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
67736: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67736
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#67736: 30.0.50; emacsclient.desktop fails with quoting-related error
From: Mekeor Melire <[email-masked]>
To: [email-masked]
Cc: Ulrich Mueller <[email-masked]>, Peter Oliver <[email-masked]>, [email-masked], Eli Zaretskii <[email-masked]>
Date: Mon, 18 Dec 2023 12:14:01 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

2023-12-18 11:17 [email-masked]:

> > Honestly, I don't know how to handle this tricky situation:
> > freedesktop.org has specification for Exec entries in .desktop-files.
> > xdg-utils itself does implement this specification correctly.
>
> Is a "not" missing there? Otherwise I don't understand the sentence.

You are right, a "not" was missing.

> Standards exist for a reason, namely that developers can program
> against them, instead of second-guessing other implementations.
>
> I think we have established that the bug is in xdg-utils, so that's
> where it should be ultimately fixed. Not sure if it's worth having a
> short-term workaround using a wrapper script.

You are right. Let's close this bug. It's an upstream-bug.

Subject: 30.0.50; emacsclient.desktop fails with quoting-related error
From: Mekeor Melire <[email-masked]>
To: [email-masked]
Date: Sun, 10 Dec 2023 00:13:33 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

In GNU+Linux, in Xorg, with xdg-utils installed, and with
emacsclient.desktop[1] from Emacs repository installed, configure the
mapping from mime-types to applications by creating a file
~/.config/mimeapps.list with contents:

    [Default Applications]
    text/plain=emacsclient.desktop

Create a plain-text file and open it with the XDG default application:

    echo hello > example.txt
    xdg-open example.txt

I expect Emacsclient to start and open the file. Instead, I get the
following error messages which point to quoting-related problems.

    $ xdg-open example.txt
    egrep: warning: egrep is obsolescent; using grep -E
    [: -c: line 1: unexpected EOF while looking for matching `"'
    [: -c: line 2: syntax error: unexpected end of file
    [: -c: line 1: unexpected EOF while looking for matching `"'
    [: -c: line 2: syntax error: unexpected end of file
    [: -c: line 1: unexpected EOF while looking for matching `"'
    [: -c: line 2: syntax error: unexpected end of file

Apparently, since the default application Emacsclient exits with
failure, xdg-open then proceeds by trying out other applications that
have an installed .desktop-file. Thus another program opens the file.

Does anyone else experience this problem?

It seems like it is a problem introduced with bug#49195 / commit
cbf220bc31c0a00c45b22c140eda7854d81d991b [2]. All versions of the Exec=
line of emacsclient.desktop result in the same erroneous behavior for me
since this commit. I.e. the last version that works is just:

    Exec=emacsclient -c %F

Please let me know if you can or cannot reproduce this, because it might
also possibly be a bug in my OS distribution, GNU Guix System.

By the way, I'm using the latest version of xdg-utils, 1.1.3, probably
released on 2018-05-10.

In GNU Emacs 30.0.50 (build 1, x86_64-unknown-linux-gnu, Motif Version
2.3.8, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/whmdrrv8db90a238jgjy24hd13diljfl-emacs-next-motif-30.0.50-1.9d27b95
 --enable-fast-install --build=x86_64-unknown-linux-gnu
 --with-x-toolkit=motif --with-modules --with-native-compilation=aot
 --disable-build-details'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XPM MOTIF ZLIB

[1]  https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/emacsclient.desktop
[2]  https://git.savannah.gnu.org/cgit/emacs.git/commit/etc/emacsclient.desktop?id=cbf220bc31c0a00c45b22c140eda7854d81d991b