Skip to content

Initialize PAL StackString’s empty-string terminator - #136929

Merged
jkoritzinsky merged 3 commits into
mainfrom
copilot/fix-named-mutex-creation-issue
Nov 3, 2026
Merged

jkoritzinsky merged 3 commits into
mainfrom
copilot/fix-named-mutex-creation-issue

Conversation

Copilot AI commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

A default-constructed StackString leaves its buffer uninitialized, so IsEmpty() can return false. In the native named-mutex implementation, this can skip the home-directory fallback when XDG_RUNTIME_DIR is unset and lead to lstat("").

  • Initialization: Call NullTerminate() in the default constructor, making the buffer consistent with its zero length.
  • Regression coverage: Construct narrow and wide strings in nonzero-filled storage and check empty-string invariants, including zero-capacity inline buffers.

@azure-pipelines

azure-pipelines Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Copilot AI changed the title [WIP] Fix named mutex creation failure when XDG_RUNTIME_DIR is unset Initialize PAL StackString’s empty-string terminator Nov 3, 2026
Copilot AI requested a review from jkoritzinsky November 3, 2026 19:13
@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot please remove the tests you've added.

Copilot AI commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please remove the tests you've added.

Removed the tests and their build/test wiring in 24221ff, leaving only the constructor fix. PAL build and two existing targeted tests passed.

@jkoritzinsky
jkoritzinsky marked this pull request as ready for review November 3, 2026 20:09
@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) November 3, 2026 22:10
@jkoritzinsky
jkoritzinsky merged commit 5bec040 into main Nov 3, 2026
101 checks passed
@jkoritzinsky
jkoritzinsky deleted the copilot/fix-named-mutex-creation-issue branch November 3, 2026 23:49
@github-project-automation github-project-automation Bot moved this to Done in AppModel Nov 3, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Linux: named mutex creation fails with lstat("") when XDG_RUNTIME_DIR is unset (StackString::IsEmpty reads an uninitialized buffer)

3 participants