Dnia 2014-11-23, o godz. 10:23:27
Zac Medico <zmed...@gentoo.org> napisał(a):

> On 11/23/2014 01:09 AM, Michał Górny wrote:
> >>> + # Collect file names of QA checks. We need them early to support
> >>> + # overrides properly.
> >>> + for d in "${paths[@]}"; do
> >>> +         for f in "${d}"/*; do
> >>> +                 [[ -f ${f} ]] && qa_checks+=( "${f##*/}" )
> >>>           done
> >>>   done
> >>>  
> >>> + # Now we need to sort the filenames lexically, and process
> >>> + # them in order.
> >>> + while IFS= read -r -d '' f; do
> >>
> >> I'm not sure how IFS is relevant here. Please clarify.
> > 
> > Unsetting IFS prevents word splitting. Otherwise just the first word
> > would get assigned to f and others discarded.
> 
> Can you create a test case to demonstrate why it's needed? I created
> this test case that seems to work fine without changing IFS:
> 
> qa_checks=("d e f" "a b c")
> 
> while read -r -d '' f; do
>       echo "$f"
> done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)

You are correct and I were wrong. I've tested even fancy cases like
'   foo bar    baz     ' and it seems that all of them work correctly
without IFS= substitution.

I'm going to send an updated patch in a few minutes.

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to