MacOS DSC will hang when requesting sudo password, running sudo dsc will cause homebrew to fail
Open
Nobody has claimed this yet.
Issue-Bug
Need-Review
- Dominant language
- Rust
- Stars
- 523
- Forks
- 75
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 24
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Summary
./dsc will hang forever awaiting sudo password input for commands. sudo ./dsh causes homebrew to fail because homebrew doesn't want to be run as root.
Steps to reproduce
$schema: https://raw.githubusercontent.com/PowerShell/DSC/refs/heads/main/schemas/v3/config/document.json
resources:
- name: Install VSCode
type: DSC.PackageManagement/Brew
properties:
packageName: visual-studio-code
- name: Install Neovim
type: DSC.PackageManagement/Brew
properties:
packageName: neovim
- name: Install PowerShell
type: DSC.PackageManagement/Brew
properties:
packageName: powershell/tap/powershell
- name: Add PowerShell to etc shells
type: Microsoft.DSC.Transitional/RunCommandOnSet
properties:
executable: /bin/zsh
arguments:
- -c
- 'PWSH_PATH=$(which pwsh); if ! grep -q "$PWSH_PATH" /etc/shells; then echo "$PWSH_PATH" | sudo tee -a /etc/shells; fi'
- name: Change Default Shell
type: Microsoft.DSC.Transitional/RunCommandOnSet
properties:
executable: /bin/zsh
arguments:
- -c
- 'PWSH_PATH=$(which pwsh); chsh -s "$PWSH_PATH" $(whoami)'
Expected behavior
no hang
Actual behavior
hang
Error details
Environment data
echo $PSVersionTable
Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Darwin 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
3.0.0
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the hang by running ./dsc with the provided Brew and RunCommandOnSet configuration on macOS; compare it with sudo ./dsh, which makes Homebrew fail as root. Trace the command entry point and sudo password handling, and consider the issue done when the configuration completes without hanging while Homebrew is not run as root.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust, zsh
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100