Skip to content

Commit 5cb884f

Browse files
authored
check-safe-traversal.sh: Support any profile (uutils#10401)
1 parent 5929dec commit 5cb884f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.github/workflows/CICD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,6 @@ jobs:
13551355
- name: Install strace
13561356
run: sudo apt-get update && sudo apt-get install -y strace
13571357
- name: Build utilities with safe traversal
1358-
run: cargo build --release -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
1358+
run: cargo build --profile=release-small -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
13591359
- name: Run safe traversal verification
13601360
run: ./util/check-safe-traversal.sh

util/check-safe-traversal.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
set -e
88

9+
: ${PROFILE:=release-small}
10+
export PROFILE
11+
912
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1013
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
1114
TEMP_DIR=$(mktemp -d)
@@ -27,15 +30,15 @@ echo "=== Safe Traversal Verification ==="
2730

2831
# Assume binaries are already built (for CI usage)
2932
# Prefer individual binaries for more accurate testing
30-
if [ -f "$PROJECT_ROOT/target/release/rm" ]; then
33+
if [ -f "$PROJECT_ROOT/target/${PROFILE}/rm" ]; then
3134
echo "Using individual binaries"
3235
USE_MULTICALL=0
33-
elif [ -f "$PROJECT_ROOT/target/release/coreutils" ]; then
36+
elif [ -f "$PROJECT_ROOT/target/${PROFILE}/coreutils" ]; then
3437
echo "Using multicall binary"
3538
USE_MULTICALL=1
36-
COREUTILS_BIN="$PROJECT_ROOT/target/release/coreutils"
39+
COREUTILS_BIN="$PROJECT_ROOT/target/${PROFILE}/coreutils"
3740
else
38-
echo "Error: No binaries found. Please build first with 'cargo build --release'"
41+
echo "Error: No binaries found. Please build first with 'cargo build --profile=${PROFILE}'"
3942
exit 1
4043
fi
4144

@@ -64,7 +67,7 @@ check_utility() {
6467
if [ "$USE_MULTICALL" -eq 1 ]; then
6568
local util_cmd="$COREUTILS_BIN $util"
6669
else
67-
local util_path="$PROJECT_ROOT/target/release/$util"
70+
local util_path="$PROJECT_ROOT/target/${PROFILE}/$util"
6871
if [ ! -f "$util_path" ]; then
6972
fail_immediately "$util binary not found at $util_path"
7073
fi
@@ -157,7 +160,7 @@ if [ "$USE_MULTICALL" -eq 1 ]; then
157160
else
158161
AVAILABLE_UTILS=""
159162
for util in rm chmod chown chgrp du mv; do
160-
if [ -f "$PROJECT_ROOT/target/release/$util" ]; then
163+
if [ -f "$PROJECT_ROOT/target/${PROFILE}/$util" ]; then
161164
AVAILABLE_UTILS="$AVAILABLE_UTILS $util"
162165
fi
163166
done

0 commit comments

Comments
 (0)