Skip to content

waf: fail the symbol check when nm fails - #34573

Merged
peterbarker merged 1 commit into
ArduPilot:masterfrom
khancyr:waf_check_elf_nm
Oct 5, 2026
Merged

peterbarker merged 1 commit into
ArduPilot:masterfrom
khancyr:waf_check_elf_nm

Conversation

@khancyr

@khancyr khancyr commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

subprocess.getoutput() runs a shell command and returns its output, stdout and stderr mixed, whatever the exit status. When nm fails (missing, wrong path, unreadable ELF), the output is just an error message like sh: 1: /bad/nm: not found. None of the forbidden names (std::__throw, operator new(...)) appear in that message, so the check passes without ever reading the ELF.

check_output() raises CalledProcessError on a non-zero exit, or FileNotFoundError if nm doesn't exist. Waf treats an exception in run() as a failed task, so the build stops.

tested with NM = ['/bin/false']: the branch failed with CalledProcessError, master passed.

self.env.NM instead of get_flat('NM'): check_output() takes a list of arguments and runs it without a shell, so it needs a list. get_flat is a string .

Summary

Classification & Testing (check all that apply and add your own)

  • Checked by a human programmer
  • Non-functional change
  • No-binary change
  • Infrastructure change (e.g. unit tests, helper scripts)
  • Automated test(s) verify changes (e.g. unit test, autotest)
  • Tested manually, description below (e.g. SITL)
  • Tested on hardware
  • Logs attached
  • Logs available on request

Description

subprocess.getoutput() returns the error text when nm fails. None of
the disallowed names appear in it, so the check passed without
looking at the ELF. Use check_output so a failing nm fails the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the Python label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Global Size Summary (Total Flash delta in bytes)

Built from 1996e4c rebased onto 755258d

Board Periph tracker blimp bootloader copter heli iofw plane rover sub
DrotekP3Pro _ _ _ * _ _ _ _ _ _
Durandal _ * * _ * * _ * * *
Hitec-Airspeed * _ _ _ _ _ _ _ _ _
KakuteF7 _ * * _ * * _ * * *
MambaH743v4 _ * * _ * * _ * * *
MatekF405-CAN _ _ _ * _ _ _ _ _ _
MatekF405 _ * * _ * * _ * * *
MatekH743-bdshot _ * * _ * * _ * * *
Pixhawk1-1M _ * * _ * * _ * * *
disco _ * * _ * * _ * * *
f103-GPS * _ _ _ _ _ _ _ _ _

@peterbarker
peterbarker merged commit 9af79c8 into ArduPilot:master Oct 5, 2026
107 checks passed
@khancyr
khancyr deleted the waf_check_elf_nm branch October 5, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants