Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: Marco Sirabella <marco@×××××××××.org>, "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-dev] [PATCH] eclass/common-lisp-3: Properly escape recursive install files
Date: Thu, 07 Apr 2022 20:59:23
Message-Id: 20220407205848.6575-1-ulm@gentoo.org
1 From: Marco Sirabella <marco@×××××××××.org>
2
3 This is a bit of a roundabout way to do it, but since we want to pass
4 the results of `find` to a bash function, this is what we need to do.
5
6 All of these functions are a bit convoluted, I believe something similar
7 could be hacked together that looks like `find -type f -name '*.lisp'
8 -exec doins` (or xargs) without the recursive calling or escaping mess
9
10 Signed-off-by: Marco Sirabella <marco@×××××××××.org>
11 Signed-off-by: Ulrich Müller <ulm@g.o>
12 ---
13 eclass/common-lisp-3.eclass | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
15
16 diff --git a/eclass/common-lisp-3.eclass b/eclass/common-lisp-3.eclass
17 index 5314e391db8f..df624d51607c 100644
18 --- a/eclass/common-lisp-3.eclass
19 +++ b/eclass/common-lisp-3.eclass
20 @@ -127,7 +127,9 @@ common-lisp-install-sources() {
21 if [[ -f ${path} ]] ; then
22 common-lisp-install-one-source ${fpredicate} "${path}" "$(dirname "${path}")"
23 elif [[ -d ${path} ]] ; then
24 - common-lisp-install-sources -t ${ftype} $(find "${path}" -type f)
25 + local files
26 + readarray -d '' files < <(find "${path}" -type f -print0 || die "cannot traverse ${path}" )
27 + common-lisp-install-sources -t ${ftype} "${files[@]}" || die
28 else
29 die "${path} is neither a regular file nor a directory"
30 fi
31 --
32 2.35.1