Skip to content

& operator launches commands differently in 7.3.0 #18568

Closed

Description

@wasker

Prerequisites

Steps to reproduce

Program.cs.txt
test.ps1.txt

  1. Build C# app called blah.exe using Program.cs, make sure it's on the path.
  2. Run pwsh -f test.ps1 and observe the output.

Expected behavior

On 7.2.7:

Something will happen: working...
Something will happen: done.
--set
deployment.environment=blah
--set
deployment.region=blah
--set
deployment.image.repository=blah

Actual behavior

On 7.3.0:

Something will happen: working...
Something will happen: done.
--set
deployment.environment="blah"
--set
deployment.region="blah"
--set
deployment.image.repository="blah"

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

  1. added
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Nov 15, 2022
  2. mklement0 commented on Nov 15, 2022

    @mklement0
    Contributor

    This is ultimately a duplicate of #18554, but let me add some context:

    • v7.3.0 introduced a breaking change with respect to how arguments with embedded " characters as well as empty-string arguments are passed to external programs: a longstanding bug was fixed, fully on Unix, partially on Windows.

    • Existing workarounds that build on the old, broken behavior now break - except in calls to batch files and WSH scripts, where the legacy workarounds will continue to work by default.

    • The fixed behavior now correctly escapes embedded " characters as \" on the process command line PowerShell constructs behind the scenes, which is the most widely observed convention on Windows, and also supports passing empty strings as arguments.

      • Thus, an argument such as "deployment.environment=`"blah`"", which from PowerShell's perspective has a verbatim value of deployment.environment="blah" is now placed as follows on the target process' command line: "deployment.environment=\"blah\"", and if the target process observes the aforementioned convention, it ends up parsing that again as verbatim deployment.environment="blah", which is what you saw.

    There's additional background information in this Stack Overflow answer.

  3. wasker commented on Nov 15, 2022

    @wasker
    Author

    Thank you for the links!

    There's no mention of this behavior change in relnotes for 7.3.0 - https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0

    GitHub
    7.3.0 - 2022-11-08 General Cmdlet Updates and Fixes

    Correct calling cmdlet New-PSSessionOption in script for Restart-Computer (#18374)

    Tests

    Add test for framework dependent package in release p...

  4. mklement0 commented on Nov 15, 2022

    @mklement0
    Contributor

    My pleasure, wasker.

    There's no mention of this behavior change in relnotes for 7.3.0 -https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0

    That GitHub link doesn't provide a cumulative view of what changed in that release - it just shows whatever changed in the final commit that led to the release.

    GitHub
    7.3.0 - 2022-11-08 General Cmdlet Updates and Fixes

    Correct calling cmdlet New-PSSessionOption in script for Restart-Computer (#18374)

    Tests

    Add test for framework dependent package in release p...

    GitHub
    PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
    A collection of release notes and documentation about the new features available in new versions of PowerShell.
    New features and changes released in PowerShell 7.3
    PowerShell Team
    General availability of PowerShell 7.3
  5. SteveL-MSFT commented on Nov 16, 2022

    @SteveL-MSFT
    Member

    cc Mikey Lombardi (He/Him) (@michaeltlombardi)

    The content team should have plans to have an about topic specifically around using native commands in PS7 and I expect will capture these types of details

  6. added and removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Nov 16, 2022
  7. jhoneill commented on Nov 16, 2022

    @jhoneill

    Steve Lee (@SteveL-MSFT) - given that this is the second report of this issue in as many days, I wonder if it might be wiser for the default value of $PSNativeCommandArgumentPassing to be legacy. ? I think (as Michael Klement (@mklement0) says) the previous behaviour was a bug, but one which so many had lived with for so long it became "standard" - I put this as an open question because what gives the best gain:pain ratio is not obvious to me :-)

    Some of the 7.3 changes (PSReadline prediction being on, colouring directories, formatting of floating point in tables, the change to convertFrom-Json -as hash table, and this one) need to publicized more than they have been , the community can help on that but docs and team blog probably need to to take the lead. I'm for 3/5 of those, against 1/5, and this one I'm not sure about. Not all changes are bad, but surprises generally are, especially if the explanation is hard to find.

  8. ghost closed this as completedon Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions