Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/4] desktop.eclass: domenu, fix dying on non-existing files
Date: Thu, 26 Jul 2018 11:36:30
Message-Id: 20180726113553.1387-1-mgorny@gentoo.org
1 The weird logic in domenu had an explicit separate clause
2 for unsuccessful return on non-existing files. This worked fine before
3 EAPI 4 since '|| die' was mandatory. However, since 'doins' started
4 dying on its own, developers have assumed the same for 'domenu'
5 and stopped checking the exit status. As a result, missing files
6 are now silently ignored.
7
8 Change the logic to explicitly die when the file does not exist.
9 To provide the best interoperability and avoid code duplication, just
10 let 'doins' die on its own.
11 ---
12 eclass/desktop.eclass | 10 ++++------
13 1 file changed, 4 insertions(+), 6 deletions(-)
14
15 diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
16 index 91521b85a821..1684a21d21f7 100644
17 --- a/eclass/desktop.eclass
18 +++ b/eclass/desktop.eclass
19 @@ -1,4 +1,4 @@
20 -# Copyright 1999-2017 Gentoo Foundation
21 +# Copyright 1999-2018 Gentoo Foundation
22 # Distributed under the terms of the GNU General Public License v2
23
24 # @ECLASS: desktop.eclass
25 @@ -248,16 +248,14 @@ domenu() {
26 insopts -m 0644
27 insinto /usr/share/applications
28 for i in "$@" ; do
29 - if [[ -f ${i} ]] ; then
30 - doins "${i}"
31 - ((ret+=$?))
32 - elif [[ -d ${i} ]] ; then
33 + if [[ -d ${i} ]] ; then
34 for j in "${i}"/*.desktop ; do
35 doins "${j}"
36 ((ret+=$?))
37 done
38 else
39 - ((++ret))
40 + doins "${i}"
41 + ((ret+=$?))
42 fi
43 done
44 exit ${ret}
45 --
46 2.18.0

Replies