-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop-parsing token is broken #18664
Comments
Agree that |
This would really ease our backward compatibility issues. Please fix this in 7.3.1 as soon as possible :-) |
@SteveL-MSFT Any plans to fix this? I think this is the only thing that would make it possible to make old scripts (7.2.*) compatible to new versions of powershell (7.3+) where escaped quotes are used. Btw. I still cant find any documentation on how to handle these problems. How can I call an executable which does not use standard command line escaping like msbuild in a compatible manner in all versions of powershell 5.1 to 7.4? |
The title fits our issue, though the details of how our workflow was interrupted by changes to --% is not in the original post. I don't see a similar bug raised and it relates to the same change, so I'll include my issue here. I have found this is still broken in v7.4.1 release. We were updated to v7.4.1 from v7.2.18 on the MS Hosted Windows agents for DevOps. This broke our existing pipelines, though I understand it is intended to be a breaking change as detailed here. Our use case: It seems when the optional parameters after |
Prerequisites
Steps to reproduce
This was previously reported in #15261, which was inappropriately closed as by-design.
The purpose of
--%
(which only makes sense on Windows) is to copy the remainder of the command line verbatim to the process command line constructed behind the scenes, so as to provide a way to explicitly control the double-quoting for target executables that have non-standard quoting requirements.As such, it should not be affected by the effective value of
$PSNativeCommandArgumentPassing
(Note: It is debatable how arguments that come before
--%
on a given command line should be handled; for backward compatibility I think it would make the most sense to process them as if'Legacy'
were in effect; in other words:--%
would be an implicit, command-scoped opt-in to$PSNativeCommandArgumentPassing = 'Legacy'
).However, as of v7.3.0 it is, and the behavior is broken by default (the only way to make it work again is with
$PSNativeCommandArgumentPassing = 'Legacy'
, which should not be necessary).Expected behavior
"C:\Users\jdoe\echoCmdLine.exe" /p:Category="CI,Nightly"
That is, the part of the original command line after
--%
should be copied as-is to the process command line.That is how it has worked since v3 (when
--%
was introduced) and should continue to work, irrespective of the value of$PSNativeCommandArgumentPassing = 'Legacy'
, in both PowerShell editions.Actual behavior
"C:\Users\jdoe\echoCmdLine.exe" "/p:Category=\"CI,Nightly\""
Note how the argument was inappropriately enclosed in
"..."
, with embedded"
escaped as\"
.That is, the
'Standard'
behavior was inappropriately used (althoughcmd.exe
-style environment variables, e.g.%OS%
, do still get expanded).Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: