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

Use filesystem name mapping on FreeBSD #105417

Merged
merged 5 commits into from
Jul 27, 2024
Merged

Use filesystem name mapping on FreeBSD #105417

merged 5 commits into from
Jul 27, 2024

Conversation

am11
Copy link
Member

@am11 am11 commented Jul 24, 2024

FreeBSD debug build was running into:

$ ~/.dotnet9/dotnet new console -n app1
...
Process terminated. Assertion failed.
GetFileSystemType returned 222
   at Interop.Sys.TryGetFileSystemType(SafeFileHandle fd, UnixFileSystemTypes& fileSystemType)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, UnixFileMode& filePermissions)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at NuGet.Protocol.RemotePackageArchiveDownloader.CopyNupkgFileToAsync(String destinationFilePath, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at NuGet.Protocol.RemotePackageArchiveDownloader.CopyNupkgFileToAsync(String destinationFilePath, CancellationToken cancellationToken)
   at NuGet.Packaging.PackageExtractor.<>c__DisplayClass5_0.<<InstallFromSourceAsync>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
....

Turned out that 222 (aka 0xDE) is some kind of a partial magic number (e.g. https://people.redhat.com/bhubbard/cov-html-int-2019-10-09/1/574compat.cc.html uses 0xDE, while https://github.com/coreutils/coreutils/blob/83ec7a706a9f931e418ec6a084587b8995ca5388/src/stat.c#L556 is using 0x2FC12FC1 which is the same we have.

I think it's best to use name mapping rather than the alternative to use some fake name like zfs1 which f_fstypename will never return on other systems.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 24, 2024
@am11 am11 requested a review from adamsitnik July 24, 2024 18:45
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @am11 !

@jkotas jkotas merged commit 67d5c92 into dotnet:main Jul 27, 2024
109 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO community-contribution Indicates that the PR has been added by a community member os-freebsd FreeBSD OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants