File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -622,6 +622,25 @@ fn test_touch_set_date7() {
622622 assert_eq ! ( mtime, expected) ;
623623}
624624
625+ /// Regression test for https://github.com/uutils/coreutils/issues/11804
626+ ///
627+ /// Setting a pre-epoch date like `0000-01-01` used to panic on 32-bit targets
628+ /// because the i64 Unix timestamp (~-62 billion) overflowed the i32 `tv_sec`
629+ /// expected by the old nix-based implementation. After switching to rustix
630+ /// (which uses i64 `tv_sec` natively), this should succeed on all targets.
631+ #[ test]
632+ #[ cfg( target_os = "linux" ) ]
633+ fn test_touch_set_date_year_zero ( ) {
634+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
635+ let file = "test_touch_year_zero" ;
636+
637+ ucmd. args ( & [ "-d" , "0000-01-01" , file] )
638+ . succeeds ( )
639+ . no_stderr ( ) ;
640+
641+ assert ! ( at. file_exists( file) ) ;
642+ }
643+
625644/// Test for setting the date by a relative time unit.
626645#[ test]
627646fn test_touch_set_date_relative_smoke ( ) {
You can’t perform that action at this time.
0 commit comments