I checked most of the platforms available on cfarm, and they all
returned EPERM in this case.

-- 8< --

This adds a test for the bug fixed by commit 9192fd32e (date: bring back
-u complexity with putenv, 2026-10-22).

* tests/date/date-set.sh: New file.
* tests/local.mk (all_tests): Add the new test.
* NEWS: Mention the bug fix.
---
 NEWS                   |  4 ++++
 tests/date/date-set.sh | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/local.mk         |  1 +
 3 files changed, 46 insertions(+)
 create mode 100755 tests/date/date-set.sh

diff --git a/NEWS b/NEWS
index e0f962d7d..b964fd135 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   the \u0085 (next line) character as a separator on non-GLIBC platforms.
   [bug introduced in coreutils-9.11]
 
+  'date -u MMDDhhmm' no longer uses the local time zone's UTC offset when
+  setting the date and time.
+  [bug introduced in coreutils-9.11]
+
   'factor' no longer treats inputs requiring the use of arbitrary-precision
   integers followed by a non-numeric suffix as zero if the suffix includes
   non-space characters, or the number itself when followed by spaces.
diff --git a/tests/date/date-set.sh b/tests/date/date-set.sh
new file mode 100755
index 000000000..7b86fe487
--- /dev/null
+++ b/tests/date/date-set.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Test that 'date' sets the date properly.
+
+# Copyright (C) 2026 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ date
+skip_if_root_
+getlimits_
+
+# In coreutils-9.11 and coreutils-9.12, TZ="..." date -u MMDDhhmm
+# would use the UTC offset from $TZ instead of UTC0.  While we are
+# here, check the other methods of setting the date.
+date -u -d '2026-01-01 12:00' >exp-out || fail=1
+echo "date: cannot set date: $EPERM" >exp-err || framework_failure_
+for opt in '' -s --set; do
+  if test -z "$opt"; then
+    date_str=0101120026
+  else
+    date_str='2026-01-01 12:00'
+  fi
+  returns_ 1 env TZ='America/Los_Angeles' date -u $opt "$date_str" >out 2>err \
+    || fail=1
+  compare exp-out out || fail=1
+  compare exp-err err || fail=1
+done
+
+Exit $fail
diff --git a/tests/local.mk b/tests/local.mk
index d7679d2a7..3cf565944 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -356,6 +356,7 @@ all_tests =                                 \
   tests/date/date-ethiopia.sh                  \
   tests/date/date-iran.sh                      \
   tests/date/date-locale-hour.sh               \
+  tests/date/date-set.sh                       \
   tests/date/percent-percent.sh                        \
   tests/date/reference.sh                      \
   tests/date/resolution.sh                     \
-- 
2.56.0


Reply via email to