Open JCWasmx86 opened 11 months ago
I have the exact same issue on Arch Linux, maybe its a glibc related issue @JCWasmx86 thanks for this nice simple hack :)
glibc 2.38-5
Swift version 5.9 (swift-5.9-RELEASE)
Target: x86_64-unknown-linux-gnu`Swift version 5.9 (swift-5.9-RELEASE)
Target: x86_64-unknown-linux-gnu
6.5.5
Looking at the same function called in the line 1392:
func strftime(
: UnsafeMutablePointer
func strftime(_ s: UnsafeMutablePointer
Looks like it is safe to just force unwrap localtime
like this on line failing:
strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime!)
It worked on my computer™
But that would break code on Fedora 38 for example. Not sure what the best approach would be, as dropping somewhat recent OS versions like Fedora 38 is probably a bit too fast.
Of course, I meant it's safe if you're on the OS experiencing this issue. I also wonder if the hack has been already tested on older versions.
Also seeing this behavior on Ubuntu 23.10, Swift 5.9.1
Same problem Kubuntu 23.10, Swift 5.8.1/5.9.1
Looks like this was fixed in f447991, but a new release would be handy.
Expected behavior
It compiles on Arch Linux and Fedora 39 (Works on Fedora 38)
Actual behavior
Does not compile on Arch Linux/Fedora 39 (The following part of the issue assumes Fedora 39)
Steps to reproduce
If possible, minimal yet complete reproducer code (or URL to code)
SwiftLog version/commit hash
cb28750240a9389e0023ee3e3cb6c83ce0960f5c and 1.5.3
Swift & OS version (output of
swift --version && uname -a
)and
I was able to fix this with the help of helje5 by doing this hack: https://github.com/JCWasmx86/swift-log/commit/332ed31d777c7acbf4790a790bcfb54fe264de27