Title: Changed behaviour for leading double quotes during command calls · Issue #18614 · PowerShell/PowerShell · GitHub
Open Graph Title: Changed behaviour for leading double quotes during command calls · Issue #18614 · PowerShell/PowerShell
X Title: Changed behaviour for leading double quotes during command calls · Issue #18614 · PowerShell/PowerShell
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 reprodu...
Open Graph 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 PowerSh...
X 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 PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/18614
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Changed behaviour for leading double quotes during command calls","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nThe 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.\r\nWhile 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.\r\n\r\nOne 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.\r\nExample:\r\n`ping \"www.google.com\"` works in both versions\r\n`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)\r\n\r\nThe error message generated is:\r\n`Bad parameter www.google.com.`\r\n\r\nAnother 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.\r\nSo...\r\n- Change into git repository\r\n- `git checkout master`\r\n- `$TargetBranch = \"\"`\r\nthen the following command works up to PowerShell Core 7.2.6 (and again Powershell 5.1) but no longer in 7.3.0:\r\n`git rev-list $TargetBranch..origin/master`\r\n\r\nInstead of no output, as it should be, the error message generated is:\r\n```\r\nfatal: ambiguous argument '': unknown revision or path not in the working tree.\r\nUse '--' to separate paths from revisions, like this:\r\n'git \u003ccommand> [\u003crevision>...] -- [\u003cfile>...]'\r\n```\r\ninterestingly 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.\r\n\r\nIt 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.\n\n### Expected behavior\n\n```console\nEither 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\r\n\r\nAlso 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).\n```\n\n\n### Actual behavior\n\n```console\nChanged 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)\n```\n\n\n### Error details\n\n```console\nFor example...\r\n`Bad parameter www.google.com.`\r\nor\r\n\r\nfatal: ambiguous argument '': unknown revision or path not in the working tree.\r\nUse '--' to separate paths from revisions, like this:\r\n'git \u003ccommand> [\u003crevision>...] -- [\u003cfile>...]'\r\n```\r\naccording to the used example (see \"Steps to reproduce\")\n```\n\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.3.0\r\nPSEdition Core\r\nGitCommitId 7.3.0\r\nOS Microsoft Windows 10.0.19044\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/echalone","@type":"Person","name":"echalone"},"datePublished":"2022-11-18T09:25:49Z","url":"https://github.com/PowerShell/PowerShell/issues/18614"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7a6b7f2e-d625-ee9e-f563-743d6b90eab2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C764:6B763:ECD36D:153276F:6AFDB441 |
| html-safe-nonce | f7af2f8505efca773366a605cd1ead24225f2fd1114e2799d6d58ec37c492971 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzY0OjZCNzYzOkVDRDM2RDoxNTMyNzZGOjZBRkRCNDQxIiwidmlzaXRvcl9pZCI6IjcwODQ3Nzk5MDA2NjU0NDMzOTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 58a484b46ff2d3ff2408defcb5eecf4d1adccadce2132b3fd054ca04ab80423e |
| hovercard-subject-tag | issue:1454768435 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/18614/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b663e0fca1b95f89474ecbeb9b6c95f54772ca2856929f1d7ff7ca83384e47d/PowerShell/PowerShell/issues/18614 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b663e0fca1b95f89474ecbeb9b6c95f54772ca2856929f1d7ff7ca83384e47d/PowerShell/PowerShell/issues/18614 |
| og:image:alt | 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 PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | echalone |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3c532f4d069d6fbe9b1837450343d1b9e0619a7d5c4ba0b3b64fd8e0bae67c7e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5396ad00d1c6d19097aee7fc4d00a2eb03432c8f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width