Nimbin[12]?Mirrors & Forks / jhalfs / commits / 78d04f3

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

Fix "ambiguous redirect" in func_dependencies

Pierre Labastie · 2023-04-21 08:49 · 78d04f3f791d0ac058492197f1e4dff05ab318c7

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