swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.36k forks source link

[SR-6436] DateFormatter on Linux crashes #48986

Open swift-ci opened 6 years ago

swift-ci commented 6 years ago
Previous ID SR-6436
Radar None
Original Reporter jli (JIRA User)
Type Bug
Environment - Ubuntu 16.04 - Swift 4.0.2
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 2aec1d2e6e554c6b049c1480090dda9f

Issue Description:

Hi,

the following code does work without problems on macOS - but crashes on Linux

season_begin = DateFormatter.localizedString(from: Date(), dateStyle: .short, timeStyle: .none)
belkadan commented 6 years ago

Crashes at run time or crashes while trying to compile?

swift-ci commented 6 years ago

Comment by Mark Lilback (JIRA)

I'm having the same problem when I try running the program on a docker image.

import Foundation

let df = ISO8601DateFormatter()
let date = Date()
print ("date is \(df.string(from: date))")

This works fine on my development machine, but when I deploy it on DigitalOcean I get a crash. The exit code is 132, which I think means certain sse4_2 isn't supported.

This is with 16.04 and the 4.2 2018-07-17 snapshot. This is repeatable with:

# docker run -it library/ubuntu:xenial
root@5c66435cd9bf:/# apt-get update
root@5c66435cd9bf:/# apt-get install clang libicu-dev libcurl4-openssl-dev libxml2
root@5c66435cd9bf:/# curl -O  https://swift.org/builds/swift-4.2-branch/ubuntu1604/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-17-a/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-17-a-ubuntu16.04.tar.gz
root@5c66435cd9bf:/# tar zxf swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-17-a-ubuntu16.04.tar.gz
root@5c66435cd9bf:/# export PATH=swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-17-a-ubuntu16.04/usr/bin:$PATH
root@5c66435cd9bf:/# swiftc -o foo foo.swift
root@5c66435cd9bf:/# ./foo
Illegal instruction (core dumped)

This crashes on my local skylake i5 and on DigitalOcean.

swift-ci commented 3 years ago

Comment by Tobias H (JIRA)

Because I also just ran into this crash on latest Swift 5.3.2:

This crash is caused by missing timezone data. If you install package tzdata, the date formatter should work.