Skip to content

Commit d4d43bb

Browse files
Copilotpelikhan
andauthored
fix: use exact awk field matching for checksum lookup
Replace `grep "$EXPECTED_FILENAME" | awk '{print $1}'` with `awk -v f="$EXPECTED_FILENAME" '$2 == f {print $1}'` to avoid false matches when the filename appears as a substring in another entry (e.g. matching 'gh-aw-linux-amd64-extra.tar.gz' when searching for 'linux-amd64'). Agent-Logs-Url: https://github.com/github/gh-aw/sessions/057dcad8-6129-46c2-8ce5-d318e1698526 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent dc18499 commit d4d43bb

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

actions/setup-cli/install.sh

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install-gh-aw.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ if [ "$SKIP_CHECKSUM" = false ]; then
335335
EXPECTED_FILENAME="${PLATFORM}.exe"
336336
fi
337337

338-
# Extract the expected checksum from the checksums file
339-
EXPECTED_CHECKSUM=$(grep "$EXPECTED_FILENAME" "$CHECKSUMS_PATH" | awk '{print $1}')
338+
# Extract the expected checksum from the checksums file (exact filename match on field 2)
339+
EXPECTED_CHECKSUM=$(awk -v f="$EXPECTED_FILENAME" '$2 == f {print $1}' "$CHECKSUMS_PATH")
340340

341341
if [ -z "$EXPECTED_CHECKSUM" ]; then
342342
print_warning "Checksum for $EXPECTED_FILENAME not found in checksums file"

0 commit comments

Comments
 (0)