Skip to content

du --time crashes with large timestamp (tests/du/bigtime) #8356

Description

@drinkcat

Linked to #8355. If that initial test passed, we'd hit this in tests/du/bigtime

Steps to repro (might need to use tmpfs for this, e.g. my local ext4 does not like such large timestamps)

$ touch -d @9223372036854775807 /tmp/future
$ LC_ALL=C TZ=UTC0 du --time /tmp/future
0	du: time '9223372036854775807' is out of range
9223372036854775807	/tmp/future
$ LC_ALL=C TZ=UTC0 cargo run du --time /tmp/future
thread '<unnamed>' panicked at /home/drinkcat/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chrono-0.4.41/src/datetime/mod.rs:1856:38:
No such local time
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
du: Printing thread panicked.

So:

  1. We should not crash
  2. We should print dates up to @67768036191676799 (year 2147485547)

Note that the crash is in chrono here, so maybe we should switch to jiff like we did with ls (see #7852), but as seen in #8355, jiff behaviour also isn't quite what we want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions