lxqt / libqtxdg

Qt implementation of freedesktop.org xdg specs
https://lxqt.github.io
GNU Lesser General Public License v2.1
72 stars 35 forks source link

Consider single-quoted strings to be literals in Exec keys #270

Closed tsujan closed 2 years ago

tsujan commented 2 years ago

According to Desktop Entry Specification, we should not do so but, apparently, most DEs do it.

Closes https://github.com/lxqt/lxqt-panel/issues/1705

tsujan commented 2 years ago

After doing more tests, I agree that the parameter parsing is wrong regardless of the patch. The patch doesn't affect that — what was wrong remains wrong with it, under unusual but valid circumstances.

EDIT:

I found similar problems in QTerminal too.

libfm-qt lets GLib do it and so, pcmanfm-qt doesn't have these problems. The same may be true in all GTK DEs; don't know about KDE.

palinek commented 2 years ago

consider situation, when the ' is part of the file name -> it will be stripped wrongly

It won't because the condition isn't satisfied. A specific example would be very appreciated.

Any file, which name is (un)intentioanly enclosed ' 'i_am_the_file_staring_and_ending_with_single_quote'. The spec by itself doesn't state anything about absolute or relative file paths.

consider situation, when the %f would be surrounded by '

There's no change of behavior before and after the patch as far as I understand your point. A specific example?

You are right. The same would happen even w/o your patch. But with the patch, the app won't get '%f', but %f.

tsujan commented 2 years ago

Please read what comes after "EDIT:" in my previous comment (I added it a few seconds before your last comment).

It seems to me that the problem may be much more complex than what's considered in xdgdesktopfile.cpp. The more I read it, the more counterexamples come to my mind. How it could be solved, I have no clear idea yet.

tsujan commented 2 years ago

My conclusion:

xdgdesktopfile.cpp works under "ordinary" circumstances. For it to work under all valid circumstances, either it should be rewritten or some fixes should be applied to it. Only then, we could consider single quotes in a self-consistent way.

One "easy" way out of this situation could be rewriting xdgdesktopfile.cpp by using GLib (which is already used by libqtxdg).

Closing...