Conversation
|
@swift-ci please test |
Tests/SystemTests/StatTests.swift
Outdated
|
|
||
| flags.insert(userSettableFlags) | ||
| try #require(fchflags(fd.rawValue, flags.rawValue) == 0, "\(Errno.current)") | ||
| try #require(fchflags(fd.rawValue, UInt(flags.rawValue)) == 0, "\(Errno.current)") |
There was a problem hiding this comment.
On macOS: - error: cannot convert value of type 'UInt' to expected argument type '__uint32_t' (aka 'UInt32')
We need a different fix for this.
There was a problem hiding this comment.
Below is the type of FileFlags.rawValue:
extension CInterop {
// ...
#if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) || os(OpenBSD)
public typealias FileFlags = UInt32
#endif
}
What was the error that led you to cast it to UInt? Perhaps you could compare it to UInt32.zero instead.
There was a problem hiding this comment.
I'll fix this after I open an issue.
There was a problem hiding this comment.
How about this solution?
|
@kkebo could you open an issue that contains the build errors that prompted this change? Thank you. |
|
@swift-ci please test |
Tests/SystemTests/StatTests.swift
Outdated
| } | ||
|
|
||
| #if os(FreeBSD) | ||
| // Helper functions for FreeBSD |
There was a problem hiding this comment.
It would be fine to have the correct direct call to fchflags inside an #if statement in the test case itself. Adding a helper function likely obscures what we're doing.
There was a problem hiding this comment.
I'd also be fine with using numericCast(_:).
There was a problem hiding this comment.
I understand your concerns, but if someone adds new fchflags() invocations, they may forget to #if statements for FreeBSD. To prevent that, I added a helper function.
However, I removed that function. Instead, I added some comments to clarify the reason for using integer casting.
| flags.insert(userSettableFlags) | ||
| try #require(fchflags(fd.rawValue, flags.rawValue) == 0, "\(Errno.current)") | ||
| // On FreeBSD, the second argument of `fchflags` requires `UInt` instead of`UInt32`. | ||
| try #require(fchflags(fd.rawValue, .init(flags.rawValue)) == 0, "\(Errno.current)") |
There was a problem hiding this comment.
In the fullness of time, the right solution will be to have a proper wrapper of chflags and fchflags that take a FileFlags parameter. This is good in the meantime.
|
@swift-ci please test |
|
Thanks @kkebo! |
fixes #294, fixes #295
This PR fixes
swift buildandswift teston FreeBSD.Environment:
Swift toolchain is from forums.swift.org/t/swift-on-freebsd-preview/83064.