From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH] desktop.eclass: Sanitize filename of desktop entry.
Date: Wed, 25 Mar 2020 09:24:13 +0100 [thread overview]
Message-ID: <ud090zvte@gentoo.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]
make_desktop_entry() extracts the first component of the filename from
the Exec key in the desktop entry. This can however include arguments
which will end up in the filename. For example, www-client/links has
"Exec=links -g %u", resulting in links_-g_%u-links-2.desktop as the
name of the file.
The current extraction pattern originates from this CVS commit:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/eutils.eclass?r1=1.271&r2=1.272
with the commit message "scrub exec filename in case someone does
something silly like pass the fullpath to a binary".
Before that commit, anything after a space in Exec would have been
removed. Restore that behaviour, and in addition use only the
executable's basename.
While at it, get rid of the sed call and handle everything in bash.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/desktop.eclass | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
index 6fc72ab8ec03..f310f210dfba 100644
--- a/eclass/desktop.eclass
+++ b/eclass/desktop.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: desktop.eclass
@@ -162,8 +162,8 @@ make_desktop_entry() {
else
local desktop_name="${PN}-${slot}"
fi
- local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
- #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
+ local desktop="${exec%%[[:space:]]*}"
+ desktop="${T}/${desktop##*/}-${desktop_name}.desktop"
# Don't append another ";" when a valid category value is provided.
type=${type%;}${type:+;}
--
2.26.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
next reply other threads:[~2020-03-25 8:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 8:24 Ulrich Müller [this message]
2020-03-25 8:29 ` [gentoo-dev] Re: [PATCH] desktop.eclass: Sanitize filename of desktop entry Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ud090zvte@gentoo.org \
--to=ulm@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox