-
Notifications
You must be signed in to change notification settings - Fork 598
Description
While working on a tool to index files for one of my projects, I wound up getting a panic during the call to serde_json
:
thread 'main' panicked at 'SystemTime must be later than UNIX_EPOCH: SystemTimeError(Duration { secs: 1, nanos: 0 })', libcore/result.rs:945:5
I tracked it down to a specific file in my home media server. Apparently, the combination of Linux and the ext3 filesystem is perfectly capable of representing at least one date before the UNIX epoch.
ls -lh
:Dec 31 1969
- Python's
os.stat
:st_mtime=-1
- Rust's
std::fs::metadata
:modified: Ok(SystemTime { tv_sec: -1, tv_nsec: 0 })
...and the irony is, SystemTime is the one piece of the Rust-provided metadata that I felt was already in a format suitable for a generic index file to be shared between programs written in different languages.
Well... that and it was a hassle to track down because Rust itself didn't complain and the panic message during serialization wouldn't tell me which file of the hundreds of thousands was causing it to die. For lack of a purpose-built tool, I had to manually bisect it until I narrowed it down.