Summary: | desktop.eclass: make_desktop_entry .desktop naming overlaps for a same command with different arguments | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sergey Torokhov <torokhov-s-a> |
Component: | Eclasses | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ionen, orbea, sam, ulm |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://github.com/gentoo/gentoo/pull/27640 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
Patch for desktop.eclass
Patch for desktop.eclass v2 Special case to avoid foo-foo.desktop |
Description
Sergey Torokhov
2021-02-20 09:41:35 UTC
I'm hesitant to call this a eclass issue given the naming before this eclass change, while safer, was kind of ridiculous: /usr/share/applications/_usr_bin_xdg-open__usr_share_cantera_doc_doxygen_html_index.html-cantera-docs.desktop /usr/share/applications/_usr_bin_xdg-open__usr_share_cantera_doc_sphinx_html_index.html-cantera-docs.desktop Having ebuilds workaround this may(?) make more sense, from a quick look there's only 3 affected packages that use the same command with different arguments: - app-doc/cantera-docs - app-misc/oneko - games-roguelike/angband (if USE=X and USE=sdl at same time) But I guess it'd be handy if the eclass function let you manually specify the name rather than force-guess and rename after, or perhaps have a failsafe to prevent overwriting. Or perhaps incorporating (at least) arguments again would make sense, it's (usually) not that invasive unlike the command's full path. Those 3 packages would need revbumps to get their desktop entries corrected either way though. I think the rationale for that eclass change still applies. We don't want filenames like links_-g_%u-links-2.desktop. (In reply to Ionen Wolkens from comment #2) > Or perhaps incorporating (at least) arguments again would make sense, it's > (usually) not that invasive unlike the command's full path. Even without the command's path the file would be named xdg-open__usr_share_cantera_doc_doxygen_html_index.html-cantera-docs.desktop. Of course we could try to shorten the arguments in some clever way, but I'd rather not open that can of worms. Maybe make_desktop_entry() should have an optional sixth argument that would allow to override the filename? As there are only 3 package I assume it reasonable currently to rename entries after creation. At least if changes in *.desktop files naming aren't planning near future. (In reply to Ionen Wolkens from comment #1) > or perhaps have a failsafe to prevent overwriting. How about checking if the .desktop file already exists and adding a -2 -3.. to the filename? Created attachment 687915 [details, diff] Patch for desktop.eclass (In reply to Ionen Wolkens from comment #5) > How about checking if the .desktop file already exists and adding a -2 -3.. > to the filename? Yeah, that would work too. Can you test attached patch for desktop.eclass? (In reply to Ulrich Müller from comment #6) > Can you test attached patch for desktop.eclass? LGTM, tried the aforementioned packages and a few other tests (also prefix), and working as expected: /home/ionen/prefix/usr/share/applications/oneko-oneko.desktop /home/ionen/prefix/usr/share/applications/oneko-oneko-1.desktop /home/ionen/prefix/usr/share/applications/killall-oneko.desktop Posted to gentoo-dev for review: https://archives.gentoo.org/gentoo-dev/message/bc21732d1dcd5df1abea8e956b901f2d (In reply to Ionen Wolkens from comment #7) > /home/ionen/prefix/usr/share/applications/oneko-oneko.desktop > /home/ionen/prefix/usr/share/applications/oneko-oneko-1.desktop Thinking about it, this could cause problems for a package with multiple slots, e.g. foo:0 and foo:1. foo:0 would install these files: /usr/share/applications/foo-foo.desktop /usr/share/applications/foo-foo-1.desktop and foo:1 these: /usr/share/applications/foo-foo-1.desktop /usr/share/applications/foo-foo-1-1.desktop So I guess the counter should be added after the executable name, not after the package name, i.e. foo-foo.desktop, foo-1-foo.desktop etc. Created attachment 687927 [details, diff]
Patch for desktop.eclass v2
v2 looks good: /home/evan/prefix/usr/share/applications/oneko-oneko.desktop /home/evan/prefix/usr/share/applications/oneko-1-oneko.desktop /home/evan/prefix/usr/share/applications/killall-oneko.desktop Dummy test with slot 0,1 and 3 entries for same command + another: /usr/share/applications/foo-foomatic.desktop /usr/share/applications/foo-1-foomatic.desktop /usr/share/applications/foo-2-foomatic.desktop /usr/share/applications/fnord-foomatic.desktop /usr/share/applications/foo-foomatic-1.desktop /usr/share/applications/foo-1-foomatic-1.desktop /usr/share/applications/foo-2-foomatic-1.desktop /usr/share/applications/fnord-foomatic-1.desktop Looks suitable. Waiting for merge before app-doc/cantera-docs-2.5.1 version bump The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6212ee060d6a2962ac27cf57ffd721d14b64215 commit f6212ee060d6a2962ac27cf57ffd721d14b64215 Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2021-02-21 14:13:21 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2021-02-24 15:32:07 +0000 desktop.eclass: Avoid file collisions in make_desktop_entry() Closes: https://bugs.gentoo.org/771708 Reported-by: Sergey Torokhov <torokhov-s-a@yandex.ru> Suggested-by: Ionen Wolkens <sudinave@gmail.com> Signed-off-by: Ulrich Müller <ulm@gentoo.org> eclass/desktop.eclass | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) What's up with the 'foo-foo.desktop'? Wouldn't it be better for it to be just 'foo.desktop'? Created attachment 814063 [details, diff] Special case to avoid foo-foo.desktop (In reply to orbea from comment #14) > What's up with the 'foo-foo.desktop'? Wouldn't it be better for it to be > just 'foo.desktop'? Yes, that is somewhat ugly. We could of course avoid it, as in attached patch. Not sure if it's worthwhile, because it will slightly complicate the code, and there doesn't seen to be any technical problem with the name foo-foo.desktop. I'm not sure either, but I just want to make it clear I spent maybe half an hour trying to figure out what I was doing wrong before I found this issue. :) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21e613fe5efe6cdee4b5f7fc0473de14ff880ed3 commit 21e613fe5efe6cdee4b5f7fc0473de14ff880ed3 Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2022-10-01 08:28:19 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2022-10-20 06:25:42 +0000 desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop Bug: https://bugs.gentoo.org/771708#c14 Signed-off-by: Ulrich Müller <ulm@gentoo.org> eclass/desktop.eclass | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) |