Skip to content

FW_VERSION detection uses grep -oP, which BusyBox lacks, so it always falls back to 7.14.0 #467

Description

@BitHighlander

scripts/emulator/python-keepkey-tests.sh detects the firmware version with:

FW_VERSION=$(sed -n '/^project/,/)/p' /kkemu/CMakeLists.txt | grep -oP '\d+\.\d+\.\d+' || echo "7.14.0")

The test image is Alpine 3.8, whose grep is BusyBox v1.28.4. BusyBox grep has no -P:

$ echo 'VERSION 7.14.2' | grep -oP '\d+\.\d+\.\d+'
grep: unrecognized option: P

So the command always fails and || echo "7.14.0" always wins. Verified inside the actual test image: the script computes FW_VERSION=7.14.0 while CMakeLists.txt says VERSION 7.14.2.

Consequence

FW_VERSION is passed to generate-test-report.py --screenshot-filter --fw-version=$FW_VERSION, which builds the pytest -k expression for Phase 1 screenshot capture from SECTIONS. With the version pinned two patch releases low, every screenshot expectation introduced for 7.14.1/7.14.2 is silently excluded from capture — and the failure mode is a smaller filter, not an error.

It also prints Detected FW_VERSION=7.14.0 from CMakeLists.txt, which reads as a successful detection.

Fix

Use BusyBox-compatible extraction, e.g.:

FW_VERSION=$(sed -n 's/.*VERSION[[:space:]]\{1,\}\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p' /kkemu/CMakeLists.txt | head -1)
[ -n "$FW_VERSION" ] || { echo "FATAL: could not detect firmware version"; exit 1; }

Fail closed rather than defaulting — a wrong version silently narrows test selection, which is exactly the class of silent gap this release exists to remove.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions