From: Nadav Har'El <n...@scylladb.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

scripts/manifest_from_host.sh: write errors to stderr

manifest_from_host.sh currently writes error messages (e.g., that the
"lddtree" command is not installed) to the stdout. But users of this
script - like our Lua makefile - redirect this output, so the user
doesn't see this error. Let's move these errors to stderr, so they will
be visible instead of having "scripts/build" silently fail.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
Message-Id: <20190926135354.13711-1-...@scylladb.com>

---
diff --git a/scripts/manifest_from_host.sh b/scripts/manifest_from_host.sh
--- a/scripts/manifest_from_host.sh
+++ b/scripts/manifest_from_host.sh
@@ -40,10 +40,10 @@ find_library()
        local count=$(ldconfig -p | grep -P "$pattern" | grep 'x86-64' | wc -l)

        if [[ $count == 0 ]]; then
-               echo "Could not find any so file matching $pattern"
+               echo "Could not find any so file matching $pattern" >&2
                return -1
        elif [[ $count > 1 ]]; then
-               echo 'Found more than one alternative:'
+               echo 'Found more than one alternative:' >&2
                ldconfig -p | grep -P "$pattern"
                return -1
        else
@@ -115,7 +115,7 @@ shift $((OPTIND - 1))

 LDDTREE_INSTALLED=$(command -v lddtree)
 if [ -z "$LDDTREE_INSTALLED" ]; then
-       echo "Please install lddtree which is part of pax-utils package"
+       echo "Please install lddtree which is part of pax-utils package" >&2
        exit 1
 fi

@@ -161,7 +161,7 @@ if [[ -f $NAME_OR_PATH ]]; then
                REAL_PATH=$(realpath $NAME_OR_PATH)
                output_manifest "$REAL_PATH"
        else
-               echo "The $NAME_OR_PATH is not ELF"
+               echo "The $NAME_OR_PATH is not ELF" >&2
                exit 1
        fi
 else
@@ -181,7 +181,7 @@ else
                        FULL_PATH=$(realpath $APP_PATH)
                        detect_elf $FULL_PATH
                        if [[ $FILE_TYPE == "NON_ELF" ]]; then
-                               echo "The file $FULL_PATH is not an ELF"
+                               echo "The file $FULL_PATH is not an ELF" >&2
                                exit 1
                        else
                                echo "# $LONG_NAME" | tee $OUTPUT
@@ -192,7 +192,7 @@ else
                                fi
                        fi
                else
-                       echo "Failed to find '$NAME_OR_PATH'!"
+                       echo "Failed to find '$NAME_OR_PATH'!" >&2
                        exit 1
                fi
        fi

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000008c1ce405939c5bc6%40google.com.

Reply via email to