Skip to content

fix(gobuild): quote linker string values - #107

Merged
sipsma merged 1 commit into
mainfrom
fix/gobuild-linker-quoting
Nov 18, 2026
Merged

sipsma merged 1 commit into
mainfrom
fix/gobuild-linker-quoting

Conversation

@vito

@vito vito commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

./hack/dev in dagger/dagger fails with /gobuild/build.sh: line 12: -X: not found after the switch to per-package builds in dagger/dagger#15143. The CLI stamps a RunnerHost URL containing &volume=...&cleanup=false; go build -n prints that linker argument without quotes, so replaying it as shell starts background commands and treats the following -X as a command.

Decode Go's display quoting for linker -X values and apply shell quoting before replay, supporting both -X value and -X=value. This also preserves literal shell expansions and Go-escaped newlines/tabs while leaving the script's generated toolchain and build-ID expansions intact.

The regression executes the generated linker command with an argument-capturing shell function. It reproduces the URL failure before the fix and checks that URLs, whitespace, quotes, shell metacharacters, and escapes arrive unchanged afterward.

Validation: cd gobuild && go test . -count=1 passes. Full Dagger integration builds were not run. dagger/dagger will need its dagger/go pin updated after this lands.

Go build -n prints arguments for display, leaving ampersands unquoted
and shell expansions active inside double quotes. Replaying a RunnerHost
URL therefore backgrounds the linker and tries to execute the next -X.

Decode Go-quoted -X values and quote them for shell replay while retaining
the generated toolchain and build-ID expansions. Cover the dev-engine
URL and literal metacharacters with a shell argument-capture regression.

Signed-off-by: Alex Suraci <[email protected]>
@sipsma
sipsma merged commit c40d1b4 into main Nov 18, 2026
107 checks passed
eunomie added a commit to dagger/dagger that referenced this pull request Nov 20, 2026
dagger/go#107 quotes -X values in the link step; without it ./hack/build
fails on the RunnerHost URL, which contains "&".

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to dagger/dagger that referenced this pull request Nov 25, 2026
dev deploy stamps a RunnerHost that contains "&" into the CLI. The pinned
gobuild left -X values unquoted in its link script, so the build failed
with "-X: not found". The new pin is the merge of dagger/go#107
(c40d1b4), whose tree is 8aba399b's.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie pushed a commit to eunomie/go-sdk that referenced this pull request Nov 25, 2026
Move daggerGo from dagger/go 79a92be to its release v0.5.0
(262b66d), the merge of dagger/go#110. Its gobuild is on otel-go and
OpenTelemetry v1.47.0, out of the range of GHSA-q7gw-24fr-5p69, where
79a92be's required otel/sdk v1.43.0 and otel/trace v1.46.0, and pinned
otel/sdk/log to v0.16.0. The engine image ships that gobuild for the
built-in Go SDK, which moves to the same commit, since the image's build
requires the two to match.

v0.5.0 also quotes linker string values (dagger/go#107) and reads
discovery JSON with File.asJson (dagger/go#108), which needs
v1.0.0-beta.26, go-sdk's daggerGoFloor. The calls generated entrypoints
make are unchanged.

Signed-off-by: Erik Sipsma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants