This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 1f166a970ed tools/mkallsyms.py: let the dependency error actually
reach the user
1f166a970ed is described below
commit 1f166a970edaa524a328fc589a0a51ef6b7ae04b
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Jul 28 08:57:59 2026 +0200
tools/mkallsyms.py: let the dependency error actually reach the user
mkallsyms.py prints "Please execute the following command to install
dependencies: pip install pyelftools cxxfilt" and then calls
os._exit(errno.EINVAL). os._exit() terminates without flushing stdio, so
when stdout is a pipe -- which it always is under make -- the message sits
in
the buffer and is discarded. What the developer sees is:
make[1]: *** [Makefile:65: nuttx] Error 22
with no indication of the cause anywhere in the build output. Error 22 is
just errno.EINVAL leaking out as an exit status. The same applies to
usage(), which exits ENOENT the same way.
Use sys.exit() in both places, which raises SystemExit and lets the
interpreter flush on the way out. Nothing else changes: the exit statuses
are the same, and os is no longer referenced, so the import goes too.
Signed-off-by: Marco Casaroli <[email protected]>
Assisted-by: Claude Opus 5 (1M context) <[email protected]>
---
tools/mkallsyms.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/mkallsyms.py b/tools/mkallsyms.py
index bddf29ccf4d..f18f8190d54 100755
--- a/tools/mkallsyms.py
+++ b/tools/mkallsyms.py
@@ -23,7 +23,6 @@
import argparse
import errno
-import os
import re
import sys
@@ -36,7 +35,7 @@ try:
except ModuleNotFoundError:
print("Please execute the following command to install dependencies:")
print("pip install pyelftools cxxfilt")
- os._exit(errno.EINVAL)
+ sys.exit(errno.EINVAL)
class SymbolTables(object):
@@ -126,7 +125,7 @@ def usage():
print(
"Usage: mkallsyms.py [noconst] <ELFBIN> [output file] [order symbols
by name]"
)
- os._exit(errno.ENOENT)
+ sys.exit(errno.ENOENT)
if __name__ == "__main__":