diff options
author | Jim Meyering <meyering@redhat.com> | 2012-07-04 13:01:56 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-07-04 13:32:24 +0200 |
commit | cc322ddd16607c0c8e978e5003008344e2710ec9 (patch) | |
tree | eceb3dd878d732733986ed1359654c9b110c6cb2 /tests | |
parent | 74427c76d7be2a5522a8d24e29bfa63c299dbbce (diff) | |
download | coreutils-cc322ddd16607c0c8e978e5003008344e2710ec9.tar.xz |
date: fails to diagnose invalid input
date -d "$(printf '\xb0')" would print 00:00:00 with today's date
rather than diagnosing the invalid input. Now it reports this:
date: invalid date '\260'
* gnulib: Update submodule to latest for fixed parse-datetime.y.
* tests/misc/date [invalid-high-bit-set]: New test.
* NEWS (Bug fixes): Mention it.
* bootstrap, tests/init.sh: Also update to latest.
Reported by Peter Evans in http://bugs.gnu.org/11843
Diffstat (limited to 'tests')
-rw-r--r-- | tests/init.sh | 5 | ||||
-rwxr-xr-x | tests/misc/date | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/init.sh b/tests/init.sh index f525a7cab..5f6e6387e 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -411,8 +411,7 @@ path_prepend_ () case $path_dir_ in '') fail_ "invalid path dir: '$1'";; /*) abs_path_dir_=$path_dir_;; - *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \ - || fail_ "invalid path dir: $path_dir_";; + *) abs_path_dir_=$initial_cwd_/$path_dir_;; esac case $abs_path_dir_ in *:*) fail_ "invalid path dir: '$abs_path_dir_'";; @@ -448,7 +447,7 @@ setup_ () pfx_=`testdir_prefix_` test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ || fail_ "failed to create temporary directory in $initial_cwd_" - cd "$test_dir_" + cd "$test_dir_" || fail_ "failed to cd to temporary directory" # As autoconf-generated configure scripts do, ensure that IFS # is defined initially, so that saving and restoring $IFS works. diff --git a/tests/misc/date b/tests/misc/date index 8a23ca9c6..8b6fdb24d 100755 --- a/tests/misc/date +++ b/tests/misc/date @@ -282,6 +282,11 @@ my @Tests = # most others print 'WED DEC 8 07:30:00 1999'. {OUT_SUBST => 's/ [ 0]8.*//'}, {OUT=>'WED DEC'}], + + ['invalid-high-bit-set', "-d '\xb0'", + {ERR => "date: invalid date '\\260'\n"}, + {EXIT => 1}, + ], ); # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364. |