profile
viewpoint
PowerShell Team PowerShell Redmond https://microsoft.com/powershell https://microsoft.com/powershell

PowerShell/openssh-portable 842

Portable OpenSSH, all Win32-OpenSSH releases and wiki are managed at https://github.com/powershell/Win32-OpenSSH

PowerShell/DscResources 728

Central repository for PowerShell Desired State Configuration (DSC) resources.

PowerShell/GraphicalTools 193

A module that mixes PowerShell and GUIs! - built on Avalonia and gui.cs

PowerShell/JEA 193

Just Enough Administration

PowerShell/EditorSyntax 85

Syntax highlighting files for editors (VSCode, Atom, SublimeText, TextMate, etc) and Github!

PowerShell/Microsoft.PowerShell.Archive 56

Archive PowerShell module contains cmdlets for working with ZIP archives

PowerShell/DscResource.Tests 51

Common meta tests for PowerShell DSC resources repositories.

startedPowerShell/PowerShell

started time in 6 minutes

push eventPowerShell/PowerShell

Dongbo Wang

commit sha 8672475bdcea46fe6cdad42795999f300fa09c2d

Fix cap token use - 2

view details

push time in 16 minutes

issue commentPowerShell/vscode-powershell

PowerShell Integrated Console hung and PowerShell will not start for main powershell terminal

@TylerLeonhardt, yes I cloned the PowerShell extension. Is that a source of problems?

Liturgist

comment created time in 20 minutes

push eventPowerShell/PowerShell

Dongbo Wang

commit sha 7a0748d64935e3c0e30542106c7f39e27056abeb

Fix cap token usage

view details

push time in 24 minutes

push eventPowerShell/PowerShell

Ilya

commit sha c7455fd4d88feacadd945e6b46023723a1335619

Add `CommandLine` property to Process (#12288)

view details

github-actions[bot]

commit sha 55b9041a40791e15a333ebffa5cce9619a87434c

Update .NET SDK version from `5.0.100-preview.5.20278.13` to `5.0.100-preview.5.20279.10` (#12844) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

view details

corbob

commit sha 0f16d0ec6ea7524ccdcf61669b84812474d1d25b

Minor typo corrections in Distribution Request Issue Templates (#12744) Fix a few misspellings in the Issue Template.

view details

xtqqczze

commit sha 0d5b7f5e6f686194c9a7a41697137a7704db996e

Add missing assessibility modifiers (#12820) # PR Summary Automated fix of [RCS1018](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1018.md) ## PR Context ## PR Checklist - [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - Use the present tense and imperative mood when describing your changes - [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress). - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready. - **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)** - [x] None - **OR** - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md) - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here --> - **User-facing changes** - [x] Not Applicable - **OR** - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [ ] Issue filed: <!-- Number/link of that issue here --> - **Testing - New and feature** - [x] N/A or can only be tested interactively - **OR** - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting) - **Tooling** - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted. - **OR** - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include: - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host). - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features. - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions). - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).

view details

xtqqczze

commit sha 4e98011833869d0ec2b327b132ef4520e8672190

cleanup: Use coalesce expression (#12829)

view details

xtqqczze

commit sha e93381e73e16a0d55ceab879ccaa58456800371d

Add readonly modifier to internal static members (#11777) # PR Summary * Add readonly modifier to internal static members. ## PR Context ## PR Checklist - [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - Use the present tense and imperative mood when describing your changes - [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress). - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready. - **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)** - [x] None - **OR** - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md) - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here --> - **User-facing changes** - [x] Not Applicable - **OR** - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [ ] Issue filed: <!-- Number/link of that issue here --> - **Testing - New and feature** - [x] N/A or can only be tested interactively - **OR** - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting) - **Tooling** - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted. - **OR** - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include: - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host). - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features. - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions). - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).

view details

Ilya

commit sha 3de9069ca799fd5f67ef3dc44198a5e9833c2a68

Fix `New-Item` to create symbolic link to relative path target (#12797)

view details

xtqqczze

commit sha 8f7d308eaaf3d3ad1efdc778663a25b7b1671aa2

Expand numberOfPowershellRefAssemblies list capacity (#12840) # PR Summary * Increase the list capacity because .NET v5.0.100-preview.5.20278.13 has an extra assembly * Remove assert added in #12520 ## PR Context HEAD of master has been broken since 99da109 (#12772), when .NET was updated to 5.0.100-preview.5.20278.13 https://github.com/PowerShell/PowerShell/issues/12815#issuecomment-636132717 ## PR Checklist - [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - Use the present tense and imperative mood when describing your changes - [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress). - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready. - **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)** - [x] None - **OR** - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md) - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here --> - **User-facing changes** - [x] Not Applicable - **OR** - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [ ] Issue filed: <!-- Number/link of that issue here --> - **Testing - New and feature** - [x] N/A or can only be tested interactively - **OR** - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting) - **Tooling** - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted. - **OR** - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include: - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host). - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features. - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions). - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).

view details

xtqqczze

commit sha c233b30a6afa85ef442a97fca17749bed818cfb8

Reorder modifiers according to preferred order (#12864) # PR Summary Reformat using `csharp_preferred_modifier_order`. ## PR Context Split change from #11773 ## PR Checklist - [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - Use the present tense and imperative mood when describing your changes - [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress). - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready. - **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)** - [x] None - **OR** - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md) - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here --> - **User-facing changes** - [x] Not Applicable - **OR** - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [ ] Issue filed: <!-- Number/link of that issue here --> - **Testing - New and feature** - [x] N/A or can only be tested interactively - **OR** - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting) - **Tooling** - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted. - **OR** - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include: - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host). - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features. - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions). - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).

view details

Dongbo Wang

commit sha 8f79ce1d293dfbee3fac889b8b1b25caa33dc701

Update Linux daily CI to run in a single agent & collect traces (#12866)

view details

Ilya

commit sha 73e8427586913c336f7fc7fe39db0e8ffd0f7afa

Bring back Certificate provider parameters (#10622)

view details

Aditya Patwardhan

commit sha 5a42f453c6ffe4ca4b1d9f6ee7a1b2999c805838

Update the PowerShell modules to use the new Help URI (#12686)

view details

xtqqczze

commit sha b03b968d0a3709a22509fbd01df1f595685de626

Restore `markdownlint` tests (#12549) Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>

view details

beatcracker

commit sha c22ccbebd2955ff67c03574ec26d252955e8ea6d

Add parameter `SchemaFile` to `Test-Json` cmdlet (#11934)

view details

Dongbo Wang

commit sha 81d042dc92e07f0fe9633052f01af9a3f0ceeb27

Collect traces in Linux build

view details

push time in 43 minutes

issue closedPowerShell/PowerShell

Using pipe/bar as a separator for splitting strings doesn't work as expected

win10/x64 v2004 powershell 7.0.1

Splitting on a colon:

C:\> "ab:cd:ef" -split ":"
ab
cd
ef

Looks good. But split on a bar/pipe?

C:\> "ab|cd|ef" -split "|"

a
b
|
c
d
|
e
f

It splits on each character.

closed time in an hour

oising

issue commentPowerShell/PowerShell

Using pipe/bar as a separator for splitting strings doesn't work as expected

Never mind -- it's being treated as regex. I'm an idiot.

oising

comment created time in an hour

issue openedPowerShell/PowerShell

Using pipe/bar as a separator for splitting strings doesn't work as expected

win10/x64 v2004 powershell 7.0.1

Splitting on a colon:

C:\> "ab:cd:ef" -split ":"
ab
cd
ef

Looks good. But split on a bar/pipe?

C:\> "ab|cd|ef" -split "|"

a
b
|
c
d
|
e
f

It splits on each character.

created time in an hour

create barnchPowerShell/PowerShell

branch : cap-upload

created branch time in an hour

issue commentPowerShell/PSReadLine

Have a function to allow interactive search of history showing multiple matches

PSFzf provides a good experience like this.

SteveL-MSFT

comment created time in 2 hours

issue openedPowerShell/PSReadLine

Terminal - Zoom then Multi-Line Paste Causes Error

Problem: Error when pasting content with 3 or more lines (some type of carriage return) into the terminal after zooming in or out.

Reproduce: Using Terminal, open a Windows PowerShell tab, zoom in, then paste 3 or more lines of content using CTRL+V. You may zoom by CTRL+= or CTRL+Mouse-Wheel-Up. Both reproduce the error. PowerShell (7+) does not appear to have the same problem (as often). I got it maybe once, but Windows PowerShell throw the error every time.

This result from this code seems to be enough to trigger the error: 1..3 | Clip

Workaround: Hit 'Enter' immediately after zooming and before you paste. You can also just type any letter/number and then delete it. As long as you break the sequence of zoom-paste, then it seems fine.

Shall we call this a win for PowerShell (7) and just drop Windows PowerShell? ;)

System: Name Value


PSVersion 5.1.18362.752 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.18362.752 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1


Last 1 Keys: Ctrl+v

Exception: System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. Parameter name: top Actual value was -2. at System.Console.SetCursorPosition(Int32 left, Int32 top) at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor) at Microsoft.PowerShell.PSConsoleReadLine.ForceRender() at Microsoft.PowerShell.PSConsoleReadLine.Paste(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

created time in 2 hours

startedPowerShell/PowerShell

started time in 2 hours

Pull request review commentPowerShell/PowerShell

Flag `default` switch statement condition clause as keyword

 Describe 'switch statement parsing' -Tags "CI" {     Test-ErrorStmt 'switch (1) {foo'       'switch (1) {foo' 'foo' '1' '1' '1'     Test-ErrorStmt 'switch (1) {foo}'      'switch (1) {foo' 'foo' '1' '1' '1'     Test-ErrorStmt 'switch (1) {foo {bar}' 'switch (1) {foo {bar}' 'foo' '{bar}' 'bar' 'bar' 'bar' '1' '1' '1'-    Test-ErrorStmt 'switch (1) {default {9} default{2}' 'switch (1) {default {9} default{2}' 'default' '{9}' '9' '9' '9' 'default' '{2}' '2' '2' '2' '1' '1' '1'+    Test-ErrorStmt 'switch (1) {default {9} default{2}' 'switch (1) {default {9} default{2}' '{9}' '9' '9' '9' '{2}' '2' '2' '2' '1' '1' '1'

I think the answer here is keep the test as it now is, plus add a success test to ensure that a block like the one above remains valid (and returns the correct result)

msftrncs

comment created time in 7 months

Pull request review commentPowerShell/PowerShell

Flag `default` switch statement condition clause as keyword

 Describe 'switch statement parsing' -Tags "CI" {     Test-ErrorStmt 'switch (1) {foo'       'switch (1) {foo' 'foo' '1' '1' '1'     Test-ErrorStmt 'switch (1) {foo}'      'switch (1) {foo' 'foo' '1' '1' '1'     Test-ErrorStmt 'switch (1) {foo {bar}' 'switch (1) {foo {bar}' 'foo' '{bar}' 'bar' 'bar' 'bar' '1' '1' '1'-    Test-ErrorStmt 'switch (1) {default {9} default{2}' 'switch (1) {default {9} default{2}' 'default' '{9}' '9' '9' '9' 'default' '{2}' '2' '2' '2' '1' '1' '1'+    Test-ErrorStmt 'switch (1) {default {9} default{2}' 'switch (1) {default {9} default{2}' '{9}' '9' '9' '9' '{2}' '2' '2' '2' '1' '1' '1'

It seems like keeping 'default' in as a clause is important. We should have a test for that.

switch ('default')
{
    'default' { 'Hi' }
    default { 'Bye' }
}

is valid PowerShell (returns Hi)

msftrncs

comment created time in 7 months

Pull request review commentPowerShell/PowerShell

Flag `default` switch statement condition clause as keyword

 private StatementAst SwitchStatementRule(LabelToken labelToken, Token switchToke                  while (true)                 {-                    ExpressionAst clauseCondition = GetSingleCommandArgument(CommandArgumentContext.SwitchCondition);-                    if (clauseCondition == null)-                    {-                        // ErrorRecovery: if we don't have anything that looks like a condition, we won't-                        // find a body (because a body is just a script block, which works as a condition.)-                        // So don't look for a body, hope we find the '}' next.+                    Token token = PeekToken();+                    var isDefaultClause = token.Kind == TokenKind.Default;
                    bool isDefaultClause = token.Kind == TokenKind.Default;
msftrncs

comment created time in 7 months

issue openedPowerShell/PSReadLine

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_2544786955'

I am getting this on Mac OS, I've tried several ways of installing and reinstalling powershell. All to no avail. I've also use the Get-PSReadlineOption to check the location of HistorySavePath and completely deleted this folder off the system to no avail.

Environment

PSReadLine: 2.0.1 PowerShell: 7.1.0-preview.3 OS: Darwin 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 Last 0 Keys


Exception

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_2544786955'
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

created time in 2 hours

issue commentPowerShell/PSScriptAnalyzer

Prevent Process conversion to Get-Process

@PrzemyslawKlys it would also be great to know the output of: gmo PSScriptAnalyzer

PrzemyslawKlys

comment created time in 2 hours

issue commentPowerShell/vscode-powershell

PowerShell Integrated Console hung and PowerShell will not start for main powershell terminal

@Liturgist

PS C:\src\vscode-powershell >

Did you clone this repo or something? It appears you have the extension's source.

Liturgist

comment created time in 2 hours

issue commentPowerShell/PSScriptAnalyzer

Prevent Process conversion to Get-Process

@PrzemyslawKlys could you provide an example script in which this is happening?

PrzemyslawKlys

comment created time in 3 hours

issue commentPowerShell/vscode-powershell

powershell.codeFormatting.pipelineIndentationStyle is ignored when formatting code

Thanks, Sydnay, for replying.

I'm not sure, because in the other issue I can't see no pipeline character. The sample code provided therein is dealing with curly braces indendation, not with pipelining.

The other issue may probably be closed due to the option setting not being applicable to the provided sample code.

What do you think? If you believe both issues are dealing with the same issue and will be treated equally, please feel free to close my issue.

SetTrend

comment created time in 3 hours

issue commentPowerShell/PSScriptAnalyzer

Should rule severity be configurable ?

Thanks @jegannathanmaniganadan for opening this issue, this is something we want to consider as we re-vamp the configuration options for PSSA 2.0 (our next major version). As @bergmeister mentioned it would still be great to know how you use the severity warnings in your work flow?

jegannathanmaniganadan

comment created time in 3 hours

startedPowerShell/PowerShell

started time in 3 hours

issue closedPowerShell/Win32-OpenSSH

Window 2008 Cannot Connect putty empty

Troubleshooting steps https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps

Terminal issue? please go through wiki https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

Please answer the following

"OpenSSH for Windows" version Version 1,7.7.1,8 32bit

Server OperatingSystem WIndow server 2018

Client OperatingSystem

What is failing I trying putty localhost it can not connect.Putty is empty screen.

2019-08-21_3-29-16 2019-08-21_3-22-10 2019-08-21_3-39-38

but netstat port 22 is establish . Expected output

Actual output

closed time in 3 hours

domeneo

issue commentPowerShell/Win32-OpenSSH

Window 2008 Cannot Connect putty empty

We no longer support Windows 2008. i presume you server version, "Server 2018", is a typo

domeneo

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

SSH can't connect with ssh-agent, but can connect when just using the `-i` option?

Troubleshooting steps https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps

Terminal issue? please go through wiki https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

Please answer the following

"OpenSSH for Windows" version

((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)`
7.6.0.1
λ ssh -V
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4

Server OperatingSystem Ubuntu 19.04

Client OperatingSystem Windows 10 Pro

What is failing

C:\Windows\System32\OpenSSH
λ ssh-add C:\Users\CLIENT-USERNAME\.ssh\tester
Enter passphrase for C:\Users\CLIENT-USERNAME\.ssh\tester:
Identity added: C:\Users\CLIENT-USERNAME\.ssh\tester (C:\Users\CLIENT-USERNAME\.ssh\tester)

C:\Windows\System32\OpenSSH
λ ssh-add -l
4096 SHA256:s3J+SE1DSy8eHmnXIY1U4F9qNDOoU/hC/FU/Tzt7oBw C:\Users\CLIENT-USERNAME\.ssh\tester (RSA)

C:\Windows\System32\OpenSSH
λ ssh SERVER-HOSTNAME -i C:\Users\CLIENT-USERNAME\.ssh\tester
REMOTE-USERNAME@SERVER-HOSTNAME: Permission denied (publickey).

C:\Windows\System32\OpenSSH
λ ssh-add -D
All identities removed.

C:\Windows\System32\OpenSSH
λ ssh-add -l
The agent has no identities.

C:\Windows\System32\OpenSSH
λ ssh SERVER-HOSTNAME -i C:\Users\CLIENT-USERNAME\.ssh\tester
Enter passphrase for key 'C:\Users\CLIENT-USERNAME\.ssh\tester':
Last login: Fri Aug 16 20:17:04 2019 from 1.2.3.4
REMOTE-USERNAME@SERVER-HOSTNAME:~$

Expected output The line ssh SERVER-HOSTNAME -i C:\Users\CLIENT-USERNAME\.ssh\tester should connect just fine.

Actual output See above.

closed time in 3 hours

flatline-studios

issue commentPowerShell/Win32-OpenSSH

SSH can't connect with ssh-agent, but can connect when just using the `-i` option?

This issue is fixed in the latest release.

flatline-studios

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

Can no longer establish an SSH connection

Troubleshooting steps https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps

Terminal issue? please go through wiki https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

Please answer the following

"OpenSSH for Windows" version ((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion) 8.0.0.0 Server OperatingSystem ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName) OpenSSH_for_Windows_8.0p1, LibreSSL 2.6.5

Client OperatingSystem Windows 10

What is failing Unable to establish SSH connection. It was previously working.

Expected output An SSH connection followed by a login prompt.

Actual output Actual output SERVER: C:\Program Files\OpenSSH-Win64>sshd.exe -ddd debug2: load_server_config: filename PROGRAMDATA\ssh/sshd_config debug2: load_server_config: done config len = 300 debug2: parse_server_config: config PROGRAMDATA\ssh/sshd_config len 300 debug3: PROGRAMDATA\ssh/sshd_config:9 setting Port 2022 debug3: PROGRAMDATA\ssh/sshd_config:30 setting StrictModes no debug3: PROGRAMDATA\ssh/sshd_config:34 setting PubkeyAuthentication yes debug3: PROGRAMDATA\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys debug3: PROGRAMDATA\ssh/sshd_config:79 setting Subsystem sftp sftp-server.exe debug3: checking syntax for 'Match Group administrators' debug1: sshd version OpenSSH_for_Windows_8.0, LibreSSL 2.6.5 debug1: private host key #0: ssh-rsa SHA256:HPCHuY/56QDTN2RKc/gEOgkkV/g3J4eB8cQBgGRXfAg debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:JTodMnrxAaMDRa71DuqFKcoE2hYhJTvfySSAA9hwm94 debug1: private host key #2: ssh-ed25519 SHA256:rnJqrSvOEwG6+b2sDVv5Ulsf+SJnCMk0IBMPpx6YQw0 debug1: rexec_argv[0]='sshd.exe' debug1: rexec_argv[1]='-ddd' debug2: fd 3 setting O_NONBLOCK debug3: sock_set_v6only: set socket 3 IPV6_V6ONLY debug1: Bind to port 2022 on ::. Server listening on :: port 2022. debug2: fd 4 setting O_NONBLOCK debug1: Bind to port 2022 on 0.0.0.0. Server listening on 0.0.0.0 port 2022. debug3: fd 5 is not O_NONBLOCK debug1: Server will not fork when running in debugging mode. debug3: send_rexec_state: entering fd = 8 config len 300 debug3: ssh_msg_send: type 0 debug3: send_rexec_state: done Connection from -Client IP- port 50740 on -OpenSSH Server IP- port 2022 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.0 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002 debug2: fd 5 setting O_NONBLOCK debug3: spawning "C:\Program Files\OpenSSH-Win64\sshd.exe" -ddd -y debug2: Network child is on pid 7024 debug3: send_rexec_state: entering fd = 4 config len 300 debug3: ssh_msg_send: type 0 debug3: send_rexec_state: done debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: preauth child monitor started debug3: recv_rexec_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_rexec_state: done debug2: parse_server_config: config PROGRAMDATA\ssh/sshd_config len 300 debug3: PROGRAMDATA\ssh/sshd_config:9 setting Port 2022 debug3: PROGRAMDATA\ssh/sshd_config:30 setting StrictModes no debug3: PROGRAMDATA\ssh/sshd_config:34 setting PubkeyAuthentication yes debug3: PROGRAMDATA\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys debug3: PROGRAMDATA\ssh/sshd_config:79 setting Subsystem sftp sftp-server.exe debug3: checking syntax for 'Match Group administrators' debug1: sshd version OpenSSH_for_Windows_8.0, LibreSSL 2.6.5 debug3: recv_hostkeys_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_hostkeys_state: done WSADuplicateSocket failed, WSALastError: 10038 debug3: w32_fcntl ERROR: bad fd: -1 debug3: w32_fcntl ERROR: bad fd: -1 debug3: w32_getpeername ERROR: bad fd: -1 debug3: recv_idexch_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_idexch_state: done debug3: w32_fcntl ERROR: bad fd: -1 fcntl(-1, F_GETFL): Bad file descriptor debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug3: send packet: type 20 [preauth] debug1: SSH2_MSG_KEXINIT sent [preauth] debug3: w32_write ERROR: bad fd: -1 [preauth] ssh_dispatch_run_fatal: Connection from UNKNOWN port 65535: Bad file descriptor [preauth] debug1: do_cleanup [preauth] debug3: ReadFileEx() ERROR:109, io:000002DD0B612D20 debug1: monitor_read_log: child log fd closed debug3: mm_request_receive entering debug1: do_cleanup debug1: Killing privsep child 7024

CLIENT: ssh -p 2022 -vvv -Username-@-OpenSSH Server IP- OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 58: Applying options for * debug2: resolving "-OpenSSH Server IP-" port 2022 debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to -OpenSSH Server IP- [-OpenSSH Server IP-] port 2022. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.0 debug1: match: OpenSSH_for_Windows_8.0 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to -OpenSSH Server IP-:2022 as '-Username-' debug3: put_host_port: [-OpenSSH Server IP-]:2022 debug3: hostkeys_foreach: reading file "/root/.ssh/known_hosts" debug3: record_hostkey: found key type ECDSA in file /root/.ssh/known_hosts:856 debug3: load_hostkeys: loaded 1 keys from [-OpenSSH Server IP-]:2022 debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 debug3: send packet: type 20 debug1: SSH2_MSG_KEXINIT sent Connection reset by -OpenSSH Server IP- port 2022

closed time in 3 hours

O4K3Y

issue commentPowerShell/Win32-OpenSSH

Can no longer establish an SSH connection

We are not planning on fixing this issue, as it appears to be localized to OpenTextSocks

O4K3Y

comment created time in 3 hours

issue commentPowerShell/Win32-OpenSSH

Windows 1903 Upgrade Disables SSH Service

This next windows release will be available in the fall of 2020

altano

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

Windows 1903 Upgrade Disables SSH Service

"OpenSSH for Windows" version ssh = 7.7.2.1 sshd = not installed

Client OperatingSystem Windows 10 1809 => 1903

What is failing The Windows 1809=>1903 upgrade disables the ssh-agent service. The fix is simple, I just have to re-enable the service:

Get-Service | select -property name,starttype,status | Select-String ssh
Set-Service -Name ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service | select -property name,starttype,status | Select-String ssh

BUT I'm reporting this as a bug because:

  1. Others might not be able to diagnose the issue as easily and this might be helpful and
  2. I'm really frustrated with how hard it has been to maintain a semi-working OpenSSH setup on Windows using this package. It breaks on every Windows upgrade and the fix to #1263 made in January still isn't rolled out for some reason

closed time in 3 hours

altano

issue closedPowerShell/Win32-OpenSSH

ALT+Backspace sends ^? instead of ^H or ^[^?

"OpenSSH for Windows" version OpenSSH_for_Windows_8.0p1, LibreSSL 2.6.5

Server OperatingSystem Ubuntu 18.04

Client OperatingSystem Windows 10 Pro 1809 17763.615

What is failing

When trying to use ALT+backspace in the command prompt while being asked for input in Linux, it sends ^? instead of ^H or ^[^? and does not delete a word.

Expected output When hitting ALT+backspace it should delete a word. releated #1268 #1190 https://github.com/PowerShell/openssh-portable/pull/325

Here is the expected control character send from ssh bundled with git for windows. git bundled ssh verion: openSSH_8.0p1, OpenSSL 1.1.1c 28 May 2019

ubuntu:~$ showkey -a
Press any keys - Ctrl-D will terminate this program
^[^?     27 0033 0x1b
        127 0177 0x7f

Actual output A character is deleted instead of a whole word. Here is the actual control character send from Win32-OpenSSH

ubuntu:~$ showkey -a

Press any keys - Ctrl-D will terminate this program

^?      127 0177 0x7f

closed time in 3 hours

bao-qian

issue commentPowerShell/Win32-OpenSSH

unable to generate token for user sshd

Thank you for the update. Is there a feature request already submitted that I can track?

dwatley

comment created time in 3 hours

issue commentPowerShell/Win32-OpenSSH

OpenSSH for Windows hangs while writing to STDERR asynchronously

Can you attempt this manually, if you still see the issue, can you provide your manual repro steps?

lizhaoliu

comment created time in 3 hours

issue commentPowerShell/vscode-powershell

PowerShell Integrated Console hung and PowerShell will not start for main powershell terminal

I changed the setting as you specified, @SydneyhSmith. Although, I do not know how it knew to find powershell.exe 5.1. This produced:

You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?

followed by:

PackageManagement updated, If you already had PackageManagement loaded in your session, please restart the PowerShell extension.

=== Perhaps there is some improvement. Starting VS code with a .ps1 file produces: (I have the version and profile script location emitted in the profile scripts)

                  =====> PowerShell Integrated Console <=====

5.1.18362.752 AllUsersAllHosts @ C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
5.1.18362.752 CurrentUserAllHosts @ C:\Users\pwatson\Documents\WindowsPowerShell\profile.ps1
PS C:\src\vscode-powershell> 

===

Pressing F5 to start debugging produces: (in Terminal "Task - BuildAll (vscode-powershell)")

> Executing task in folder vscode-powershell: Invoke-Build BuildAll <

Invoke-Build: The term 'Invoke-Build' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
Liturgist

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

Password auth does not work

When trying to contact a Windows computer with another Windows computer through ssh the password doesn't work. Both computers are registered in the same Microsoft account and therefore have the same username and password.

The password that matches the microsoft account is refused on the client that attempts to contact the host. This is not a firewall problem either.

Whenever I try to input the correct microsoft account password the ssh client replies:

Permission Denied, please try again

closed time in 3 hours

andrfgs

issue commentPowerShell/Win32-OpenSSH

Password auth does not work

If you are still seeing this issue, please reopen. Can you please provide the client side and server side logs?

andrfgs

comment created time in 3 hours

issue commentPowerShell/Win32-OpenSSH

EXCEPTION: There was no endpoint listening at net.pipe://localhost

Can you debug this application, it is not shown that this is an SSH issue.

mattigot

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

EXCEPTION: There was no endpoint listening at net.pipe://localhost

"OpenSSH for Windows" version 7.7.2.1

Server OperatingSystem Windows 10 Enterprise LTSC 2019

Client OperatingSystem indows 10 Enterprise

What is failing Trying to run via ssh a application This application has it's own service that communicates with net.pipe listener adapter service.

Expected output Expected to be able to ssh into the machine and use the program

Actual output I am able to ssh into the machine but Not able to run the program.

This is the error i get: EXCEPTION: There was no endpoint listening at net.pipe://localhost/APSService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. Type APS_Software /? for help.

Observations:

  • openssh works fine, since i am able to used different applications remotely via ssh (just not this one).
  • APSService service (the app service) is running with no issues.. (starts automatically)
  • The application works locally with no issues.
  • net.pipe listener Adapter service is running (starts automatically)

closed time in 3 hours

mattigot

issue closedPowerShell/Win32-OpenSSH

Cannot use a signing certificate

"OpenSSH for Windows" version 7.9.0.0

Server OperatingSystem Windows Server 2008 R2 Standard

Client OperatingSystem Red Hat Enterprise Linux Server release 7.6 (Maipo)

What is failing I configured public key authentication between machines. I can successfully log in and run every command from linux machine, e.g. $ ssh user1@host whoami host\user1

but I am not able to digital sign an executable using a certificate that was installed in a Windows certificate store for a current user (user1 in this example).

Is it possible that when logged using openssh the certificate store for current user is not available? I found this information in the docs: "A remote session opened via key based authentication does not have associated user credentials and hence is not capable of outbound authentication as the user. This is by design and goes by the rules of standard Windows security." (https://github.com/PowerShell/Win32-OpenSSH/wiki/SSH-remote-sessions-on-Windows) on the other hand I am able to check that I am logged as the right user (whoami returning correct host\user1 information).

Is there a way to have access to certificates installed for a current user over ssh session?

Note: I tested a scenario in which a certificate is stored per Local Computer (not current user) and it works after adding user1 to private key permissions, but for a reason I cannot use the certificates from Local Computer store in a final solution for digital signing.

Expected output $ ssh user1@host ""C:/Program Files (x86)/Windows Kits/10/bin/10.0.16299.0/x86/signtool.exe" sign /a /v /t "http://timestamp.verisign.com/scripts/timestamp.dll" /sm /debug c:\temp\zip.exe"

The following certificates were considered: Issued to: My company Issued by: Symantec Class 3 SHA256 Code Signing CA Expires: Tue Jul 30 01:59:59 2019 SHA1 hash: 94FF.....................omitted

After EKU filter, 1 certs were left. After expiry filter, 1 certs were left. After Private Key filter, 1 certs were left. The following certificate was selected: Issued to: My company Issued by: Symantec Class 3 SHA256 Code Signing CA Expires: Tue Jul 30 01:59:59 2019 SHA1 hash: 94FF.....................omitted

Done Adding Additional Store Successfully signed: c:\temp\zip.exe

Number of files successfully Signed: 1 Number of warnings: 0 Number of errors: 0

Actual output $ ssh user1@host ""C:/Program Files (x86)/Windows Kits/10/bin/10.0.16299.0/x86/signtool.exe" sign /a /v /t "http://timestamp.verisign.com/scripts/timestamp.dll" /debug c:\temp\zip.exe"

The following certificates were considered: Issued to: My company Issued by: Symantec Class 3 SHA256 Code Signing CA Expires: Tue Jul 30 01:59:59 2019 SHA1 hash: 94FF.....................omitted

After EKU filter, 1 certs were left. After expiry filter, 1 certs were left. After Private Key filter, 0 certs were left. SignTool Error: No certificates were found that met all the given criteria.

closed time in 3 hours

gmajka

issue closedPowerShell/Win32-OpenSSH

Connection closed

image

closed time in 3 hours

lvtanxi

issue commentPowerShell/Win32-OpenSSH

Connection closed

If you are still having this issue, please reopen.

If you reopen, can you:

  • copy and paste the error into the issue
  • provide client side and server side logs
lvtanxi

comment created time in 3 hours

issue commentPowerShell/Win32-OpenSSH

sshd does not use user publickey from authorized_keys

Can you please provide the complete SSHD log? The one posted is not complete

olafhering

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

ssh to the server and the domain account has been translated into domain\\user

Troubleshooting steps I have tried ssh with and without RSA key and every time I get a broken pipe error. I am running OpenSSH V7.90-Beta.

Please answer the following

"OpenSSH for Windows" version OpenSSH V7.9.0

Server OperatingSystem Windows 2012 R2

Client OperatingSystem Ubuntu 16.04

What is failing Any ssh is failing with connection reset by peer

Expected output Successful login with or without RSA key

Actual output When I try to ssh the windows server from the Unix server. ssh -v user@domain@serverip. I did run sshd.exe -d under system account on the windows server. The saw the error message after debug1: KEX done [preauth] debug1: Can't match group at line 87 because user domain\\user does not exist. The invalid user.

Why an extra slash was added into though? I tried ssh -v domain\user@serverip, and the username was translated to domainuser. The slash was gone. Has anyone experienced this problem? Any clue how to fix it?

Thanks in advance.

closed time in 3 hours

ytreeca

issue closedPowerShell/Win32-OpenSSH

"ssh -tt user@host command" won't run the command

The same thing works on a ubuntu host but on a windows host whenever I do that the screen gets cleared and I get thrown into the ssh shell as if no command was passed on the command line

"ssh user@host command" works fine but there's no input and no colors

closed time in 3 hours

vrokolos

issue commentPowerShell/Win32-OpenSSH

"ssh -tt user@host command" won't run the command

This is fixed in the latest release.

vrokolos

comment created time in 3 hours

issue commentPowerShell/Win32-OpenSSH

Delay Connecting from Ubuntu

Can you provide the client side and server side logs?

trevrobwhite

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

sshd rejecting all connections with or without rsa key with broken pipe error

Troubleshooting steps I have tried ssh with and without RSA key and every time I get a broken pipe error. I am running OpenSSH V7.90-Beta.

Please answer the following

"OpenSSH for Windows" version OpenSSH V7.9.0-Beta

Server OperatingSystem Windows 2012 R2

Client OperatingSystem MacOS X 10.14.5

What is failing Any ssh or sftp attempt is failing with a Broken Pipe error

Expected output Successful login with or without RSA key

Actual output packet_write_wait: Connection to 10.0.0.1 port 22: Broken pipe

closed time in 3 hours

bagness

issue commentPowerShell/vscode-powershell

The Language Service Could not be started

Thanks @EdCallahan that is really helpful information, I think in order for us to move forward we likely need to better understand BeyondTrust/Avecto....we'd be happy to follow up with your support contacts there...if you are interested in following up with us send an email to vscode-powershell@microsoft.com and we will figure out what the next steps are....thanks!

spidey323

comment created time in 3 hours

issue commentPowerShell/Win32-OpenSSH

ssh get sucked after remotely logging to a Ubuntu

After logging in to Ubuntu, set the term to Xterm. Please try this with the latest win32-OpenSSH release.

yiqiaoc11

comment created time in 3 hours

issue commentPowerShell/vscode-powershell

Running Save Participants dialog is hanging on save and preventing the script from saving

We recently published an update to our preview extension which has addressed a number of underlying architectural issues, would you mind giving it a try and letting us know if you are still hitting this issue?

MarkKharitonov

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

SSHD crashes when GSSAPI auth is enabled

"OpenSSH for Windows" version V7.9.0.0

Server OperatingSystem Any

Client OperatingSystem Any

What is failing Configure server to use GSSAPI authentication. Logging in via a domain account works. But logging in using a workgroup account with client side configured to use GSSAPI auth results in a server side crash Do either this ssh -K workgroupaccount@domain.joined.target.com or the following with GSSAPI enabled in client side ssh_config

#in client config
GSSAPIAuthentication yes
#do this
ssh workgroupaccount@domain.joined.target.com

Expected output remote session is opened using workgroup accounts

Actual output client_loop: send disconnect: Connection reset

closed time in 3 hours

manojampalam

issue commentPowerShell/vscode-powershell

PowerShell Integrated Console hung and PowerShell will not start for main powershell terminal

Thanks @Liturgist for all the information!

Thanks also @peter-sahajian for the detailed repro steps it would be really helpful if you could also attach the logs--instructions for how to do that are here

Liturgist

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

SFTP cannot save fetched file when local path contains non-latin character

"OpenSSH for Windows" version ((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion) 7.7.2.2

Server OperatingSystem Ubuntu 18.04.2 LTS (Azure)

Client OperatingSystem ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName) Windows 10 Enterprise 1904 ([environment]::OSVersion.Version)

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      18362  0

What is failing sftp cannot save downloaded file when path contains non-latin character (e.g. in user name part)

Expected output

Actual output XXX and YYY are replacements for privacy. Character ł is the problem. When local path is changed, file downloads without an issue.

PS C:\Users\XXXXłXXXXXXXX> cd ~
PS C:\Users\XXXXłXXXXXXXX> sftp srv3
Enter passphrase for key 'C:\Users\XXXXłXXXXXXXX/.ssh/srv3XXXX':
Connected to srv3.
sftp> get rmlist.txt
Fetching /home/YYYYYYYY/rmlist.txt to rmlist.txt
Couldn't open local file "rmlist.txt" for writing: No such file or directory
sftp> lcd f:\
sftp> get rmlist.txt
Fetching /home/YYYYYYYY/rmlist.txt to rmlist.txt
/home/YYYYYYYY/rmlist.txt                                                            100%   15KB 149.8KB/s   00:00     
sftp>

closed time in 3 hours

ghost

issue openedPowerShell/Win32-OpenSSH

May update broke publickey authentification

This is definitely an issue related to the new May 2004 update (19041.264). My authentification setup was working perfectly fine prior to updating my system.

Password authentification is not affected by this issue. I'm using ed25519 key, I didn't tested another format. I am not even prompted to enter my passphrase.

Looking at logs using verbose, I have this:

sshd: Connection from <client_ip> port <random_port> on <server_ip> port 22

sshd: Failed publickey for <client> from <client_ip> port <random_port> ssh2: ED25519 SHA256: <sha256>

sshd: Connection closed by authenticating user <client> <client_ip> port <random_port> [preauth]

I can't find anything useful using DEBUG3, I have only these lines after checking the authorized_keys

10852 2020-06-02 16:59:36.340 debug2: input_userauth_request: setting up authctxt for <user>[preauth]
10852 2020-06-02 16:59:36.340 debug3: mm_inform_authserv entering [preauth]
10852 2020-06-02 16:59:36.340 debug3: mm_request_send entering: type 4 [preauth]
10852 2020-06-02 16:59:36.340 debug2: input_userauth_request: try method none [preauth]
10852 2020-06-02 16:59:36.340 debug3: userauth_finish: failure partial=0 next methods="publickey" [preauth]
10852 2020-06-02 16:59:36.340 debug3: send packet: type 51 [preauth]

created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

Using sshd as a Windows service

"OpenSSH for Windows" version 7.9.0.0

Server OperatingSystem Windows 10 Pro

Client OperatingSystem Windows 10 Pro

What is failing I'm unable to connect myself if sshd is a service. If I run it from PowerShell as administrator, everything is fine.

Expected output debug2: load_server_config: filename PROGRAMDATA\ssh/sshd_config debug2: load_server_config: done config len = 301 debug2: parse_server_config: config PROGRAMDATA\ssh/sshd_config len 301 debug3: PROGRAMDATA\ssh/sshd_config:23 setting SyslogFacility LOCAL0 debug3: PROGRAMDATA\ssh/sshd_config:24 setting LogLevel DEBUG3 debug3: PROGRAMDATA\ssh/sshd_config:30 setting StrictModes no debug3: PROGRAMDATA\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys debug3: PROGRAMDATA\ssh/sshd_config:76 setting Subsystem sftp sftp-server.exe debug3: checking syntax for 'Match Group administrators' debug1: sshd version OpenSSH_for_Windows_7.9, LibreSSL 2.6.5 debug1: private host key #0: ssh-rsa SHA256:HP/gwkiMaBlG4IFNc/drYNnT9EuTsO184RYiKiTDM2U debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:cl1MP4kWDLFU4PglDegdfevUdvBK9Bj0T1PBR9ec6bM debug1: private host key #2: ssh-ed25519 SHA256:jLbzdivh3l2/qKUxoSTEL1GD3ZQF0wKTQnFhE/xmhMM debug1: rexec_argv[0]='D:\Tools\OpenSSH\sshd.exe' debug1: rexec_argv[1]='-ddd' debug2: fd 3 setting O_NONBLOCK debug3: sock_set_v6only: set socket 3 IPV6_V6ONLY debug1: Bind to port 22 on ::. Server listening on :: port 22. debug2: fd 4 setting O_NONBLOCK debug1: Bind to port 22 on 0.0.0.0. Server listening on 0.0.0.0 port 22. debug3: fd 5 is not O_NONBLOCK debug1: Server will not fork when running in debugging mode. debug3: send_rexec_state: entering fd = 8 config len 301 debug3: ssh_msg_send: type 0 debug3: send_rexec_state: done Connection from 192.168.6.223 port 61205 on 192.168.12.19 port 22 debug1: Client protocol version 2.0; client software version OpenSSH_for_Windows_7.9 debug1: match: OpenSSH_for_Windows_7.9 pat OpenSSH* compat 0x04000000 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9 debug2: fd 5 setting O_NONBLOCK debug3: spawning "D:\Tools\OpenSSH\sshd.exe" -ddd -y debug2: Network child is on pid 2152 debug3: send_rexec_state: entering fd = 4 config len 301 debug3: ssh_msg_send: type 0 debug3: send_rexec_state: done debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: preauth child monitor started debug3: recv_rexec_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_rexec_state: done debug2: parse_server_config: config PROGRAMDATA\ssh/sshd_config len 301 debug3: PROGRAMDATA\ssh/sshd_config:23 setting SyslogFacility LOCAL0 debug3: PROGRAMDATA\ssh/sshd_config:24 setting LogLevel DEBUG3 debug3: PROGRAMDATA\ssh/sshd_config:30 setting StrictModes no debug3: PROGRAMDATA\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys debug3: PROGRAMDATA\ssh/sshd_config:76 setting Subsystem sftp sftp-server.exe debug3: checking syntax for 'Match Group administrators' debug1: sshd version OpenSSH_for_Windows_7.9, LibreSSL 2.6.5 debug3: recv_hostkeys_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_hostkeys_state: done debug3: recv_idexch_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_idexch_state: done debug2: fd 5 setting O_NONBLOCK debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug3: send packet: type 20 [preauth] debug1: SSH2_MSG_KEXINIT sent [preauth] debug3: receive packet: type 20 [preauth] debug1: SSH2_MSG_KEXINIT received [preauth] debug2: local server KEXINIT proposal [preauth] debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1 [preauth] debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: compression ctos: none [preauth] debug2: compression stoc: none [preauth] debug2: languages ctos: [preauth] debug2: languages stoc: [preauth] debug2: first_kex_follows 0 [preauth] debug2: reserved 0 [preauth] debug2: peer client KEXINIT proposal [preauth] debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c [preauth] debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth] debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: compression ctos: none [preauth] debug2: compression stoc: none [preauth] debug2: languages ctos: [preauth] debug2: languages stoc: [preauth] debug2: first_kex_follows 0 [preauth] debug2: reserved 0 [preauth] debug1: kex: algorithm: curve25519-sha256 [preauth] debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth] debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth] debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth] debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] debug3: receive packet: type 30 [preauth] debug3: mm_sshkey_sign entering [preauth] debug3: mm_request_send entering: type 6 [preauth] debug3: mm_sshkey_sign: waiting for MONITOR_ANS_SIGN [preauth] debug3: mm_request_receive_expect entering: type 7 [preauth] debug3: mm_request_receive entering [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 6 debug3: mm_answer_sign debug3: mm_answer_sign: hostkey proof signature 0000016A9F7E1DC0(100) debug3: mm_request_send entering: type 7 debug2: monitor_read: 6 used once, disabling now debug3: send packet: type 31 [preauth] debug3: send packet: type 21 [preauth] debug2: set_newkeys: mode 1 [preauth] debug1: rekey after 134217728 blocks [preauth] debug1: SSH2_MSG_NEWKEYS sent [preauth] debug1: expecting SSH2_MSG_NEWKEYS [preauth] debug3: send packet: type 7 [preauth] debug3: receive packet: type 21 [preauth] debug1: SSH2_MSG_NEWKEYS received [preauth] debug2: set_newkeys: mode 0 [preauth] debug1: rekey after 134217728 blocks [preauth] debug1: KEX done [preauth] debug3: receive packet: type 5 [preauth] debug3: send packet: type 6 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user s.meunier service ssh-connection method none [preauth] debug1: attempt 0 failures 0 [preauth] debug3: mm_getpwnamallow entering [preauth] debug3: mm_request_send entering: type 8 [preauth] debug3: mm_getpwnamallow: waiting for MONITOR_ANS_PWNAM [preauth] debug3: mm_request_receive_expect entering: type 9 [preauth] debug3: mm_request_receive entering [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 8 debug3: mm_answer_pwnamallow debug2: parse_server_config: config reprocess config len 301 debug3: checking match for 'Group administrators' user dont-nod\s.meunier host 192.168.6.223 addr 192.168.6.223 laddr 192.168.12.19 lport 22 debug3: get_user_token - i am running as dont-nod\s.meunier, returning process token unable to resolve group administrators debug1: user dont-nod\s.meunier does not match group list administrators at line 84 debug3: match not found debug3: mm_answer_pwnamallow: sending MONITOR_ANS_PWNAM: 1 debug3: mm_request_send entering: type 9 debug2: monitor_read: 8 used once, disabling now debug2: input_userauth_request: setting up authctxt for s.meunier [preauth] debug3: mm_inform_authserv entering [preauth] debug3: mm_request_send entering: type 4 [preauth] debug2: input_userauth_request: try method none [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 35.309ms, delaying 6.189ms (requested 5.187ms) [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 4 debug3: mm_answer_authserv: service=ssh-connection, style= debug2: monitor_read: 4 used once, disabling now debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user s.meunier service ssh-connection method publickey [preauth] debug1: attempt 1 failures 0 [preauth] debug2: input_userauth_request: try method publickey [preauth] debug1: userauth_pubkey: test pkalg rsa-sha2-512 pkblob RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE [preauth] debug3: mm_key_allowed entering [preauth] debug3: mm_request_send entering: type 22 [preauth] debug3: mm_key_allowed: waiting for MONITOR_ANS_KEYALLOWED [preauth] debug3: mm_request_receive_expect entering: type 23 [preauth] debug3: mm_request_receive entering [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 22 debug3: mm_answer_keyallowed entering debug3: mm_answer_keyallowed: key_from_blob: 0000016A9F7E1730 debug1: trying public key file C:\Users\s.meunier\.ssh/authorized_keys debug1: C:\Users\s.meunier\.ssh/authorized_keys:1: matching key found: RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE debug1: C:\Users\s.meunier\.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding Accepted key RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE found at C:\Users\s.meunier\.ssh/authorized_keys:1 debug3: mm_answer_keyallowed: publickey authentication test: RSA key is allowed debug3: mm_request_send entering: type 23 debug3: send packet: type 60 [preauth] debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-512 [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 19.636ms, delaying 1.113ms (requested 5.187ms) [preauth] Postponed publickey for s.meunier from 192.168.6.223 port 61205 ssh2 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user s.meunier service ssh-connection method publickey [preauth] debug1: attempt 2 failures 0 [preauth] debug2: input_userauth_request: try method publickey [preauth] debug3: userauth_pubkey: have rsa-sha2-512 signature for RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE [preauth] debug3: mm_key_allowed entering [preauth] debug3: mm_request_send entering: type 22 [preauth] debug3: mm_key_allowed: waiting for MONITOR_ANS_KEYALLOWED [preauth] debug3: mm_request_receive_expect entering: type 23 [preauth] debug3: mm_request_receive entering [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 22 debug3: mm_answer_keyallowed entering debug3: mm_answer_keyallowed: key_from_blob: 0000016A9F7E17A0 debug1: trying public key file C:\Users\s.meunier\.ssh/authorized_keys debug1: C:\Users\s.meunier\.ssh/authorized_keys:1: matching key found: RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE debug1: C:\Users\s.meunier\.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding Accepted key RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE found at C:\Users\s.meunier\.ssh/authorized_keys:1 debug3: mm_answer_keyallowed: publickey authentication: RSA key is allowed debug3: mm_request_send entering: type 23 debug3: mm_sshkey_verify entering [preauth] debug3: mm_request_send entering: type 24 [preauth] debug3: mm_sshkey_verify: waiting for MONITOR_ANS_KEYVERIFY [preauth] debug3: mm_request_receive_expect entering: type 25 [preauth] debug3: mm_request_receive entering [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 24 debug3: mm_answer_keyverify: publickey 0000016A9F7E18F0 signature verified debug1: auth_activate_options: setting new authentication options debug3: mm_request_send entering: type 25 Accepted publickey for s.meunier from 192.168.6.223 port 61205 ssh2: RSA SHA256:cVcoOL7wsppGfxKgdBRWWqFaLE1KcfmD066WXf4LmQE debug1: monitor_child_preauth: s.meunier has been authenticated by privileged process debug3: mm_get_keystate: Waiting for new keys debug3: mm_request_receive_expect entering: type 26 debug3: mm_request_receive entering debug3: mm_get_keystate: GOT new keys debug1: auth_activate_options: setting new authentication options [preauth] debug2: userauth_pubkey: authenticated 1 pkalg rsa-sha2-512 [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 28.071ms, delaying 13.427ms (requested 5.187ms) [preauth] debug3: send packet: type 52 [preauth] debug3: mm_request_send entering: type 26 [preauth] debug3: mm_send_keystate: Finished sending state [preauth] debug3: ReadFileEx() ERROR:109, io:0000016A9F7E49B0 debug3: read - no more data, io:0000016A9F7E49B0 debug1: monitor_read_log: child log fd closed debug3: get_user_token - i am running as dont-nod\s.meunier, returning process token debug1: Not running as SYSTEM: skipping loading user profile debug3: spawning "D:\Tools\OpenSSH\sshd.exe" -ddd -z User child is on pid 2432 debug3: send_rexec_state: entering fd = 6 config len 301 debug3: ssh_msg_send: type 0 debug3: send_rexec_state: done debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: recv_rexec_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_rexec_state: done debug2: parse_server_config: config PROGRAMDATA\ssh/sshd_config len 301 debug3: PROGRAMDATA\ssh/sshd_config:23 setting SyslogFacility LOCAL0 debug3: PROGRAMDATA\ssh/sshd_config:24 setting LogLevel DEBUG3 debug3: PROGRAMDATA\ssh/sshd_config:30 setting StrictModes no debug3: PROGRAMDATA\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys debug3: PROGRAMDATA\ssh/sshd_config:76 setting Subsystem sftp sftp-server.exe debug3: checking syntax for 'Match Group administrators' debug1: sshd version OpenSSH_for_Windows_7.9, LibreSSL 2.6.5 debug3: recv_hostkeys_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_hostkeys_state: done debug3: recv_idexch_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_idexch_state: done debug2: fd 4 setting O_NONBLOCK debug3: recv_autxctx_state: entering fd = 3 debug3: ssh_msg_recv entering debug3: recv_autxctx_state: done debug2: parse_server_config: config reprocess config len 301 debug3: checking match for 'Group administrators' user dont-nod\s.meunier host 192.168.6.223 addr 192.168.6.223 laddr 192.168.12.19 lport 22 debug3: get_user_token - i am running as dont-nod\s.meunier, returning process token unable to resolve group administrators debug1: user dont-nod\s.meunier does not match group list administrators at line 84 debug3: match not found debug3: monitor_recv_keystate: entering debug3: ssh_msg_recv entering debug3: monitor_recv_keystate: done debug3: monitor_apply_keystate: packet_set_state debug2: set_newkeys: mode 0 debug1: rekey after 134217728 blocks debug2: set_newkeys: mode 1 debug1: rekey after 134217728 blocks debug1: ssh_packet_set_postauth: called debug3: ssh_packet_set_state: done debug3: monitor_recv_authopt: entering debug3: ssh_msg_recv entering debug3: monitor_recv_authopt: done debug3: notify_hostkeys: key 0: ssh-rsa SHA256:HP/gwkiMaBlG4IFNc/drYNnT9EuTsO184RYiKiTDM2U debug3: notify_hostkeys: key 1: ecdsa-sha2-nistp256 SHA256:cl1MP4kWDLFU4PglDegdfevUdvBK9Bj0T1PBR9ec6bM debug3: notify_hostkeys: key 2: ssh-ed25519 SHA256:jLbzdivh3l2/qKUxoSTEL1GD3ZQF0wKTQnFhE/xmhMM debug3: notify_hostkeys: sent 3 hostkeys debug3: send packet: type 80 debug1: active: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug1: Entering interactive session for SSH2. debug2: fd 7 setting O_NONBLOCK debug2: fd 8 setting O_NONBLOCK debug1: server_init_dispatch debug3: receive packet: type 90 debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384 debug1: input_session_request debug1: channel 0: new [server-session] debug2: session_new: allocate (allocated 0 max 10) debug3: session_unused: session id 0 unused debug1: session_new: session 0 debug1: session_open: channel 0 debug1: session_open: session 0: link with channel 0 debug1: server_input_channel_open: confirm session debug3: send packet: type 91 debug3: receive packet: type 80 debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0 debug3: receive packet: type 98 debug1: server_input_channel_req: channel 0 request pty-req reply 1 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req pty-req debug1: Allocating pty. debug3: fd 9 is not O_NONBLOCK debug3: fd 10 is not O_NONBLOCK debug1: session_pty_req: session 0 alloc windows-pty debug3: send packet: type 99 debug3: receive packet: type 98 debug1: server_input_channel_req: channel 0 request shell reply 1 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req shell Starting session: shell on windows-pty for dont-nod\s.meunier from 192.168.6.223 port 61205 id 0 debug2: fd 11 setting O_NONBLOCK debug2: fd 12 setting O_NONBLOCK debug2: fd 13 setting O_NONBLOCK debug2: fd 14 setting O_NONBLOCK debug2: fd 15 setting O_NONBLOCK debug2: fd 16 setting O_NONBLOCK Environment: USER=dont-nod\s.meunier LOGNAME=dont-nod\s.meunier HOME=C:\Users\s.meunier PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin MAIL=/var/spool/mail/dont-nod\s.meunier SHELL=c:\windows\system32\cmd.exe TERM=xterm-256color SSH_CLIENT=192.168.6.223 61205 22 SSH_CONNECTION=192.168.6.223 61205 192.168.12.19 22 SSH_TTY=windows-pty debug3: shell: "c:\windows\system32\cmd.exe" debug3: shell_option: /c debug3: This windows OS supports conpty debug3: pty commandline: C:\WINDOWS\system32\conhost.exe --headless --width 120 --height 50 --signal 0x170 -- "c:\windows\system32\cmd.exe" debug2: fd 4 setting TCP_NODELAY debug2: channel 0: rfd 13 isatty debug3: fd 13 is O_NONBLOCK debug3: fd 12 is O_NONBLOCK debug3: send packet: type 99 debug3: receive packet: type 98 debug1: server_input_channel_req: channel 0 request window-change reply 0 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req window-change

Actual output 6172 2019-06-07 17:22:35.315 debug1: inetd sockets after dupping: 3, 3 6172 2019-06-07 17:22:35.315 Connection from 192.168.6.223 port 60959 on 192.168.12.19 port 22 6172 2019-06-07 17:22:35.315 debug1: Client protocol version 2.0; client software version OpenSSH_for_Windows_7.9 6172 2019-06-07 17:22:35.315 debug1: match: OpenSSH_for_Windows_7.9 pat OpenSSH* compat 0x04000000 6172 2019-06-07 17:22:35.315 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9 6172 2019-06-07 17:22:35.315 debug2: fd 3 setting O_NONBLOCK 6172 2019-06-07 17:22:35.338 debug3: spawning "D:\Tools\OpenSSH\sshd.exe" -y 6172 2019-06-07 17:22:35.338 debug2: Network child is on pid 12864 6172 2019-06-07 17:22:35.354 debug3: send_rexec_state: entering fd = 6 config len 301 6172 2019-06-07 17:22:35.354 debug3: ssh_msg_send: type 0 6172 2019-06-07 17:22:35.354 debug3: send_rexec_state: done 6172 2019-06-07 17:22:35.354 debug3: ssh_msg_send: type 0 6172 2019-06-07 17:22:35.354 debug3: ssh_msg_send: type 0 6172 2019-06-07 17:22:35.354 debug3: preauth child monitor started 6172 2019-06-07 17:22:35.369 debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] 6172 2019-06-07 17:22:35.369 debug3: send packet: type 20 [preauth] 6172 2019-06-07 17:22:35.369 debug1: SSH2_MSG_KEXINIT sent [preauth] 6172 2019-06-07 17:22:35.369 debug3: receive packet: type 20 [preauth] 6172 2019-06-07 17:22:35.369 debug1: SSH2_MSG_KEXINIT received [preauth] 6172 2019-06-07 17:22:35.369 debug2: local server KEXINIT proposal [preauth] 6172 2019-06-07 17:22:35.369 debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1 [preauth] 6172 2019-06-07 17:22:35.369 debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] 6172 2019-06-07 17:22:35.369 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] 6172 2019-06-07 17:22:35.369 debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] 6172 2019-06-07 17:22:35.369 debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] 6172 2019-06-07 17:22:35.369 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] 6172 2019-06-07 17:22:35.369 debug2: compression ctos: none [preauth] 6172 2019-06-07 17:22:35.369 debug2: compression stoc: none [preauth] 6172 2019-06-07 17:22:35.369 debug2: languages ctos: [preauth] 6172 2019-06-07 17:22:35.369 debug2: languages stoc: [preauth] 6172 2019-06-07 17:22:35.369 debug2: first_kex_follows 0 [preauth] 6172 2019-06-07 17:22:35.369 debug2: reserved 0 [preauth] 6172 2019-06-07 17:22:35.369 debug2: peer client KEXINIT proposal [preauth] 6172 2019-06-07 17:22:35.369 debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c [preauth] 6172 2019-06-07 17:22:35.369 debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth] 6172 2019-06-07 17:22:35.369 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] 6172 2019-06-07 17:22:35.369 debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] 6172 2019-06-07 17:22:35.369 debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] 6172 2019-06-07 17:22:35.369 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] 6172 2019-06-07 17:22:35.369 debug2: compression ctos: none [preauth] 6172 2019-06-07 17:22:35.369 debug2: compression stoc: none [preauth] 6172 2019-06-07 17:22:35.369 debug2: languages ctos: [preauth] 6172 2019-06-07 17:22:35.369 debug2: languages stoc: [preauth] 6172 2019-06-07 17:22:35.369 debug2: first_kex_follows 0 [preauth] 6172 2019-06-07 17:22:35.369 debug2: reserved 0 [preauth] 6172 2019-06-07 17:22:35.369 debug1: kex: algorithm: curve25519-sha256 [preauth] 6172 2019-06-07 17:22:35.369 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth] 6172 2019-06-07 17:22:35.369 debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth] 6172 2019-06-07 17:22:35.369 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth] 6172 2019-06-07 17:22:35.369 debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] 6172 2019-06-07 17:22:35.400 debug3: receive packet: type 30 [preauth] 6172 2019-06-07 17:22:35.400 debug3: mm_sshkey_sign entering [preauth] 6172 2019-06-07 17:22:35.400 debug3: mm_request_send entering: type 6 [preauth] 6172 2019-06-07 17:22:35.400 debug3: mm_sshkey_sign: waiting for MONITOR_ANS_SIGN [preauth] 6172 2019-06-07 17:22:35.400 debug3: mm_request_receive_expect entering: type 7 [preauth] 6172 2019-06-07 17:22:35.400 debug3: mm_request_receive entering [preauth] 6172 2019-06-07 17:22:35.400 debug3: mm_request_receive entering 6172 2019-06-07 17:22:35.400 debug3: monitor_read: checking request 6 6172 2019-06-07 17:22:35.400 debug3: mm_answer_sign 6172 2019-06-07 17:22:35.400 debug3: mm_answer_sign: hostkey proof signature 000001AAD5234A30(101) 6172 2019-06-07 17:22:35.400 debug3: mm_request_send entering: type 7 6172 2019-06-07 17:22:35.400 debug2: monitor_read: 6 used once, disabling now 6172 2019-06-07 17:22:35.400 debug3: send packet: type 31 [preauth] 6172 2019-06-07 17:22:35.400 debug3: send packet: type 21 [preauth] 6172 2019-06-07 17:22:35.400 debug2: set_newkeys: mode 1 [preauth] 6172 2019-06-07 17:22:35.400 debug1: rekey after 134217728 blocks [preauth] 6172 2019-06-07 17:22:35.400 debug1: SSH2_MSG_NEWKEYS sent [preauth] 6172 2019-06-07 17:22:35.400 debug1: expecting SSH2_MSG_NEWKEYS [preauth] 6172 2019-06-07 17:22:35.400 debug3: send packet: type 7 [preauth] 6172 2019-06-07 17:22:35.420 debug3: receive packet: type 21 [preauth] 6172 2019-06-07 17:22:35.420 debug1: SSH2_MSG_NEWKEYS received [preauth] 6172 2019-06-07 17:22:35.420 debug2: set_newkeys: mode 0 [preauth] 6172 2019-06-07 17:22:35.420 debug1: rekey after 134217728 blocks [preauth] 6172 2019-06-07 17:22:35.420 debug1: KEX done [preauth] 6172 2019-06-07 17:22:35.482 debug3: receive packet: type 5 [preauth] 6172 2019-06-07 17:22:35.482 debug3: send packet: type 6 [preauth] 6172 2019-06-07 17:22:35.482 debug3: receive packet: type 50 [preauth] 6172 2019-06-07 17:22:35.482 debug1: userauth-request for user s.meunier service ssh-connection method none [preauth] 6172 2019-06-07 17:22:35.482 debug1: attempt 0 failures 0 [preauth] 6172 2019-06-07 17:22:35.482 debug3: mm_getpwnamallow entering [preauth] 6172 2019-06-07 17:22:35.482 debug3: mm_request_send entering: type 8 [preauth] 6172 2019-06-07 17:22:35.482 debug3: mm_getpwnamallow: waiting for MONITOR_ANS_PWNAM [preauth] 6172 2019-06-07 17:22:35.482 debug3: mm_request_receive_expect entering: type 9 [preauth] 6172 2019-06-07 17:22:35.482 debug3: mm_request_receive entering [preauth] 6172 2019-06-07 17:22:35.482 debug3: mm_request_receive entering 6172 2019-06-07 17:22:35.482 debug3: monitor_read: checking request 8 6172 2019-06-07 17:22:35.482 debug3: mm_answer_pwnamallow 6172 2019-06-07 17:22:35.482 debug2: parse_server_config: config reprocess config len 301 6172 2019-06-07 17:22:35.482 debug3: checking match for 'Group administrators' user dont-nod\s.meunier host 192.168.6.223 addr 192.168.6.223 laddr 192.168.12.19 lport 22 6172 2019-06-07 17:22:35.593 debug3: lookup_principal_name: Successfully discovered explicit principal name: 'dont-nod\s.meunier'=>'s.meunier@dont-nod.lan' 6172 2019-06-07 17:22:35.608 debug1: generate_s4u_user_token: LsaLogonUser() failed. User 'dont-nod\s.meunier' Status: 0xC000006D SubStatus 0. 6172 2019-06-07 17:22:35.608 debug3: get_user_token - unable to generate token for user dont-nod\s.meunier 6172 2019-06-07 17:22:37.874 debug3: lookup_principal_name: Successfully discovered explicit principal name: 'dont-nod\s.meunier'=>'s.meunier@dont-nod.lan' 6172 2019-06-07 17:22:37.874 debug1: generate_s4u_user_token: LsaLogonUser() failed. User 'dont-nod\s.meunier' Status: 0xC000006D SubStatus 0. 6172 2019-06-07 17:22:37.874 error: get_user_token - unable to generate token on 2nd attempt for user dont-nod\s.meunier 6172 2019-06-07 17:22:37.874 fatal: ga_init, unable to resolve user dont-nod\s.meunier 6172 2019-06-07 17:22:37.874 debug1: do_cleanup 6172 2019-06-07 17:22:37.874 debug1: Killing privsep child 12864

closed time in 3 hours

meuns

issue commentPowerShell/vscode-powershell

Indent in Pester It Statement with curly braces is confused

Thanks @fromthewoods this looks likes a duplicate of https://github.com/PowerShell/PSScriptAnalyzer/issues/1496

fromthewoods

comment created time in 3 hours

issue closedPowerShell/Win32-OpenSSH

Cannot login with SSH-KEY

v7.9.0.0p1

Windows 2012 R2

Issue I am obtaining a key from Sucuri to paste inside the ~/.ssh/authorized_keys file. After doing this the Sucuri SFTP does not connect. The host name, FTP username, and Port are all correct. Any steps to try to ensure that I can connect via SSH-KEY? I am able to connect to the same user just through normal SFTP with user authentication in Windows.

Expected output Connection through SSH-KEY.

Actual output Cannot connect.

closed time in 4 hours

bobi33

issue commentPowerShell/Win32-OpenSSH

GSSAPI auth not working

Please look at the response from nomorefood, if there are more issues, please reopen

blakeduffey

comment created time in 4 hours

issue commentPowerShell/vscode-powershell

powershell.codeFormatting.pipelineIndentationStyle is ignored when formatting code

Thanks @SetTrend this looks like a duplicate of https://github.com/PowerShell/PSScriptAnalyzer/issues/1496

SetTrend

comment created time in 4 hours

issue closedPowerShell/Win32-OpenSSH

GSSAPI auth not working

I have installed 7.9.0.0p1-beta on a domain joined Windows 2016 server. I've made a copy of sshd_config_default (named sshd_config). In sshd_config I've uncommented the line GSSAPIAuthentication and changed 'no' to 'yes'.

I have then installed and started the service. I can connect to ssh (from a remote machine, also domain joined) and connect via name/password, but GSSAPI isn't working. I'm simply prompted for a password when I connect. I have the same behavior when running sshd.exe in debug mode. I've tried putty and the same version of OpenSSH client.

I'd appreciate any thoughts on what I'm missing. We use Kerberos to connect to sshd on linux (so I'm pretty familiar with the process) and have no issues overall.

closed time in 4 hours

blakeduffey

pull request commentPowerShell/PowerShell

Add -is $null and -isnot $null support to operators and Where-Object

I know this has already been discussed, but I want to register that I'm worried about a cmdlet having a different behaviour between the $null literal and another variable that is null. At runtime, my feeling is that the behaviour around a value should not depend on the syntax used to create it. I think that introduces complexity in both implementation and understanding and hurts our separations of concern between the parser and the PowerShell runtime.

This PR does great work, and I think the addition of -is $null makes sense both because of the .NET concepts at work and also to alleviate the pain of -eq $null. But I think we should design very carefully around:

  • -is $null vs -is $variableThatIsNull vs -is $uninstantiatedVariable -- in particular I'm not sure of anywhere else in PowerShell where accessing a variable (in $ form) is different in those three scenarios
  • -is $null vs Where-Object -is $null (vs Where-Object -IsNull)

I'm not sure I fully agree that the breaking change that the literal $null behaviour differentiation was intended to avoid is something we have considered to be breaking in the past (for example, a similar breakage could be claimed by defining most command names). I definitely understand the scenario there though, and I think it's a valuable point.

As I say, I think -is $null is a great addition. My concern is only that differentiating the $null literal from a null value puts a corner case into PowerShell that may not belong there.

I just want to make these points in writing so that maintainers or the @PowerShell/powershell-committee can review the design carefully.

KirkMunro

comment created time in 4 hours

pull request commentPowerShell/PowerShell

Add parameter `SchemaFile` to `Test-Json` cmdlet

@beatcracker Thank you for your contribution!

beatcracker

comment created time in 4 hours

push eventPowerShell/PowerShell

beatcracker

commit sha c22ccbebd2955ff67c03574ec26d252955e8ea6d

Add parameter `SchemaFile` to `Test-Json` cmdlet (#11934)

view details

push time in 4 hours

PR merged PowerShell/PowerShell

Add parameter `SchemaFile` to `Test-Json` cmdlet CL-General

PR Summary

Add parameter SchemaFile to the Test-Json cmdlet.

PR Context

Current implementation allows JSON schema to be only passed as string. This makes it impossible to validate JSON files against the schema that includes definitions from separate files: https://json-schema.org/understanding-json-schema/structuring.html#reuse

{ "$ref": "definitions.json#/address" }

The new parameter accepts literal path to the JSON schema file and allows JSON files to be validated against such schemas.

Notes

  1. I don't have much experience with C#, so please, bear with me.
  2. ~This PR currently lacks tests. I think that I need to extend Test-Json.Tests.ps1, but I'm not sure where to put JSON schema files with includes. Would assets folder be ok?~
  3. @iSazonov is the author of the original Test-Json implementation and there is #11397 that should be taken into account.

PR Checklist

+197 -27

33 comments

7 changed files

beatcracker

pr closed time in 4 hours

startedPowerShell/PowerShell

started time in 4 hours

startedPowerShell/PowerShell

started time in 4 hours

startedPowerShell/PowerShellStandard

started time in 4 hours

PR closed PowerShell/vscode-powershell

Create main.yml

PR Summary

<!-- summarize your PR between here and the checklist -->

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets. Please mark anything not applicable to this PR NA.

  • [x] PR has a meaningful title
  • [x] Summarized changes
  • [x] PR has tests
  • [x] This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready
+33 -0

3 comments

1 changed file

ansco

pr closed time in 4 hours

pull request commentPowerShell/vscode-powershell

Create main.yml

Going to close this until we know more about the intent of the PR. @ansco please feel free to update your PR description and reopen the PR when you feel it's ready to be looked at

ansco

comment created time in 4 hours

Pull request review commentPowerShell/PSScriptAnalyzer

Pester v5

 Describe "Test -EnableExit Switch" {     }      # using statements are only supported in v5+-    if (!$testingLibraryUsage -and ($PSVersionTable.PSVersion -ge [Version]'5.0.0')) {-        Describe "Handles parse errors due to unknown types" {+    Describe "Handles parse errors due to unknown types" -Skip:($testingLibraryUsage -or ($PSVersionTable.PSVersion -lt [Version]'5.0.0')) {

The -lt here should coerce the string on the RHS to be a version without the type

bergmeister

comment created time in 5 hours

Pull request review commentPowerShell/PSScriptAnalyzer

Pester v5

 Describe "Test importing customized rules with null return results" {  Describe "Test importing correct customized rules" { -	if(-not $IsCoreCLR)-	{-		Context "Test Get-Help functionality in ScriptRule parsing logic" {-			It "ScriptRule help section must be correctly processed when Get-Help is called for the first time" {--				# Force Get-Help to prompt for interactive input to download help using Update-Help-				# By removing this registry key we force to turn on Get-Help interactivity logic during ScriptRule parsing-				$null,"Wow6432Node" | ForEach-Object {-					try-					{-						Remove-ItemProperty -Name "DisablePromptToUpdateHelp" -Path "HKLM:\SOFTWARE\$($_)\Microsoft\PowerShell" -ErrorAction Stop-					} catch {-						#Ignore for cases when tests are running in non-elevated more or registry key does not exist or not accessible-					}+	# if(-not ([bool] $IsCoreCLR))+	# {

This looks like it might need to be removed

bergmeister

comment created time in 4 hours

Pull request review commentPowerShell/PSScriptAnalyzer

Pester v5

 Describe "Test -EnableExit Switch" {     }      # using statements are only supported in v5+-    if (!$testingLibraryUsage -and ($PSVersionTable.PSVersion -ge [Version]'5.0.0')) {-        Describe "Handles parse errors due to unknown types" {+    Describe "Handles parse errors due to unknown types" -Skip:($testingLibraryUsage -or ($PSVersionTable.PSVersion -lt [Version]'5.0.0')) {+        BeforeAll {             $script = @'                 using namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels                 using namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions                 Import-Module "AzureRm"                 class MyClass { [IStorageContext]$StorageContext } # This will result in a parser error due to [IStorageContext] type that comes from the using statement but is not known at parse time '@-            It "does not throw and detect one expected warning after the parse error has occured when using -ScriptDefintion parameter set" {-                $warnings = Invoke-ScriptAnalyzer -ScriptDefinition $script-                $warnings.Count | Should -Be 1-                $warnings.RuleName | Should -Be 'TypeNotFound'-            }+        }+        It "does not throw and detect one expected warning after the parse error has occured when using -ScriptDefintion parameter set" {+            $warnings = Invoke-ScriptAnalyzer -ScriptDefinition $script+            $warnings.Count | Should -Be 1+            $warnings.RuleName | Should -Be 'TypeNotFound'+        } +        It "does not throw and detect one expected warning after the parse error has occured when using -Path parameter set" {             $testFilePath = "TestDrive:\testfile.ps1"-            Set-Content $testFilePath -value $script-            It "does not throw and detect one expected warning after the parse error has occured when using -Path parameter set" {-                $warnings = Invoke-ScriptAnalyzer -Path $testFilePath-                $warnings.Count | Should -Be 1-                $warnings.RuleName | Should -Be 'TypeNotFound'-            }+            Set-Content $testFilePath -Value $script+            $warnings = Invoke-ScriptAnalyzer -Path $testFilePath+            $warnings.Count | Should -Be 1+            $warnings.RuleName | Should -Be 'TypeNotFound'         }+    } -        Describe "Handles static Singleton (issue 1182)" {-            It "Does not throw or return diagnostic record" {-                $scriptDefinition = 'class T { static [T]$i }; function foo { [CmdletBinding()] param () $script:T.WriteLog() }'-                Invoke-ScriptAnalyzer -ScriptDefinition $scriptDefinition -ErrorAction Stop | Should -BeNullOrEmpty-            }+    Describe "Handles static Singleton (issue 1182)"-Skip:($testingLibraryUsage -or ($PSVersionTable.PSVersion -lt [Version]'5.0.0')) {
    Describe "Handles static Singleton (issue 1182)" -Skip:($testingLibraryUsage -or ($PSVersionTable.PSVersion -lt [Version]'5.0.0')) {
bergmeister

comment created time in 5 hours

Pull request review commentPowerShell/PSScriptAnalyzer

Pester v5

 Describe "Test importing correct customized rules" {             $violations[0].RuleSuppressionID   | Should -Be "MyRuleSuppressionID"         } -        if (!$testingLibraryUsage)-		{+        # if (!$testingLibraryUsage)+		# {

Should this still be here?

bergmeister

comment created time in 5 hours

Pull request review commentPowerShell/PSScriptAnalyzer

Pester v5

 Describe "PowerShell version object" {             $v.Patch | Should -Be $Patch             $v.PreReleaseLabel | Should -BeExactly $Label             $v.BuildLabel | Should -Be $BuildLabel-        }+        } -TestCases @(

This is an interesting version of the inline -TestCases parameter, vs the one I've seen in the PowerShell repo where the cases come before the test (like with xUnit theories)

bergmeister

comment created time in 5 hours

Pull request review commentPowerShell/PSScriptAnalyzer

Pester v5

 Describe "Test ExcludeRule" {     }      Context "Support wild card" {-        It "supports wild card exclusions of input rules"{-            $excludeWildCard = Invoke-ScriptAnalyzer $PSScriptRoot\..\Rules\BadCmdlet.ps1 -ExcludeRule $avoidRules | Where-Object {$_.RuleName -match $avoidRules}+        It "supports wild card exclusions of input rules" {+            $excludeWildCard = Invoke-ScriptAnalyzer $PSScriptRoot\..\Rules\BadCmdlet.ps1 -ExcludeRule $avoidRules | Where-Object { $_.RuleName -match $avoidRules }         }     }- }  Describe "Test IncludeRule" {     Context "When used correctly" {         It "includes 1 rule" {-            $violations = Invoke-ScriptAnalyzer $PSScriptRoot\..\Rules\BadCmdlet.ps1 -IncludeRule $approvedVerb | Where-Object {$_.RuleName -eq $approvedVerb}+            $violations = Invoke-ScriptAnalyzer $PSScriptRoot\..\Rules\BadCmdlet.ps1 -IncludeRule $approvedVerb | Where-Object { $_.RuleName -eq $approvedVerb }             $violations.Count | Should -Be 1         }          It "includes the given rules" {             # CoreCLR version of PSScriptAnalyzer does not contain PSUseSingularNouns rule             $expectedNumViolations = 2-            if ($IsCoreCLR)+            if ([bool] $IsCoreCLR)

Is this needed? I think this coercion happens under the hood without the type

bergmeister

comment created time in 5 hours

issue commentPowerShell/PowerShell

Add support for extension methods (LINQ)

I was thinking about it, and in my module I store the IQueryable internally and let you build off of it and it's disposed when Start is run or New is re-run. Another way to write this that would be more PowerShell Friendly is this:

$Results = New-EFPoshQuery -Object $ObjectToQuery |
Add-EFPoshQuery -Property '<TabComplete list of properties>' -Equals 'Value' -And |
Add-EFPoshQuery -Property '<TabComplete list of properties>' -GreaterThan 5 -Or |
Add-EFPoshQuery -Property '<TabComplete list of properties>' -Contains @('Array') |
Start-EFPoshQuery -ToList -Distinct

So return the IQueryable and pipe it to the next command. That's more Poshey and allows you to write the query on multiple lines.

vors

comment created time in 4 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;+                try+                {+                    // Switch to typename mode to avoid aggressive argument tokenization.+                    SetTokenizerMode(TokenizerMode.TypeName);++                    SkipNewlines();+                    Token firstToken = NextToken();+                    if (firstToken.Kind != TokenKind.Number+                        && (firstToken.Kind == TokenKind.Identifier || firstToken.Kind == TokenKind.LBracket))+                    {+                        resyncIndex = -1;+                        genericTypes = GenericArgumentsRule(firstToken, false, out rBracketToken);++                        if (rBracketToken.Kind != TokenKind.RBracket)+                        {+                            UngetToken(rBracketToken);+                            ReportIncompleteInput(

Absolutely! Not sure how to test for this, though. 😅

vexx32

comment created time in 4 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ITypeName GenericTypeArgumentsRule(Token genericTypeName, Token firstTok                 }                 else                 {-                    ReportIncompleteInput(After(commaOrRBracketToken),+                    ReportIncompleteInput(+                        After(lastToken),                         nameof(ParserStrings.MissingTypename),                         ParserStrings.MissingTypename);-                    typeName = new TypeName(commaOrRBracketToken.Extent, ":ErrorTypeName:");+                    typeName = new TypeName(lastToken.Extent, ":ErrorTypeName:");                 }                  genericArguments.Add(typeName);             } -            if (commaOrRBracketToken.Kind != TokenKind.RBracket)+            return genericArguments;+        }++        private ITypeName GenericTypeArgumentsRule(Token genericTypeName, Token firstToken, bool unBracketedGenericArg)

The first should probably be GenericMethodArgumentsRule, but I'll double check.

vexx32

comment created time in 4 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;+                try+                {+                    // Switch to typename mode to avoid aggressive argument tokenization.+                    SetTokenizerMode(TokenizerMode.TypeName);++                    SkipNewlines();+                    Token firstToken = NextToken();+                    if (firstToken.Kind != TokenKind.Number+                        && (firstToken.Kind == TokenKind.Identifier || firstToken.Kind == TokenKind.LBracket))

So I could be misremembering, but I think Identifier includes Number (it's a named flag combination, if I recall correctly?)

Will have to look back over this code to answer your other point. 🙂

vexx32

comment created time in 4 hours

issue commentPowerShell/PowerShell

Add support for extension methods (LINQ)

I recently wrote a module (EFPosh) that exposes Linq functionality through cmdlets in a PowerShell-friendly way I think. I wanted to post it here and see what people thought.

Instead of trying to figure out how to write the Func delegates in PowerShell using .Net methods, I decided to handle that on the backend and expose query functionality through these commands:

New-EFPoshQuery Start-EFPoshQuery Add-EFPoshQuery

A query would go like this (pseudo-code as I wrote this for EntityFramework):

New-EFPoshQuery -Object $ObjectToQuery
Add-EFPoshQuery -Property '<TabComplete list of properties>' -Equals 'Value' -And
Add-EFPoshQuery -Property '<TabComplete list of properties>' -GreaterThan 5 -Or
Add-EFPoshQuery -Property '<TabComplete list of properties>' -Contains @('Array')
Start-EFPoshQuery -ToList -Distinct

The idea is once New-EFPoshQuery is executed, tab complete works for Add-EFPoshQuery through ArgumentCompletors. This way the syntax works from the command line and through a script.

It's a little weird to think about not executing the query in the line you start it, but deferred execution is an IQueryable idea that can come to PowerShell also!

On the back end I'm using the DynamicLinq library but that is more out of wanting to get something out the door rather than a necessity. It wouldn't be difficult (and might be easier) to build the delegates without a 3rd-party library.

Here's the code if you want to see what I'm doing:

https://github.com/Ryan2065/EFPosh/tree/master/src/Module/EFPosh/Commands

vors

comment created time in 4 hours

issue commentPowerShell/PowerShell

Older/other versions of pwsh are not cleaned up during upgrade to 7.0.0 or manual uninstallation.

Windows PowerShell is also a CBS component and likely can't be replaced by pwsh. Any files overwritten - even if allowed (probably not because of TrustedInstaller) - would be replaced automatically very quickly after (the latter is how SFC worked in older versions of Windows, IIRC).

pminnebach

comment created time in 5 hours

issue commentPowerShell/PowerShell

Update HelpInfoUri for all modules for v7 release

We have help but there may be a problem with the file naming that prevents Update-Help from working for ThreadJob. This will be fixed in the new publishing pipeline.

sdwheeler

comment created time in 5 hours

issue openedPowerShell/PSReadLine

Windows PowerShell bug last 200 keys

r g u m e n t s ) , " s l i c e " , k . c a l l ( a r g u m e n t s ) . j o i n ( " , " ) ) } , m a p : f u n c t i o n ( a ) { r e t u r n Space t h i s . p u s h S t a c k ( p . m a p ( t h i s , f u n c t i o n ( b , c ) { r e t u r n Space a . c a l l ( b , c , b ) } ) ) } , e n d : f u n c t i o n ( ) { r e t u r n Space t h i s . p r e v O b j e c t | | t h i s . c o n s t r u c t o r ( n u l l ) } , p

created time in 5 hours

Pull request review commentPowerShell/PowerShell

Enable using proxy credentials in web cmdlets without specifying a proxy

 internal virtual void ValidateParameters()                 ThrowTerminatingError(error);             } -            // Proxy server-            if (ProxyUseDefaultCredentials && (ProxyCredential != null))-            {-                ErrorRecord error = GetValidationError(WebCmdletStrings.ProxyCredentialConflict,-                                                       "WebCmdletProxyCredentialConflictException");-                ThrowTerminatingError(error);

What happened to this error?

iSazonov

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Enable using proxy credentials in web cmdlets without specifying a proxy

 Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {         $result.Output.Content | Should -BeExactly $expectedResult.Output.Content     } +    It "Invoke-WebRequest accepts '-ProxyUseDefaultCredentials' parameter" {+        { Invoke-WebRequest -Uri http://httpbin.org -ProxyUseDefaultCredentials } | Should -Not -Throw

Don't use off box resources

iSazonov

comment created time in 5 hours

issue openedPowerShell/PSReadLine

powershell bug last 200 keys

u l l " ; c a s e " b o o l e a n " : c a s e " n u l l " : r e t u r n Space S t r i n g ( o ) ; c a s e " o b j e c t " : i f ( ! o ) r e t u r n " n u l l " ; n + = u , s = [ ] ; i f ( O b j e c t . p r o t o t y p e . t o S t r i n g . a p p l y ( o ) = = = " [ o b j e c t Space A r r a y ] " ) { f o r ( a = o . l e n g t h , h = 0 ; h < a ; h + = 1 ) s [ h ] = r ( h , o ) | | " n u l l " ; r e t u r

created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;+                try+                {+                    // Switch to typename mode to avoid aggressive argument tokenization.+                    SetTokenizerMode(TokenizerMode.TypeName);++                    SkipNewlines();+                    Token firstToken = NextToken();+                    if (firstToken.Kind != TokenKind.Number+                        && (firstToken.Kind == TokenKind.Identifier || firstToken.Kind == TokenKind.LBracket))

If we can identify some variations on the logic here, we should ideally add tests for each possibility so that we have a strong understanding of the behaviour here

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;+                try+                {+                    // Switch to typename mode to avoid aggressive argument tokenization.+                    SetTokenizerMode(TokenizerMode.TypeName);++                    SkipNewlines();+                    Token firstToken = NextToken();+                    if (firstToken.Kind != TokenKind.Number+                        && (firstToken.Kind == TokenKind.Identifier || firstToken.Kind == TokenKind.LBracket))+                    {+                        resyncIndex = -1;+                        genericTypes = GenericArgumentsRule(firstToken, false, out rBracketToken);

Please label the false parameter

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)

If you invert this condition, we can dispense with an indentation level. If we call NextToken() and the next token is not an LBracket, it sounds like we might need to return the token and indicate that this method does not apply?

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;+                try+                {+                    // Switch to typename mode to avoid aggressive argument tokenization.+                    SetTokenizerMode(TokenizerMode.TypeName);++                    SkipNewlines();+                    Token firstToken = NextToken();+                    if (firstToken.Kind != TokenKind.Number+                        && (firstToken.Kind == TokenKind.Identifier || firstToken.Kind == TokenKind.LBracket))+                    {+                        resyncIndex = -1;+                        genericTypes = GenericArgumentsRule(firstToken, false, out rBracketToken);++                        if (rBracketToken.Kind != TokenKind.RBracket)+                        {+                            UngetToken(rBracketToken);+                            ReportIncompleteInput(

If we can, we should test for this case

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 public MemberExpressionAst(IScriptExtent extent, ExpressionAst expression, Comma         /// </summary>         public bool NullConditional { get; protected set; } +        /// <summary>+        /// List of generic type arguments passed to this member.+        /// </summary>+        public ReadOnlyCollection<ITypeName> GenericTypeArguments { get; private set; }

Is the private setter used anywhere?

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ITypeName GenericTypeArgumentsRule(Token genericTypeName, Token firstTok                 }                 else                 {-                    ReportIncompleteInput(After(commaOrRBracketToken),+                    ReportIncompleteInput(+                        After(lastToken),                         nameof(ParserStrings.MissingTypename),                         ParserStrings.MissingTypename);-                    typeName = new TypeName(commaOrRBracketToken.Extent, ":ErrorTypeName:");+                    typeName = new TypeName(lastToken.Extent, ":ErrorTypeName:");                 }                  genericArguments.Add(typeName);             } -            if (commaOrRBracketToken.Kind != TokenKind.RBracket)+            return genericArguments;+        }++        private ITypeName GenericTypeArgumentsRule(Token genericTypeName, Token firstToken, bool unBracketedGenericArg)

Given that we're breaking these methods out into separate pieces, we should try to rename them to refer to exactly what they parse. I'm not clear on the difference between GenericArgumentsRule and GenericTypeArgumentsRule

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;+                try+                {+                    // Switch to typename mode to avoid aggressive argument tokenization.+                    SetTokenizerMode(TokenizerMode.TypeName);++                    SkipNewlines();+                    Token firstToken = NextToken();+                    if (firstToken.Kind != TokenKind.Number+                        && (firstToken.Kind == TokenKind.Identifier || firstToken.Kind == TokenKind.LBracket))

The logic here seems to test that the token kind is not one thing and then is one of two others. The second conditions should preclude the first, no?

One question is what unexpected tokens do here and how we signal that to the caller

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorT                 member = GetSingleCommandArgument(CommandArgumentContext.CommandArgument) ??                     new ErrorExpressionAst(ExtentOf(targetExpr, operatorToken));             }-            else+            // Member name may be an incomplete token like `$a.$(Command-Name`; do not look for generic args or+            // invocation token(s) if the member name token is recognisably incomplete.+            else if (_ungotToken == null)             {+                genericTypeArguments = GenericMethodTypeArgumentsRule(out rBracket);                 Token lParen = NextInvokeMemberToken();+                 if (lParen != null)                 {+                    // Fall through to the last available token expected in a member name for calculating the expected+                    // position of the lParen. This accounts for things like `[Array]::Empty[int[]()` so that we don't+                    // get unhandled behaviour when input is expected but incomplete.+                    int endColumnNumber = rBracket?.Extent?.EndColumnNumber+                        ?? genericTypeArguments?.LastOrDefault()?.Extent?.EndColumnNumber+                        ?? member.Extent.EndColumnNumber;+                     Diagnostics.Assert(lParen.Kind == TokenKind.LParen || lParen.Kind == TokenKind.LCurly, "token kind incorrect");-                    Diagnostics.Assert(member.Extent.EndColumnNumber == lParen.Extent.StartColumnNumber,-                                       "member and paren must be adjacent");-                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member);+                    Diagnostics.Assert(+                        endColumnNumber == lParen.Extent.StartColumnNumber,+                        "member and paren must be adjacent when the method is not generic");+                    return MemberInvokeRule(targetExpr, lParen, operatorToken, member, genericTypeArguments);                 }             }              return new MemberExpressionAst(-                    ExtentOf(targetExpr, member),-                    targetExpr,-                    member,-                    @static: operatorToken.Kind == TokenKind.ColonColon,-                    nullConditional: operatorToken.Kind == TokenKind.QuestionDot);+                ExtentOf(targetExpr, member),+                targetExpr,+                member,+                @static: operatorToken.Kind == TokenKind.ColonColon,+                nullConditional: operatorToken.Kind == TokenKind.QuestionDot,+                genericTypeArguments);+        }++        private List<ITypeName> GenericMethodTypeArgumentsRule(out Token rBracketToken)+        {+            List<ITypeName> genericTypes = null;++            int resyncIndex = _tokenizer.GetRestorePoint();+            Token lBracket = NextToken();+            rBracketToken = null;++            if (lBracket.Kind == TokenKind.LBracket)+            {+                // This is either a member expression with generic type arguments, or some sort of collection index+                // on a property.+                var oldTokenizerMode = _tokenizer.Mode;

Please use explicit type here

vexx32

comment created time in 5 hours

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 public override int GetHashCode()                  result = result * 397 + (MethodTargetType != null ? MethodTargetType.GetHashCode() : 0);                 result = result * 397 + ParameterTypes.SequenceGetHashCode();+                result = result * 397 + GenericTypeParameters.SequenceGetHashCode();

At some point we should do the work to convert over to using System.HashCode.Combine everywhere

vexx32

comment created time in a day

Pull request review commentPowerShell/PowerShell

Add support for supplying generic method type parameters

 public object VisitMemberExpression(MemberExpressionAst memberExpressionAst)          internal static PSMethodInvocationConstraints GetInvokeMemberConstraints(InvokeMemberExpressionAst invokeMemberExpressionAst)         {-            var arguments = invokeMemberExpressionAst.Arguments;+            var arguments = invokeMemberExpressionAst.Arguments+                ?.Select(Compiler.GetTypeConstraintForMethodResolution)+                .ToArray();

I know there are other places where we seem to use LINQ in the compiler, but I'd personally prefer that we not, since we really want to minimise any allocations/performance burdens

vexx32

comment created time in a day

pull request commentPowerShell/PowerShell

Add IgnoreNullValue switch on ConvertTo-Json

I don't see any new comments from MSFT team in #11198. Do you mean we can merge #11198 and then add the new switch in follow PR?

That PR was approved by the committee

mdalepiane

comment created time in 5 hours

push eventPowerShell/PowerShell

xtqqczze

commit sha b03b968d0a3709a22509fbd01df1f595685de626

Restore `markdownlint` tests (#12549) Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>

view details

push time in 5 hours

PR merged PowerShell/PowerShell

Reviewers
Restore `markdownlint` tests CL-Test Waiting on Author

PR Summary

Fix #12539

PR Context

markdownlint tests were removed in #10163 due to a security issue whoch has since been fixed in a newer version of markdownlint

PR Checklist

+2574 -46

18 comments

14 changed files

xtqqczze

pr closed time in 5 hours

issue closedPowerShell/PowerShell

Restore markdownlint tests

markdownlint tests were removed in #10163 due to a security issue in a dependancy (CVE-2019-10746).

According to snyk, markdownlint has no currently known vulnerabilities, so we should restore these tests.

closed time in 5 hours

xtqqczze
more