adbd rule stamps a binary after a failed patch or copy step #45

Open
opened 2026-11-06 08:35:48 -07:00 by noah · 1 comment
Owner

Symptom

The adbd rebuild rule in sysdrv/tools/board/android-tools/Makefile (board patch 0015, sp/adbd-tcp-off) keeps going after a failed step:

  • the debian series loop runs patch -p1 < ./debian/patches/$$item; with no error check;
  • $(SHELL) ./android-tools.patch.sh; has no error check, and the script exits with the status of its last patch (0017 on that branch), so a failed middle hunk is hidden;
  • cp -f .../adbd ...; has no error check, and echo $(ADBD_INPUTS) > $(ADBD_STAMP); runs after it.

Evidence

Reproduced on sp/adbd-tcp-off (base origin/rebuild b8d9d54, board patch 0015 applied) with stub toolchains, so nothing compiles:

  • 0017 hunk drifted: Hunk #1 FAILED at 1298, then the rule reaches the compile step.
  • A failing line inserted before the last patch in android-tools.patch.sh: No such file or directory, then the rule reaches the compile step.
  • Missing debian series entry: No such file or directory, then the rule reaches the compile step.

Impact

A patch that stops applying still builds adbd from a partly patched source. The stamp then marks that binary current, so later builds skip the rebuild. This is the bfe-core1106-sdk#44 failure again, and the flare-edge#3129 listener removal (0017) can be silently absent from the image.

Fix

|| exit 1 on the series loop, on the copy and on the stamp write, and $(SHELL) -e with || exit 1 on android-tools.patch.sh. Regression: fail-closed cases in luckfox-sdk-patches/tests/test-adbd-no-tcp.sh.

Related: bfe-core1106-sdk#44; flare-edge#3428 (build-firmware.sh only warns on a failed board patch, a separate decision for the orchestrator).

## Symptom The adbd rebuild rule in `sysdrv/tools/board/android-tools/Makefile` (board patch 0015, sp/adbd-tcp-off) keeps going after a failed step: - the debian series loop runs `patch -p1 < ./debian/patches/$$item;` with no error check; - `$(SHELL) ./android-tools.patch.sh;` has no error check, and the script exits with the status of its last `patch` (0017 on that branch), so a failed middle hunk is hidden; - `cp -f .../adbd ...;` has no error check, and `echo $(ADBD_INPUTS) > $(ADBD_STAMP);` runs after it. ## Evidence Reproduced on sp/adbd-tcp-off (base origin/rebuild b8d9d54, board patch 0015 applied) with stub toolchains, so nothing compiles: - 0017 hunk drifted: `Hunk #1 FAILED at 1298`, then the rule reaches the compile step. - A failing line inserted before the last patch in android-tools.patch.sh: `No such file or directory`, then the rule reaches the compile step. - Missing debian series entry: `No such file or directory`, then the rule reaches the compile step. ## Impact A patch that stops applying still builds adbd from a partly patched source. The stamp then marks that binary current, so later builds skip the rebuild. This is the bfe-core1106-sdk#44 failure again, and the flare-edge#3129 listener removal (0017) can be silently absent from the image. ## Fix `|| exit 1` on the series loop, on the copy and on the stamp write, and `$(SHELL) -e` with `|| exit 1` on android-tools.patch.sh. Regression: fail-closed cases in `luckfox-sdk-patches/tests/test-adbd-no-tcp.sh`. Related: bfe-core1106-sdk#44; flare-edge#3428 (build-firmware.sh only warns on a failed board patch, a separate decision for the orchestrator).
Author
Owner

Fixed on sp/adbd-tcp-off in fabd79f (not merged; open until the branch merges, as on #44).

  • The rule stops at each failed step: the debian series loop, the copy into out/usr/bin and the stamp write all use || exit 1.
  • android-tools.patch.sh runs as $(SHELL) -e, so a failed middle step stops the rule even though the last patch succeeds.
  • Regression: luckfox-sdk-patches/tests/test-adbd-no-tcp.sh has five injected failures (0017 hunk, middle patch step, debian series entry, compiler, copy). Each must stop the rule with no stamp.
  • luckfox-sdk-patches/tests/adbd-no-tcp-cases.sh has a no-fail-fast mutant that must FAIL. The pre-fix 0015 fails four of the five cases, with the stamp written in each.
Fixed on sp/adbd-tcp-off in fabd79f (not merged; open until the branch merges, as on #44). - The rule stops at each failed step: the debian series loop, the copy into out/usr/bin and the stamp write all use `|| exit 1`. - android-tools.patch.sh runs as `$(SHELL) -e`, so a failed middle step stops the rule even though the last patch succeeds. - Regression: `luckfox-sdk-patches/tests/test-adbd-no-tcp.sh` has five injected failures (0017 hunk, middle patch step, debian series entry, compiler, copy). Each must stop the rule with no stamp. - `luckfox-sdk-patches/tests/adbd-no-tcp-cases.sh` has a `no-fail-fast` mutant that must FAIL. The pre-fix 0015 fails four of the five cases, with the stamp written in each.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blueflare/bfe-core1106-sdk#45