Fix readFileContents to support non-regular files via FileHandle fallback#566
Merged
Merged
Conversation
…back (swiftlang#562) The Data API is used for regular files (mmap performance) and FileHandle is the fallback for pipes, FIFOs, and character devices that Data rejects.
Contributor
Author
|
@swift-ci test |
bkhouri
approved these changes
Jun 25, 2026
|
@swift-ci test |
daveinglis
added a commit
to swiftlang/swift-package-manager
that referenced
this pull request
Jun 27, 2026
…#10235) Adds tests to catch a regression (rdar://174417799) where `localFileSystem.readFileContents` broke for FIFOs, named pipes, and `/dev/stdin` after TSC switched from `fopen/fread` to `Data(contentsOf:)`, which rejects non-regular files. -`FileSystemTests.localFileSystemReadFileContentsAcceptsNonRegularFile`: unit test that calls `localFileSystem.readFileContents` directly on a FIFO and verifies the content is read correctly. - `PackageRegistryCommandTests.tokenFileAcceptsNonRegularFile`: functional test that runs `swift package-registry login --token-file <fifo>` and verifies the command fails at the network step rather than the file-read step, confirming `--token-file` accepts non-regular files as it did before the regression. Validates: #9915 cherrypicked from main Depends on: swiftlang/swift-tools-support-core#566
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Data API is used for regular files (mmap performance) and FileHandle is the fallback for pipes, FIFOs, and character devices that Data rejects.
cherrypicked from main so we don't regress in 6.4