Skip to content

Commit

Permalink
Merge branch 'PowerShell:master' into Rename-TimeoutSec-to-ConnectTim…
Browse files Browse the repository at this point in the history
…eoutSec-and-alias-to-TimeoutSec-and-add-NetworkTimeoutSec-timeout
  • Loading branch information
stevenebutler committed Jun 6, 2023
2 parents 6b80bf0 + 9e7cb72 commit 53ae00d
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 62 deletions.
13 changes: 13 additions & 0 deletions .vsts-ci/windows/templates/windows-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
Build_Repository_Uri: $(build.repository.uri)
displayName: SBOM
sourceScanPath: '$(repoPath)\tools'
signSBOM: false

# This is needed as SBOM task removed the installed .NET and installs .NET 3.1
- pwsh: |
Expand All @@ -79,6 +80,18 @@ jobs:
condition: succeeded()
workingDirectory: $(repoPath)
- pwsh: |
$manifestFolder = Join-Path -Path '$(System.ArtifactsDirectory)/mainBuild' -ChildPath '_manifest'
if (-not (Test-Path $manifestFolder)) {
throw "_manifest folder does not exist under $(System.ArtifactsDirectory)/mainBuild"
}
$null = New-Item -Path "$manifestFolder/spdx_2.2/bsi.json" -Verbose -Force
$null = New-Item -Path "$manifestFolder/spdx_2.2/manifest.cat" -Verbose -Force
displayName: Create fake SBOM manifest signed files
- pwsh: |
Import-Module .\tools\ci.psm1
New-CodeCoverageAndTestPackage
Expand Down
8 changes: 0 additions & 8 deletions PowerShell.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@
<DebugType>full</DebugType>
</PropertyGroup>

<!-- Define non-windows, release configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' != 'true' ">
<!-- Set-Date fails with optimize enabled in NonWindowsSetDate
Debugging the issues resolves the problem
-->
<Optimize>false</Optimize>
</PropertyGroup>

<PropertyGroup>
<Features>strict</Features>
</PropertyGroup>
Expand Down
99 changes: 76 additions & 23 deletions ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,9 @@ SOFTWARE.

---------------------------------------------------------

Microsoft.CodeAnalysis.Common 4.5.0 - MIT
Microsoft.CodeAnalysis.Common 4.6.0 - MIT


(c) Microsoft Corporation
Copyright (c) .NET Foundation and Contributors

MIT License

Expand All @@ -378,13 +376,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

---------------------------------------------------------

Microsoft.CodeAnalysis.CSharp 4.5.0 - MIT
Microsoft.CodeAnalysis.CSharp 4.6.0 - MIT


(c) Microsoft Corporation
Copyright (c) Microsoft Corporation
Copyright (c) .NET Foundation and Contributors
Copyright (c) Microsoft Corporation. Alle Rechte

MIT License

Expand Down Expand Up @@ -1446,45 +1440,56 @@ SOFTWARE.

---------------------------------------------------------

System.Collections.Immutable 6.0.0 - MIT
System.Collections.Immutable 7.0.0 - MIT


(c) Microsoft Corporation.
(c) Microsoft Corporation
Copyright (c) Andrew Arnott
Copyright 2019 LLVM Project
Copyright 2018 Daniel Lemire
Copyright 2012 the V8 project
Copyright (c) .NET Foundation.
Copyright (c) .NET Foundation
Copyright (c) 2011, Google Inc.
Copyright (c) 2020 Dan Shechter
(c) 1997-2005 Sean Eron Anderson
Copyright (c) 1998 Microsoft. To
(c) 1997-2005 Sean Eron Anderson.
Copyright (c) 2017 Yoshifumi Kawai
Copyright (c) 2005-2020 Rich Felker
Copyright (c) Microsoft Corporation
Copyright (c) 2007 James Newton-King
Copyright (c) 2012-2014, Yann Collet
Copyright (c) 1991-2022 Unicode, Inc.
Copyright (c) 2013-2017, Alfred Klomp
Copyright 2012 the V8 project authors
Copyright (c) 1999 Lucent Technologies
Copyright (c) 2008-2016, Wojciech Mula
Copyright (c) 2011-2020 Microsoft Corp
Copyright (c) 2015-2017, Wojciech Mula
Copyright (c) 2021 csFastFloat authors
Copyright (c) 2005-2007, Nick Galbreath
Copyright (c) 2015 The Chromium Authors
Copyright (c) 2018 Alexander Chermyanin
Copyright (c) The Internet Society 1997
Portions (c) International Organization
Copyright (c) 2015 The Chromium Authors.
Copyright (c) The Internet Society 1997.
Copyright (c) 2004-2006 Intel Corporation
Copyright (c) 2013-2017, Milosz Krajewski
Copyright (c) 2016-2017, Matthieu Darbois
Copyright (c) The Internet Society (2003)
Copyright (c) .NET Foundation Contributors
Copyright (c) The Internet Society (2003).
Copyright (c) 2020 Mara Bos <m-ou.se@m-ou.se>
Copyright (c) .NET Foundation and Contributors
Copyright (c) 2008-2020 Advanced Micro Devices, Inc.
Copyright (c) 2019 Microsoft Corporation, Daan Leijen
Copyright (c) 2011 Novell, Inc (http://www.novell.com)
Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler
Copyright (c) 1995-2022 Jean-loup Gailly and Mark Adler
Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors
Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com
Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California.
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass.
Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers
Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip
Copyright (c) 1980, 1986, 1993 The Regents of the University of California
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To

The MIT License (MIT)
Expand Down Expand Up @@ -3163,9 +3168,57 @@ SOFTWARE.

---------------------------------------------------------

System.Reflection.Metadata 6.0.1 - MIT
System.Reflection.Metadata 7.0.0 - MIT


(c) Microsoft Corporation
Copyright (c) Andrew Arnott
Copyright 2019 LLVM Project
Copyright 2018 Daniel Lemire
Copyright (c) .NET Foundation
Copyright (c) 2011, Google Inc.
Copyright (c) 2020 Dan Shechter
(c) 1997-2005 Sean Eron Anderson
Copyright (c) 1998 Microsoft. To
Copyright (c) 2017 Yoshifumi Kawai
Copyright (c) 2005-2020 Rich Felker
Copyright (c) Microsoft Corporation
Copyright (c) 2007 James Newton-King
Copyright (c) 2012-2014, Yann Collet
Copyright (c) 1991-2022 Unicode, Inc.
Copyright (c) 2013-2017, Alfred Klomp
Copyright 2012 the V8 project authors
Copyright (c) 1999 Lucent Technologies
Copyright (c) 2008-2016, Wojciech Mula
Copyright (c) 2011-2020 Microsoft Corp
Copyright (c) 2015-2017, Wojciech Mula
Copyright (c) 2021 csFastFloat authors
Copyright (c) 2005-2007, Nick Galbreath
Copyright (c) 2015 The Chromium Authors
Copyright (c) 2018 Alexander Chermyanin
Copyright (c) The Internet Society 1997
Portions (c) International Organization
Copyright (c) 2004-2006 Intel Corporation
Copyright (c) 2013-2017, Milosz Krajewski
Copyright (c) 2016-2017, Matthieu Darbois
Copyright (c) The Internet Society (2003)
Copyright (c) .NET Foundation Contributors
Copyright (c) 2020 Mara Bos <m-ou.se@m-ou.se>
Copyright (c) .NET Foundation and Contributors
Copyright (c) 2008-2020 Advanced Micro Devices, Inc.
Copyright (c) 2019 Microsoft Corporation, Daan Leijen
Copyright (c) 2011 Novell, Inc (http://www.novell.com)
Copyright (c) 1995-2022 Jean-loup Gailly and Mark Adler
Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors
Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com
Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers
Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip
Copyright (c) 1980, 1986, 1993 The Regents of the University of California
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To

The MIT License (MIT)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public class TestConnectionCommand : PSCmdlet, IDisposable
/// Gets or sets whether to enable detailed output mode while running a TCP connection test.
/// Without this flag, the TCP test will return a boolean result.
/// </summary>
[Parameter]
[Parameter(ParameterSetName = TcpPortParameterSet)]
public SwitchParameter Detailed;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
<PackageReference Include="Markdig.Signed" Version="0.31.0" />
<PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.2.0" />
<PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.2.1" />
</ItemGroup>

<PropertyGroup>
Expand Down
8 changes: 5 additions & 3 deletions src/System.Management.Automation/CoreCLR/CorePsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,10 @@ internal static partial class NativeMethods
[LibraryImport(psLib)]
internal static partial int WaitPid(int pid, [MarshalAs(UnmanagedType.Bool)] bool nohang);

// This is a struct tm from <time.h>.
[StructLayout(LayoutKind.Sequential)]
// This is the struct `private_tm` from setdate.h in libpsl-native.
// Packing is set to 4 to match the unmanaged declaration.
// https://github.com/PowerShell/PowerShell-Native/blob/c5575ceb064e60355b9fee33eabae6c6d2708d14/src/libpsl-native/src/setdate.h#L23
[StructLayout(LayoutKind.Sequential, Pack = 4)]
internal unsafe struct UnixTm
{
/// <summary>Seconds (0-60).</summary>
Expand Down Expand Up @@ -980,7 +982,7 @@ internal static UnixTm DateTimeToUnixTm(DateTime date)
return tm;
}

[LibraryImport(psLib)]
[LibraryImport(psLib, SetLastError = true)]
internal static unsafe partial int SetDate(UnixTm* tm);

[LibraryImport(psLib, StringMarshalling = StringMarshalling.Utf8)]
Expand Down
13 changes: 12 additions & 1 deletion src/System.Management.Automation/engine/parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7962,7 +7962,18 @@ private ExpressionAst ElementAccessRule(ExpressionAst primaryExpression, Token l
// G primary-expression '[' new-lines:opt expression new-lines:opt ']'

SkipNewlines();
ExpressionAst indexExpr = ExpressionRule();
bool oldDisableCommaOperator = _disableCommaOperator;
_disableCommaOperator = false;
ExpressionAst indexExpr = null;
try
{
indexExpr = ExpressionRule();
}
finally
{
_disableCommaOperator = oldDisableCommaOperator;
}

if (indexExpr == null)
{
// ErrorRecovery: hope we see a closing bracket. If we don't, we'll pretend we saw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,22 @@ internal void AddMembersByInferredTypesClrType(PSTypeName typename, bool isStati
filterToCall = filter;
}

results.AddRange(GetMembersByInferredType(new PSTypeName(typeof(object)), isStatic, filterToCall));
PSTypeName baseMembersType;
if (typename.TypeDefinitionAst.IsEnum)
{
if (!isStatic)
{
results.Add(new PSInferredProperty("value__", new PSTypeName(typeof(int))));
}

baseMembersType = new PSTypeName(typeof(Enum));
}
else
{
baseMembersType = new PSTypeName(typeof(object));
}

results.AddRange(GetMembersByInferredType(baseMembersType, isStatic, filterToCall));
}

internal void AddMembersByInferredTypeCimType(PSTypeName typename, List<object> results, Func<object, bool> filterToCall)
Expand Down
6 changes: 6 additions & 0 deletions test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,12 @@ class InheritedClassTest : System.Attribute
$res.CompletionMatches.CompletionText | Should -Contain '-ProgressAction'
}

it 'Should complete enum class members for Enums in script text' {
$res = TabExpansion2 -inputScript 'enum Test1 {Val1};([Test1]"").'
$res.CompletionMatches.CompletionText[0] | Should -Be 'value__'
$res.CompletionMatches.CompletionText | Should -Contain 'HasFlag('
}

Context "Script name completion" {
BeforeAll {
Setup -f 'install-powershell.ps1' -Content ""
Expand Down
9 changes: 9 additions & 0 deletions test/powershell/Language/Parser/Parsing.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,15 @@ Describe "Parsing using statement with alias and linebreak and comma" -Tag CI {
}
}

It "Should correctly parse array literals for index expressions in method calls" {
$tks = $null
$ers = $null
$Script = '[string]::join(" ", (0, 1, 2)[0, 1])'
$result = [System.Management.Automation.Language.Parser]::ParseInput($Script, [ref]$tks, [ref]$ers)
$result.EndBlock.Statements[0].PipelineElements[0].Expression.Arguments[1].Index.Elements.Count | Should -Be 2
$ers.Count | Should -Be 0
}

It "Should correctly parse array types that are used as arguments without brackets in generic type" {
$tks = $null
$ers = $null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
$computerInfoAll = $null
$testStartTime = Get-Date

$excludedProperties = @(
"CsPhysicallyInstalledMemory",
"OsServerLevel"
)

function Get-ComputerInfoForTest
{
# NOTE: $forceRefresh only applies to the case where $properties is null
Expand Down Expand Up @@ -1041,8 +1046,13 @@ try {
# easier to debug the problem if we know *all* the failures
# issue: https://github.com/PowerShell/PowerShell/issues/4762
# CsPhysicallyInstalledMemory not available when run in nightly builds
It "Test 01. Standard Property test - all properties (<property>)" -testcase $testCases -Pending {
It "Test 01. Standard Property test - all properties (<property>)" -testcase $testCases {
param ( $property )

if ($excludedProperties -contains $property) {
Set-ItResult -Pending -Because "'$property' is not available in nightly builds"
}

$specialProperties = "CsNetworkAdapters","CsProcessors","OsHotFixes"
if ( $specialProperties -contains $property )
{
Expand Down
14 changes: 14 additions & 0 deletions test/tools/Modules/PSSysLog/PSSysLog.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,22 @@ class PSLogItem
In those cases, a single message is logged in the following format
MMM dd HH:MM:SS machinename id[PID]: message repeated NNN times: [(commitid:TID:CHANNEL) [EventName] Message]
Alternatively, more recent syslog daemons may change the message format to:
2023-06-02T22:49:50.513735+00:00 machinename id[PID]: message repeated NNN times: [(commitid:TID:CHANNEL) [EventName] Message]
the first element of the line may be converted to a datetime, which we can use to convert the input to the expected string.
#>

$firstToken = $content.split()[0]
$dt = $firstToken -as [DateTime]
if ($dt)
{
$replacement = "{0:MMM} {0:dd} {0:hh}:{0:mm}:{0:ss}" -f $dt
$content = $content.replace($firstToken,$replacement)
}

# split contents into separate space delimited tokens (first 7) and leave the rest as the message.
[string[]] $parts = $content.Split(' ', 8, [System.StringSplitOptions]::RemoveEmptyEntries)

Expand Down
2 changes: 1 addition & 1 deletion test/xUnit/xUnit.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="XunitXml.TestLogger" Version="3.0.78" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 53ae00d

Please sign in to comment.