Recent versions of glibc marks some function parameters as __nonnull
, changing type signatures
#70647
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
On Glibc 2.38 (potentially other versions, but this is the one that reproduces), the parameter to
fclose
is marked__nonnull
. When imported into Swift, that means that the parameter is made non-optional. This breaks some code in swift-tools-support-core:https://github.com/apple/swift-tools-support-core/blob/0583d2619102bb7d579e357df191977c0027cd11/Sources/TSCBasic/FileSystem.swift#L492-L497
Specifically, this causes a build failure in the Nixpkgs derivation for Swift, as reported by a friend of mine:
As of Xcode 15.1, the macOS SDK does not have a similar non-null marking, resulting in a type signature mismatch across platforms.
Reproduction
Modified from the above-linked code in swift-tools-support-core:
Expected behavior
Code builds without issue.
Environment
The current nixpkgs derivation for Swift includes Swift 5.8 and glibc 2.38. Other reproductions of this issue (apple/swift-nio-ssl#429, jocosocial/swiftarr#244) occur in both Swift 5.8 and 5.9, but both with glibc 2.38.
Additional information
Nixpkgs is currently working around this issue by patching swift-tools-support-core to force-unwrap the handle returned by
fopen
(NixOS/nixpkgs#269015) but finding some way to reconcile this in Swift's glibc overlay would be ideal.The text was updated successfully, but these errors were encountered: