[jhalfs] branch trunk updated: Fix "ambiguous redirect" in func_dependencies

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.automated
Message-ID <168206729497.6109.8578415974955840573@rivendell.linuxfromscratch.org>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

The following commit(s) were added to refs/heads/trunk by this push:
     new 78d04f3  Fix "ambiguous redirect" in func_dependencies
78d04f3 is described below

commit 78d04f3f791d0ac058492197f1e4dff05ab318c7
Author: Pierre Labastie <[email protected]>
AuthorDate: Fri Apr 21 10:49:40 2023 +0200

    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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.