Skip to content

cmd/go: Regression in Go 1.26 due to new pkg-config flag validation from #77387 banning safe --define-variable values #79330

Description

@maxb

Go version

go version go1.26.3 linux/amd64

Output of go env in your module/workspace:

n/a

What did you do?

Upgrade from Go 1.25 to Go 1.26

What did you see happen?

An existing build started failing with:

foobar/core/foobar/protocol/foobar/common: invalid flag in pkg-config: --define-variable=srcdir=/home/tcagent3/opt/teamcity/work/tech-build/foobar/tech/core/foobar/protocol/foobar/common (see https://go.dev/s/invalidflag)

Upon investigation, it seems that the fix for #77387 has resulted in banning safe flag values in pkg-config files, namely those that define variables with values containing dash characters, amongst others.

I am guessing that the regex at

re(`--define-variable=[A-Za-z_][A-Za-z0-9_]*=[^@\-]*`),
was intended to be something slightly different.

The outcome is that I am no longer able to build this (internal) software without ensuring there is no dash character anywhere in the absolute pathname containing the build environment, though other users may be impacted in other ways depending on the purpose for which they were using variables.

What did you expect to see?

No regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions