Skip to content
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

Regression in PowerShell 7.4.2 on macOS prevents starting due to incorrect capitalization of file names on case sensitive file systems #21521

Open
5 tasks done
Nothing4You opened this issue Apr 23, 2024 · 5 comments
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. OS-macOS

Comments

@Nothing4You
Copy link

Prerequisites

Steps to reproduce

Reproduction requires a case-sensitive file system.
I'm experiencing this issue on macOS 14.4.1 (23E224) on ARM.

This is a regression since 7.4.1, reinstalling 7.4.1 via Homebrew works fine:

brew install --cask https://github.com/Homebrew/homebrew-cask/raw/5d03ce3401e2e5c606d1c7f499ddbc1799455aea/Casks/p/powershell.rb

On 7.4.1, /usr/local/microsoft/powershell/7/libsystem.native.dylib does not exist, but /usr/local/microsoft/powershell/7/libSystem.Native.dylib does.

Diff of files in /usr/local/microsoft/powershell/7

diff --git a/ps-7.4.1 b/ps-7.4.2
index d0f3a8b..5009c97 100644
--- a/ps-7.4.1
+++ b/ps-7.4.2
@@ -40,10 +40,6 @@
 /usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.psm1
 /usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/Notice.txt
 /usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/PSGet.Format.ps1xml
-/usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/_manifest/spdx_2.2/bsi.json
-/usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/_manifest/spdx_2.2/manifest.cat
-/usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/_manifest/spdx_2.2/manifest.spdx.json
-/usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/_manifest/spdx_2.2/manifest.spdx.json.sha256
 /usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/dependencies/Microsoft.Bcl.AsyncInterfaces.dll
 /usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/dependencies/Newtonsoft.Json.dll
 /usr/local/microsoft/powershell/7/Modules/Microsoft.PowerShell.PSResourceGet/dependencies/NuGet.Commands.dll
@@ -406,13 +402,6 @@
 /usr/local/microsoft/powershell/7/ko/Microsoft.CodeAnalysis.resources.dll
 /usr/local/microsoft/powershell/7/ko/System.Private.ServiceModel.resources.dll
 /usr/local/microsoft/powershell/7/ko/System.Web.Services.Description.resources.dll
-/usr/local/microsoft/powershell/7/libSystem.Globalization.Native.dylib
-/usr/local/microsoft/powershell/7/libSystem.IO.Compression.Native.dylib
-/usr/local/microsoft/powershell/7/libSystem.IO.Ports.Native.dylib
-/usr/local/microsoft/powershell/7/libSystem.Native.dylib
-/usr/local/microsoft/powershell/7/libSystem.Net.Security.Native.dylib
-/usr/local/microsoft/powershell/7/libSystem.Security.Cryptography.Native.Apple.dylib
-/usr/local/microsoft/powershell/7/libSystem.Security.Cryptography.Native.OpenSsl.dylib
 /usr/local/microsoft/powershell/7/libclrgc.dylib
 /usr/local/microsoft/powershell/7/libclrjit.dylib
 /usr/local/microsoft/powershell/7/libcoreclr.dylib
@@ -421,6 +410,13 @@
 /usr/local/microsoft/powershell/7/libmscordaccore.dylib
 /usr/local/microsoft/powershell/7/libmscordbi.dylib
 /usr/local/microsoft/powershell/7/libpsl-native.dylib
+/usr/local/microsoft/powershell/7/libsystem.globalization.native.dylib
+/usr/local/microsoft/powershell/7/libsystem.io.compression.native.dylib
+/usr/local/microsoft/powershell/7/libsystem.io.ports.native.dylib
+/usr/local/microsoft/powershell/7/libsystem.native.dylib
+/usr/local/microsoft/powershell/7/libsystem.net.security.native.dylib
+/usr/local/microsoft/powershell/7/libsystem.security.cryptography.native.apple.dylib
+/usr/local/microsoft/powershell/7/libsystem.security.cryptography.native.openssl.dylib
 /usr/local/microsoft/powershell/7/mscorlib.dll
 /usr/local/microsoft/powershell/7/netstandard.dll
 /usr/local/microsoft/powershell/7/pl/Microsoft.CodeAnalysis.CSharp.resources.dll

Expected behavior

PowerShell 7.4.2
PS /Users/myuser>

Actual behavior

Error message: Unable to load shared library 'libSystem.Native' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable:
dlopen(/usr/local/microsoft/powershell/7/libSystem.Native.dylib, 0x0001): tried: '/usr/local/microsoft/powershell/7/libSystem.Native.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/microsoft/powershell/7/libSystem.Native.dylib' (no such file), '/usr/local/microsoft/powershell/7/libSystem.Native.dylib' (no such file)
dlopen(libSystem.Native.dylib, 0x0001): tried: 'libSystem.Native.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibSystem.Native.dylib' (no such file), '/usr/lib/libSystem.Native.dylib' (no such file, not in dyld cache), 'libSystem.Native.dylib' (no such file), '/usr/local/lib/libSystem.Native.dylib' (no such file), '/usr/lib/libSystem.Native.dylib' (no such file, not in dyld cache)
dlopen(/usr/local/microsoft/powershell/7/liblibSystem.Native.dylib, 0x0001): tried
Failed to create CoreCLR, HRESULT: 0x80131524

Error details

No response

Environment data

PS /Users/myuser> $PSVersionTable  # something like this

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
Platform                       Unix

Visuals

No response

@Nothing4You Nothing4You added the Needs-Triage The issue is new and needs to be triaged by a work group. label Apr 23, 2024
@rhubarb-geek-nz
Copy link

This looks like a problem with the tar

% gunzip < powershell-7.4.2-osx-arm64.tar.gz | tar tvf - | grep libsystem.native.dylib
-rw-r--r--  0 runner staff  159600 10 Apr 00:31 libsystem.native.dylib

Also looks like a problem with the pkg

% xar -xf powershell-7.4.2-osx-arm64.pkg
% gunzip < powershell-7.4.2.pkg/Payload | cpio -I
% ls -l usr/local/microsoft/powershell/7/libsystem.native.dylib
-rw-r--r--  1 foobar  staff  159600 23 Apr 17:58 usr/local/microsoft/powershell/7/libsystem.native.dylib

@SteveL-MSFT
Copy link
Member

SteveL-MSFT commented Apr 23, 2024

Doing a build of 7.4.2 results in the correct naming of the library, so it does seem like the casing is being changed during packaging. I don't see anything in the packaging script that would convert the casing to lower. cc @adityapatwardhan @TravisEz13

The .pkg results in the correct casing so it looks like just a problem in the tgz

@Nothing4You
Copy link
Author

Nothing4You commented Apr 24, 2024

Homebrew uses the pkg:

https://github.com/Homebrew/homebrew-cask/blob/07c74f3ce9dfbfa51fb913ba8f542addef753d04/Casks/p/powershell.rb#L8

Taking the build from https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-7.4.2-osx-arm64.pkg, I'm seeing the same result that @rhubarb-geek-nz already mentioned:

$ xar -xf powershell-7.4.2-osx-arm64.pkg
$ gunzip < powershell-7.4.2.pkg/Payload | cpio -t | grep -Fi libsystem.native.dylib
./usr/local/microsoft/powershell/7/libsystem.native.dylib
385013 blocks

If your local build has the correct naming, that suggests there is something different between your local build and the release publishing pipeline?

It's the same for powershell-7.4.2-osx-x64.pkg btw.

@SteveL-MSFT
Copy link
Member

The mac tgz package is built here which simply relies the packaging module. The copying of the files is done here and I don't see anything that would have changed the casing.

If you are using a case-sensitive filesystem on macOS, if you just copy-item -recurse a folder, does that somehow change the casing? Maybe it's something in the FileSystemProvider and we've been looking in the wrong place?

@Nothing4You
Copy link
Author

➜  test mkdir folder
➜  test touch folder/{fileA,fileb,FILEC}
➜  test ls folder
FILEC fileA fileb
➜  test pwsh
PowerShell 7.4.1

PS .../test> Copy-Item -Recurse folder folder2
PS .../test>
➜  test ls  folder2
FILEC fileA fileb

that works just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. OS-macOS
Projects
None yet
Development

No branches or pull requests

4 participants