Repository navigation
Docs: say what cmd.exe's delayed expansion does to a quoted argument - #130
Merged
Merged
Conversation
…fer only in case A case-sensitive [hashtable]::new() job with 'canceltoken' got the kit's own token in its place, since the check used the job's own comparer and the worker's copy is case-insensitive. Two keys differing only in case collapsed into one, the later silently winning; such a job is now refused, up front for -JobParams and as it arrives for -NextJobProvider.
When -MaxOutputChars' head would end on the first half of a surrogate pair, it turned that half away but the tail kept its own size, so output exactly as long as the cap lost the pair. The tail now takes the slot the head turns away.
The group-fetch loop tested only the token, which is cancelled after it, so an abort raised by -GroupProvider, -JobBuilder, -GroupCompleteCallback or -GroupReleaseCheck still asked -GroupProvider for more groups and built them, up to -MaxQueueAhead, or every group when they had no jobs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #128, merge after it.
What was missing
The README's "What quoting can't stop" for
cmd.exeand batch files named%NAME%and=, but not delayed expansion. With it on,cmd.exealso expands!NAME!inside a quoted argument, and the kit's quoting can't stop that.What changed
The README's batch-file paragraph and
ConvertTo-PkArgumentString's help comment now say what delayed expansion does to a quoted argument:!NAME!is expanded inside quotes;^in an argument that holds a!is dropped;!NAME!or a lone!is dropped as well.The README names the three ways delayed expansion gets turned on.
How it was checked
On Windows PowerShell 5.1 and PowerShell 7, through
Invoke-PkProcessBatchwith list arguments:cmd /d /v:on /c echoa^b!"ab!"cmd /d /v:on /c echoa^b"a^b"cmd /d /v:on /c echox!yx!y(a lone!stays oncmd's own command line).cmdwithsetlocal EnableDelayedExpansionandecho [%1]!PK_O17![EXPANDED].cmdx!y[xy].cmd!NAME![]The registry setting wasn't tried, since it changes the machine's settings; the README points to
cmd /?for it.The full harness passes on 5.1 and 7 (803 assertions each), and
Testing/readme-examples/run.ps1passes.