Summary
GNU date -d accepts bare timezone abbreviations (UT, ut, GMT, gmt, …) and interprets them as "now, expressed in that timezone". parse_datetime rejects them as invalid.
Found by a fuzz_date run on uutils/coreutils.
Reproduction
$ TZ=UTC+1 /usr/bin/date -d 'ut' '+%Z'
UTC
$ TZ=UTC+1 target/debug/coreutils date -d 'ut' '+%Z'
date: invalid date 'ut'
$ echo $?
1
$ TZ=UTC+1 /usr/bin/date -d 'GMT' '+%Z'
UTC
$ TZ=UTC+1 target/debug/coreutils date -d 'GMT' '+%Z'
date: invalid date 'GMT'
Test (in uutils/coreutils integration suite)
#[test]
fn test_date_bare_timezone_abbreviation() {
for input in ["ut", "UT", "gmt", "GMT"] {
new_ucmd!()
.env("TZ", "UTC+1")
.arg("-d")
.arg(input)
.arg("+%Z")
.succeeds()
.stdout_is("UTC\n");
}
}
Summary
GNU
date -daccepts bare timezone abbreviations (UT,ut,GMT,gmt, …) and interprets them as "now, expressed in that timezone".parse_datetimerejects them as invalid.Found by a
fuzz_daterun onuutils/coreutils.Reproduction
Test (in
uutils/coreutilsintegration suite)