Skip to content

fix inherited GARBLE_LINK_TINY affecting regular builds - #1060

Open
Maremagnum wants to merge 1 commit into
burrowers:masterfrom
Maremagnum:pr/tiny-env-reset
Open

fix inherited GARBLE_LINK_TINY affecting regular builds#1060
Maremagnum wants to merge 1 commit into
burrowers:masterfrom
Maremagnum:pr/tiny-env-reset

Conversation

@Maremagnum

Copy link
Copy Markdown

Garble only sets its internal tiny-link environment flag when -tiny is true.
An inherited GARBLE_LINK_TINY=true can therefore leak into a normal build and
make the linker apply tiny behavior unexpectedly.

Always pass the internal flag as an explicit boolean, including false for a
normal build.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_TINY to an explicit boolean value (true/false) when invoking the patched linker.
  • Add a regression test ensuring inherited GARBLE_LINK_TINY=true does 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.

@luantak

luantak commented Jul 15, 2026

Copy link
Copy Markdown
Member

Is this solving an actual problem? Doesn't really seem like it.

@mvdan

mvdan commented Jul 15, 2026

Copy link
Copy Markdown
Member

If you're setting GARBLE_LINK_TINY yourself, or other internal and undocumented GARBLE_ env vars, it's no surprise that you get weird behavior.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants