Skip to content

Fix quoting in eng/build.sh#14506

Open
omajid wants to merge 4 commits into
dotnet:mainfrom
omajid:fix-quoting-spaces-bash-scripts
Open

Fix quoting in eng/build.sh#14506
omajid wants to merge 4 commits into
dotnet:mainfrom
omajid:fix-quoting-spaces-bash-scripts

Conversation

@omajid

@omajid omajid commented Jul 23, 2026

Copy link
Copy Markdown
Member

I use a particular set of flags to build .NET VMR, which flows something like this to the msbuild build scripts:

$ ./build.sh /p:OfficialBuilder="Red Hat Inc."

This regressed recently (probably
#14361). This change fixes the issue.

For arrays which can be empty, use the ${var[@]+"${var[@]}"} syntax, as discussed in dotnet/dotnet#797, to avoid issues on macOS.

Assisted-By: Claude Opus 4.6 noreply@anthropic.com

I use a particular set of flags to build .NET VMR, which flows something
like this to the msbuild build scripts:

    $ ./build.sh /p:OfficialBuilder="Red Hat Inc."

This regressed recently (probably
dotnet#14361). This change fixes the
issue.

For arrays which can be empty, use the ${var[@]+"${var[@]}"} syntax,
as discussed in dotnet/dotnet#797, to avoid
issues on macOS.

Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
@omajid
omajid requested a review from a team as a code owner July 23, 2026 15:19
@omajid
omajid temporarily deployed to copilot-pat-pool July 23, 2026 15:19 — with GitHub Actions Inactive
@omajid
omajid temporarily deployed to copilot-pat-pool July 23, 2026 15:20 — with GitHub Actions Inactive
Comment thread eng/build.sh Outdated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a regression in eng/build.sh argument handling so property values containing spaces (for example /p:OfficialBuilder="Red Hat Inc.") round-trip correctly into the underlying Arcade build invocation, and updates stage2 argument forwarding to use proper arrays.

Changes:

  • Convert eng/build.sh from string-concatenated arguments to Bash arrays for correct quoting/escaping.
  • Change stage2 argument collection to support multiple stage2 args (now accumulated) and forward them safely.
  • Update CI pipeline invocations to use the new stage2-argument passing style.
Show a summary per file
File Description
eng/build.sh Uses Bash arrays for build args to preserve quoting; updates stage2 arg handling.
eng/build.ps1 Changes stage2Arguments to a string array and forwards it directly to stage2.
azure-pipelines/quarantine.yml Updates build invocation to use -stage2Argument for stage2-only args.
.vsts-dotnet-ci.yml Updates stage2 invocation pattern (including splitting multi-arg stage2 use into multiple arguments).

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

Comment thread eng/build.sh
Comment on lines +52 to 57
--stage2argument)
stage2Arguments+=( "$2" )
# Supplying stage2Argument implies a multi-stage build.
stage2=true
shift 2
;;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not needed

Comment thread eng/build.ps1
Comment on lines 9 to 11
[switch] $stage2,
[string] $stage2Arguments = "",
[string[]] $stage2Arguments = @(),
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@omajid fix?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@omajid we don't need to preserve the old plural name. Sorry my comment was misleading.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It seems odd to me to have a variable named as a singular but is actually a plural (array). Is [string[]] $stage2Argument an accptable name?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do whatever makes most sense to you. I only mentioned the singular form as you started using it in commit 2 already in the YML. My only request is to keep the name aligned between the pwsh and the shell code :)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

4 participants