We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
5.4/main docker image
md5: 98334e709b9a35bb96b5b5e9f20f864e
Issue Description:
try Data("hello".utf8).write(to: URL(fileURLWithPath: "/dev/stdout"))
will fail on Linux with
NSError = domain: nil - code: 14987979559889010706 { Foundation.NSObject = {} _domain = "NSCocoaErrorDomain" _code = 512 _userInfo = 1 key/value pair { [0] = { key = "NSUnderlyingError" value = domain: nil - code: 14987979559889010706 { Foundation.NSObject = {} _domain = "NSPOSIXErrorDomain" _code = 22 _userInfo = nil } } } }
Or a more comprehensive program
import Foundation let target = CommandLine.arguments.dropFirst().first ?? "/dev/stdout" do { try Data("hello".utf8).write(to: URL(fileURLWithPath: target)) } catch { print("ERROR: \(error)") }
when run under Linux will print
helloERROR: Error Domain=NSCocoaErrorDomain Code=512 "(null)"
note how it actually succeeds in writing the data.
As of osstatus.com, the error is NSFileWriteUnknownError.
NSFileWriteUnknownError
The problem seems to be that we call fsync on the file descriptor after the write which isn't valid for most devices:
fsync
openat(AT_FDCWD, "/dev/stdout", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 write(3, "hello", 5hello) = 5 fsync(3) = -1 EINVAL (Invalid argument)
probably originating from here: https://github.com/apple/swift-corelibs-foundation/blob/cc5fc93a9946e82d659f79e1bd991b96eba3fcdf/Sources/Foundation/NSData.swift#L446
The text was updated successfully, but these errors were encountered:
CC @millenomi/@tomerd/@spevans
Sorry, something went wrong.
@swift-ci create
#3022
This is fixed in 5.6:
$ cat repro.swift import Foundation try Data("hello".utf8).write(to: URL(fileURLWithPath: "/dev/stdout")) johannes:/tmp $ jw-docker-swift-5.6 swift repro.swift hellojohannes:/tmp $
No branches or pull requests
Environment
5.4/main docker image
Additional Detail from JIRA
md5: 98334e709b9a35bb96b5b5e9f20f864e
Issue Description:
will fail on Linux with
Or a more comprehensive program
when run under Linux will print
note how it actually succeeds in writing the data.
As of osstatus.com, the error is
NSFileWriteUnknownError
.The problem seems to be that we call
fsync
on the file descriptor after the write which isn't valid for most devices:probably originating from here: https://github.com/apple/swift-corelibs-foundation/blob/cc5fc93a9946e82d659f79e1bd991b96eba3fcdf/Sources/Foundation/NSData.swift#L446
The text was updated successfully, but these errors were encountered: