From 78d04f3f791d0ac058492197f1e4dff05ab318c7 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Fri, 21 Apr 2023 10:49:40 +0200 Subject: [PATCH] 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. --- BLFS/libs/func_dependencies | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BLFS/libs/func_dependencies b/BLFS/libs/func_dependencies index b2c082d..673d9f8 100644 --- a/BLFS/libs/func_dependencies +++ b/BLFS/libs/func_dependencies @@ -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