laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41143?usp=email )

Change subject: buildsystem/gen_links: catch broken symlinks
......................................................................

buildsystem/gen_links: catch broken symlinks

Tweak gen_links() to verify that each symlink target exists. If the
target does not exist, abort with an error:

  ERROR in msc/gen_links.sh:

    File not found:
      
../deps/titan.Libraries.TCCUsefulFunctions/src/TCCOpenSecurity_Functions.hh

    Section:
      DIR=../deps/titan.Libraries.TCCUsefulFunctions/src
      FILES="…TCCOpenSecurity_Functions.hh…"
      gen_links $DIR $FILES

This is slightly slower than the previous approach (which did not check
if the symlink target exists). But this prevents adding subtle bugs
that may not trigger every time (see 520ac3ab ("*/gen_links.sh: fix
wrong SDP_EncDec.cc symlink")).

Change-Id: I0da0ec30e5eaf65d0348e22900a5ee006dee9e44
---
M _buildsystem/gen_links.inc.sh
1 file changed, 18 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve




diff --git a/_buildsystem/gen_links.inc.sh b/_buildsystem/gen_links.inc.sh
index 161754c..42f01b1 100644
--- a/_buildsystem/gen_links.inc.sh
+++ b/_buildsystem/gen_links.inc.sh
@@ -27,9 +27,24 @@
        local files="$*"

        for f in $files; do
-               (ln -sf \
-                       "$(realpath "$TOPDIR/$PROJECTDIR/$dir/$f")" \
-                       "$BUILDDIR/$PROJECTDIR/$f") &
+               local target="$(realpath "$TOPDIR/$PROJECTDIR/$dir/$f")"
+               if ! [ -e "$target" ]; then
+                       echo
+                       echo "ERROR in $PROJECTDIR/gen_links.sh:"
+                       echo
+                       echo "  File not found:"
+                       echo "    $dir/$f"
+                       echo
+                       echo "  Section:"
+                       echo "    DIR=$dir"
+                       echo "    FILES=\"…$f…\""
+                       echo "    gen_links \$DIR \$FILES"
+                       echo
+                       exit 1
+               fi
+               ln -sf \
+                       "$target" \
+                       "$BUILDDIR/$PROJECTDIR/$f" &
        done
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41143?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I0da0ec30e5eaf65d0348e22900a5ee006dee9e44
Gerrit-Change-Number: 41143
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to