fix(sea): silence benign LIEF warnings during postject injection#265
Merged
robertsLando merged 3 commits intomainfrom Apr 23, 2026
Merged
fix(sea): silence benign LIEF warnings during postject injection#265robertsLando merged 3 commits intomainfrom
robertsLando merged 3 commits intomainfrom
Conversation
LIEF (inside postject) prints "signature seems corrupted" and "Can't find string offset for section name '.note.100'" to stderr after postject expands the ELF section table to make room for NODE_SEA_BLOB. The messages are cosmetic — the injection succeeds and macOS binaries are re-signed afterwards — but users reasonably assume something is wrong. Wrap the postject.inject() call in a tiny stderr filter that drops only those specific lines. Everything else passes through unchanged, and the original process.stderr.write is restored in a finally block.
Replace `unknown` + `...rest: unknown[]` (which forced two `as` casts and a runtime `rest.find` to locate the callback) with the actual write() overload parameters: `chunk: string | Uint8Array`, `encodingOrCb?: BufferEncoding | WriteCallback`, `cb?: WriteCallback`. Disambiguate the pass-through call so the right write() overload is dispatched, and handle plain Uint8Array chunks explicitly. Whitelist `BufferEncoding` as a global in the TS ESLint block, mirroring how `NodeJS` is already handled — both are type-only identifiers that `no-undef` can't resolve on its own.
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce alarming-but-harmless stderr noise during SEA builds by filtering specific known-benign LIEF warnings emitted via postject during NODE_SEA_BLOB injection.
Changes:
- Add a
withFilteredPostjectStderrhelper that temporarily wrapsprocess.stderr.writeto drop allow-listed benign warning lines during postject injection. - Wrap the
postjectInject(...)call inbake()with that stderr filter helper. - Update ESLint TS globals to include
BufferEncodingto satisfy linting for the new type usage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/sea.ts |
Introduces stderr-filter wrapper and applies it around postject SEA blob injection. |
eslint.config.js |
Adds BufferEncoding as a readonly global for TS linting. |
Keep the unbound write function for restoration so process.stderr.write regains its exact prior identity after the call. Use a separate bound copy internally for calling from the filter. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every SEA build currently prints a handful of noisy warnings on stderr that look alarming but are harmless:
These come from LIEF inside postject when it re-parses the Node binary after expanding the ELF section table to make room for
NODE_SEA_BLOB. The pre-existing.note.*section-name offsets and.note.gnu.build-idsignature layout no longer resolve cleanly through.shstrtab, so LIEF falls back to synthetic names ('.note.100') and warns. The injection itself still succeeds, and on macOS we re-sign the binary withcodesignafterwards, so the "signature seems corrupted" line is purely cosmetic too.Users reasonably read these as build failures and file issues, so this PR filters them out.
Approach
Wrap the
postject.inject()call (lib/sea.ts) in a tiny helper,withFilteredPostjectStderr, that:process.stderr.writewith a version that drops only lines matching a strict allow-list regex:warning: The signature seems corrupted!warning: Can't find string offset for section name '.note…process.stderr.writein afinallyblock so the override never leaks past the inject call.write(e.g. byconsole.warn) viaprocess.nextTick.Filtering at the
process.stderr.writelayer works because postject is an Emscripten/WASM module whoseModule.printErrdefaults toconsole.warn.bind(console), which ultimately callsprocess.stderr.write. No changes to postject are required.Why not the alternatives
Test plan
yarn buildpassesyarn lintclean (no Prettier / ESLint issues)node lib-es5/bin.js --sea --target node22-linux-x64 …now emits zero.note.*/ "signature seems corrupted" lines.note.*warnings don't appear there, but the "signature seems corrupted" line can; re-signing then happens insignMacOSIfNeeded