-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
The behaviour of string inputs during command calls seems to have changed from PowerShell Core 7.2.6 (and also Powershell 5.1!) to version 7.3.0.
While this might be partially as designed, it should at least be noted as a breaking change (with an explanation what exactly changed and in which scenarious this will take effect ), which it is currently not.
One example would be to use double quotes for a parameter, which could be argued is wrong anyways. But we had a script that used a parameter that way and it broke after the update.
Example:
ping "www.google.com" works in both versions
ping ""www.google.com"" works only up to PowerShell Core 7.2.6 (and Powershell 5.1) but no longer in 7.3.0 (this is also true for even more quotes in the command)
The error message generated is:
Bad parameter www.google.com.
Another would be if you use git command rev-list with an empty string in a variable used for the "from" branch in the "from"..."to" parameters. In these examples (note: I'm using git version 2.33.1.windows.1) you first have to change into a git repository, change to the master branch and define variable $TargetBranch as being an empty string.
So...
- Change into git repository
git checkout master$TargetBranch = ""
then the following command works up to PowerShell Core 7.2.6 (and again Powershell 5.1) but no longer in 7.3.0:
git rev-list $TargetBranch..origin/master
Instead of no output, as it should be, the error message generated is:
fatal: ambiguous argument '': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
interestingly if you set $TargetBranch to $null ( $TargetBranch = $null ) it will work again. But again, it's a breaking change, as we used an empty string up to now for the $TargetBranch variable.
It seems to me that the handling of input parameters for commands has changed from maybe an actual object directly forwarded to the command to producing an actual string with quotes out of the parameter and passing it as a string to the command, but maybe I'm mistaken.
Expected behavior
Either same behaviour as up to PowerShell Core 7.2.6, or if these changes are by design than at least listening it as a breaking change here: https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-73?view=powershell-7.3#breaking-changes-and-improvements
Also a better explanation (than mine) what exactly changed and in which scenarious this will take effect would be nice (as I can only guess that something in the interpretation of string inputs with quotes changed during call of commands).Actual behavior
Changed behaviour of string input during command calls (for example double quotes will break a command parameter now, some parameters where no quotes are expected may also break a command if the parameter is an empty string like in the git example)Error details
For example...
`Bad parameter www.google.com.`
or
fatal: ambiguous argument '': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'according to the used example (see "Steps to reproduce")
### Environment data
```powershell
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