0

Here's my code:

import Foundation

if let utc = TimeZone(abbreviation: "UTC") {
    let calendar = Calendar.current
    print("\(calendar.description)")
    print("Before dateComponents")
    let componentsDate1 = calendar.dateComponents(in: utc, from: Date())
    print("\(componentsDate1)")
}
else {
    print("Could not create timezone")
}

I'm running on Ubuntu 16.04 under Docker. The result is:

gregorian (current)
Before dateComponents
Segmentation fault

It appears the dateComponents call is crashing.

My Docker container is based off https://github.com/apple/swift-docker/blob/0aafffef619fb3b1824c968cbbe2fba4ba41bd26/5.0/ubuntu/16.04/Dockerfile

Suggestions?


UPDATES 1) I just replicated this on a Ubuntu 16.04 system running under Virtual box with an install of the Swift 5.0.1 release for Ubuntu 16.04: https://swift.org/builds/swift-5.0.1-release/ubuntu1604/swift-5.0.1-RELEASE/swift-5.0.1-RELEASE-ubuntu16.04.tar.gz

Chris Prince
  • 7,288
  • 2
  • 48
  • 66

1 Answers1

0

I was just informed this is indeed a known bug with a known current fix: https://forums.swift.org/t/possible-bug-in-datecomponents-method-running-on-ubuntu-16-04/25702

Chris Prince
  • 7,288
  • 2
  • 48
  • 66