-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add platform support for FreeBSD #20041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
CI tooling does not like |
PowerShell/PowerShell-Native#92 has been merged in. I will try and get this PR rebased this weekend. Edit: Initial rebase done. Still needs work |
As I am working back over this I am noticing a few things:
No idea on why just this fails. <test-case description="Word wrapping for string with escape sequences" name="Handle strings with escape sequences in formatting.Word wrapping for string with escape sequences" time="0.0343" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Expected strings to be the same, but they were different.
Expected length: 123
Actual length: 95
Strings differ at index 45.
Expected: '...hell &27;[0m\n...'
But was: '...hell scrip...'</message>
<stack-trace>at <ScriptBlock>, /root/Powershell/test/powershell/engine/Formatting/PSStyle.Tests.ps1: line 501
501: $text.Trim().Replace("`r", "") | Should -BeExactly $expected.Replace("`r", "")</stack-trace>
</failure>
</test-case> This one appears to come from runtime and not pwsh <test-suite type="TestFixture" name="Data, Config, and Cache locations" executed="True" result="Failure" success="False" time="0.844" asserts="0" description="Data, Config, and Cache locations">
<results>
<test-case description="Should start if Data, Config, and Cache location is not accessible" name="ConsoleHost unit tests.Data, Config, and Cache locations.Should start if Data, Config, and Cache location is not accessible" time="0.6604" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Expected the actual value to be greater than 0, but got 0.</message>
<stack-trace>at <ScriptBlock>, /root/Powershell/test/powershell/Host/ConsoleHost.Tests.ps1: line 675
675: [int]$output | Should -BeGreaterThan 0</stack-trace>
</failure>
</test-case>
</results>
</test-suite> This one might be filesystem or runtime related. Not 100% sure. <test-case description="Resolve-Path -Path './test*.txt' -RelativeBasePath '/tmp/cf3edf0f-4706-4da4-b2f8-ce6d79acf9e2' -Force:$false should return '$null'" name="Resolve-Path returns proper path.Resolve-Path -Path './test*.txt' -RelativeBasePath '/tmp/cf3edf0f-4706-4da4-b2f8-ce6d79acf9e2' -Force:$false should return '$null'" time="0.0389" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Expected exactly $null, but got @('/tmp/cf3edf0f-4706-4da4-b2f8-ce6d79acf9e2/test1.txt', '/tmp/cf3edf0f-4706-4da4-b2f8-ce6d79acf9e2/test2.txt').</message>
<stack-trace>at <ScriptBlock>, /root/Powershell/test/powershell/Modules/Microsoft.PowerShell.Management/Resolve-Path.Tests.ps1: line 176
176: (Resolve-Path -Path $Path -RelativeBasePath $BasePath -Force:$Force).Path | Should -BeExactly $ExpectedResult</stack-trace>
</failure>
</test-case> These two are likely FreeBSD related <test-case description="Should be able to import string using default culture" name="Import-LocalizedData.Should be able to import string using default culture" time="0.0171" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Expected strings to be the same, but they were different.
Expected length: 5
Actual length: 0
Strings differ at index 0.
Expected: 'en-US'
But was: ''</message>
<stack-trace>at <ScriptBlock>, /root/Powershell/test/powershell/Modules/Microsoft.PowerShell.Utility/Import-LocalizedData.Tests.ps1: line 16
16: $culture.Name | Should -BeExactly "en-US"</stack-trace>
</failure>
</test-case> <test-case description="using -displayhint produces the correct output" name="Get-Date DRT Unit Tests.using -displayhint produces the correct output" time="0.0134" asserts="0" success="False" result="Failure" executed="True">
<failure>
<message>Expected strings to be the same, but they were different.
String lengths are both 26.
Strings differ at index 11.
Expected: 'Wednesday, January 1, 2020'
But was: 'Wednesday, 01 January 2020'</message>
<stack-trace>at <ScriptBlock>, /root/Powershell/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Date.Tests.ps1: line 20
20: $d.Trim() | Should -Be "Wednesday, January 1, 2020"</stack-trace>
</failure> Some more details PS /root/Powershell> Get-Culture | Fl *
Parent :
LCID : 127
KeyboardLayoutId : 127
Name :
IetfLanguageTag :
DisplayName : Invariant Language (Invariant Country)
NativeName : Invariant Language (Invariant Country)
EnglishName : Invariant Language (Invariant Country)
TwoLetterISOLanguageName : iv
ThreeLetterISOLanguageName : ivl
ThreeLetterWindowsLanguageName : IVL
CompareInfo : CompareInfo -
TextInfo : TextInfo -
IsNeutralCulture : False
CultureTypes : SpecificCultures
NumberFormat : System.Globalization.NumberFormatInfo
DateTimeFormat : System.Globalization.DateTimeFormatInfo
Calendar : System.Globalization.GregorianCalendar
OptionalCalendars : {System.Globalization.GregorianCalendar}
UseUserOverride : False
IsReadOnly : True
PS /root/Powershell> locale
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_TIME="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=
|
net9 now has better support for FreeBSD and the SDK will under FreeBSD RIDs. This does not change the fact that this PR still has a bootstrapping issue as it requires a pwsh that understands what FreeBSD is first and I am unsure how to resolve that in this PR. Is this something that needs to be done outside of a PR? A different PR? |
We would manually compile and publish initial pwsh package before CIs on Github could use it. Although I do not even know if the MSFT team wants to have it officially. @Thefrank Did you know that FreeBSD is used in Azure? Such scenarios could be a trigger for solving this issue. |
I think official support for FreeBSD is unlikely even in the near future and I am OK with that. I have no issue removing FreeBSD references in the download scripts. Officially supported (with or without a Microsoft download) can imply to users that they can get official support. This adds a support burden even if it is just "Issue Closed: File with FreeBSD bugs tracker". If More complex ecosystem details:
|
Looking forward to the release of the for freebsd version soon. |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
Any chance to get this upstreamed to maybe help with testing/fixing rest of the things for more ppl? |
We have working port build of PowerShell 7.5.0 - https://github.com/sec/freebsd-ports/tree/powershell.v7.5.0/shells/powershell - that soon maybe will come into upstream - would be nice to know the status of those changes
|
@sec AFAIK this PR is unlikely to be merged due mainly to a bootstrapping issue (e.g., Checks system can't run without knowing about FreeBSD) and to a lesser extent no official support for community supported dotNET platforms.
I have no issue in closing this in favor of a more likely/qualified/coded PR. |
@sec Is this safe to close? I see we have ports version on FreeBSD now 🎉
|
The port was based on some previous work to make pwsh build and just adjusted to 7.5.0 - I don't think anything was done related to test, as to run the test some changes are needed (which are part of your PR as I saw) - looking that there is no move or will to make those merged, only thing we can do is to incorporate changes from your PR into FreeBSD port as patch files, if that make sense. |
@kasini3000 it is in ports as of last month: https://www.freshports.org/shells/powershell/
|
PR Summary
Adds build and platform support for FreeBSD
Adds tests and updates comments for FreeBSD relevant items
PR Context
FreeBSD is a community supported dotNET RID and this PR expands Powershell's ability to run under FreeBSD
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).
I have left this as WIP for two reasons:
Finally, this PR is roughly based on the work jasonpugsley@a3aeb12 and directly uses the PID and PPID functionality from it.