Fix "ambiguous redirect" in func_dependencies

We use grep -l ^"${otherlink[*]"\$ to find parentNode, since the
parentNode is the only file with a link line that matches. Problem
is that sometimes the priority line may match too. This makes a
parentNode variable containing several lines, and when redirecting
to $parentNode, creates those "ambiguous redirect" messages.
Fix: use a loop, and only grep on the first line of each file.
This commit is contained in:
Pierre Labastie 2023-04-21 10:49:40 +02:00
parent 72711ab1cd
commit 78d04f3f79
1 changed files with 7 additions and 1 deletions

View File

@ -522,7 +522,13 @@ while read prio_of_dep build_of_dep id_of_dep; do
# The parent has the same link without the last entry.
# We do not need otherlink anymore so just destroy the last element
unset otherlink[-1]
parentNode=$(grep ^"${otherlink[*]}"\$ -l *)
# We cannot use grep -l, because we need to restrict to the first line,
# since the prio line may match
for f in *.tree; do
if head -n1 $f | grep -q ^"${otherlink[*]}"\$; then
parentNode=$f; break
fi
done
return $p2
fi
else # not circular: prune tree (but not .dep, since it may happen that