From 11c7266ff3f8d6fe748925c7579baa1b835ab432 Mon Sep 17 00:00:00 2001
From: Foosec <31885466+Foosec@users.noreply.github.com>
Date: Fri, 21 Mar 2025 02:51:58 +0100
Subject: [PATCH] Add missing lld dependency and fix syntax typo (#3490)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Add missing lld dependency and fix syntax typo in devcontainer_postcreate.sh
* replace pushd/popd with shell agnostic solution and do not throw away std out/err
---------
Co-authored-by: foobar <foobar>
---
 scripts/devcontainer_postcreate.sh       | 5 +++--
 server/daemon/run_insecure_dev_server.sh | 6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/devcontainer_postcreate.sh b/scripts/devcontainer_postcreate.sh
index 659a07864..5071c62be 100755
--- a/scripts/devcontainer_postcreate.sh
+++ b/scripts/devcontainer_postcreate.sh
@@ -21,7 +21,8 @@ sudo apt-get install -y \
     libsystemd-dev \
     libudev-dev \
     pkg-config \
-    ripgrep
+    ripgrep \
+    lld
 
 export PATH="$HOME/.cargo/bin:$PATH"
 
@@ -36,7 +37,7 @@ sudo chgrp vscode ~/ -R
 # shellcheck disable=SC1091
 source scripts/devcontainer_poststart.sh
 
-cargo install
+cargo install \
     cargo-audit \
     mdbook-mermaid \
     mdbook
diff --git a/server/daemon/run_insecure_dev_server.sh b/server/daemon/run_insecure_dev_server.sh
index 782712799..3724cbaf2 100755
--- a/server/daemon/run_insecure_dev_server.sh
+++ b/server/daemon/run_insecure_dev_server.sh
@@ -29,7 +29,9 @@ if [ ! -f "${CONFIG_FILE}" ]; then
     exit 1
 fi
 
-pushd "${SCRIPT_DIR}" > /dev/null 2>&1
+# Save current directory and change to script directory without pushd
+OLD_DIR=$(pwd)
+cd "${SCRIPT_DIR}" || exit 1
 if [ -n "${1}" ]; then
     COMMAND=$*
     #shellcheck disable=SC2086
@@ -40,4 +42,4 @@ else
     #shellcheck disable=SC2086
     cargo run ${KANI_CARGO_OPTS} --bin kanidmd -- server -c "${CONFIG_FILE}"
 fi
-popd > /dev/null 2>&1
+cd "${OLD_DIR}" || exit 1