Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Support all install-qa-check.d locations and overrides
Date: Sat, 29 Nov 2014 17:29:40
Message-Id: 20141129182925.0ec85ce2@pomiot.lan
In Reply to: Re: [gentoo-portage-dev] [PATCH] Support all install-qa-check.d locations and overrides by Zac Medico
1 Dnia 2014-11-23, o godz. 10:23:27
2 Zac Medico <zmedico@g.o> napisał(a):
3
4 > On 11/23/2014 01:09 AM, Michał Górny wrote:
5 > >>> + # Collect file names of QA checks. We need them early to support
6 > >>> + # overrides properly.
7 > >>> + for d in "${paths[@]}"; do
8 > >>> + for f in "${d}"/*; do
9 > >>> + [[ -f ${f} ]] && qa_checks+=( "${f##*/}" )
10 > >>> done
11 > >>> done
12 > >>>
13 > >>> + # Now we need to sort the filenames lexically, and process
14 > >>> + # them in order.
15 > >>> + while IFS= read -r -d '' f; do
16 > >>
17 > >> I'm not sure how IFS is relevant here. Please clarify.
18 > >
19 > > Unsetting IFS prevents word splitting. Otherwise just the first word
20 > > would get assigned to f and others discarded.
21 >
22 > Can you create a test case to demonstrate why it's needed? I created
23 > this test case that seems to work fine without changing IFS:
24 >
25 > qa_checks=("d e f" "a b c")
26 >
27 > while read -r -d '' f; do
28 > echo "$f"
29 > done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
30
31 You are correct and I were wrong. I've tested even fancy cases like
32 ' foo bar baz ' and it seems that all of them work correctly
33 without IFS= substitution.
34
35 I'm going to send an updated patch in a few minutes.
36
37 --
38 Best regards,
39 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature