1 |
Closes: https://bugs.gentoo.org/771708 |
2 |
Reported-by: Sergey Torokhov <torokhov-s-a@××××××.ru> |
3 |
Suggested-by: Ionen Wolkens <sudinave@×××××.com> |
4 |
Signed-off-by: Ulrich Müller <ulm@g.o> |
5 |
--- |
6 |
eclass/desktop.eclass | 11 +++++++++-- |
7 |
1 file changed, 9 insertions(+), 2 deletions(-) |
8 |
|
9 |
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass |
10 |
index 7d5c0f0f9a26..72d315448266 100644 |
11 |
--- a/eclass/desktop.eclass |
12 |
+++ b/eclass/desktop.eclass |
13 |
@@ -1,4 +1,4 @@ |
14 |
-# Copyright 1999-2020 Gentoo Authors |
15 |
+# Copyright 1999-2021 Gentoo Authors |
16 |
# Distributed under the terms of the GNU General Public License v2 |
17 |
|
18 |
# @ECLASS: desktop.eclass |
19 |
@@ -163,7 +163,14 @@ make_desktop_entry() { |
20 |
local desktop_name="${PN}-${slot}" |
21 |
fi |
22 |
local desktop="${exec%%[[:space:]]*}" |
23 |
- desktop="${T}/${desktop##*/}-${desktop_name}.desktop" |
24 |
+ desktop="${desktop##*/}-${desktop_name}" |
25 |
+ |
26 |
+ # Prevent collisions if a file with the same name already exists #771708 |
27 |
+ local desktop_base="${desktop}" count=0 |
28 |
+ while [[ -e ${ED}/usr/share/applications/${desktop}.desktop ]]; do |
29 |
+ desktop="${desktop_base}-$((++count))" |
30 |
+ done |
31 |
+ desktop="${T}/${desktop}.desktop" |
32 |
|
33 |
# Don't append another ";" when a valid category value is provided. |
34 |
type=${type%;}${type:+;} |
35 |
-- |
36 |
2.30.1 |