PowerShell / PowerShell/DSC

Listing adapted resources results in ERROR_NOT_SUPPORTED

Open
#786 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug Need-Review Partner-WinGet
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

More generally, the rust Command::spawn call can potentially error like:

WARN Command: Operation The request is not supported. (os error 50) for executable 'pwsh'

I do not have a 100% repro, but there are situations in which I have had a fairly reliable (~90%) repro. All of these repro states occur when winget's configuration server is invoking dsc.exe AND the server has package identity. Attaching a debugger to dsc.exe prevents the repro. All of these things point to a race of some kind, but despite my efforts I have not been able to identify it.

This issue only started occurring at scale when I added the ability to get adapted resource information via calls like:

dsc.exe resource list -a Microsoft.DSC/PowerShell Microsoft.Windows.Developer/DeveloperMode

I can currently repro this frequently IFF the configuration server is running elevated; in the same workflow it works when the server is not elevated.

Steps to reproduce

With the document:

# dev-mode-v3.yaml
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.3
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
  winget:
    processor:
      identifier: "dscv3"
resources:
- name: Microsoft.Windows.Developer/DeveloperMode_w64qq6qo
  type: Microsoft.Windows.Developer/DeveloperMode
  metadata:
    description: "Configure Microsoft.Windows.Developer/DeveloperMode"
    securityContext: elevated
  properties:
    Ensure: 1
    IsEnabled: true

and the latest winget preview package (I have v1.11.280-preview, but we haven't actually published the first build with the required change yet 😓), run:

> winget configure dev-mode-v3.yaml

The following steps are relevant:

  1. winget creates an unelevated server (A)
  2. the unelevated server (A) runs dsc.exe resource list -a Microsoft.DSC/PowerShell Microsoft.Windows.Developer/DeveloperMode and it succeeds
  3. winget creates an elevated server (B)
  4. the elevated server (B) runs the same dsc command, but most of the time it fails with the stated error
Expected behavior
dsc can create child processes
Actual behavior
dsc sometimes cannot create child processes
Error details

Environment data
Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
OS                             Microsoft Windows 10.0.26411
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Version

dsc 3.1.0-preview.4

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust Command::spawn call and reproduce the documented winget configure sequence, comparing unelevated and elevated servers running dsc.exe resource list -a. Investigate why child-process creation intermittently returns ERROR_NOT_SUPPORTED, then verify that the elevated workflow consistently allows dsc to create child processes.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, rust
Domain
operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.