fix inherited GARBLE_LINK_TINY affecting regular builds - #1060
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents a caller-inherited GARBLE_LINK_TINY=true from accidentally enabling “tiny” linker behavior during normal (non--tiny) builds by always setting Garble’s internal linker flag explicitly for link invocations.
Changes:
- Always set
GARBLE_LINK_TINYto an explicit boolean value (true/false) when invoking the patched linker. - Add a regression test ensuring inherited
GARBLE_LINK_TINY=truedoes not affect regular builds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
main.go |
Ensures the internal linker env var is always set to strconv.FormatBool(flagTiny) to avoid leakage from inherited environment. |
testdata/script/tiny.txtar |
Adds a script-level regression check that a normal build is not impacted by an inherited GARBLE_LINK_TINY=true. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Is this solving an actual problem? Doesn't really seem like it. |
|
If you're setting That said, this is a small defensive patch, so it seems fine even if no user should realistically ever need this. Remove the test case though, because we don't want to test unrealistic edge cases. |
Garble only sets its internal tiny-link environment flag when
-tinyis true.An inherited
GARBLE_LINK_TINY=truecan therefore leak into a normal build andmake the linker apply tiny behavior unexpectedly.
Always pass the internal flag as an explicit boolean, including
falsefor anormal build.