Ubuntu's groff ignores TZ (but upstream works)

Bug #1908333 reported by jimav
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
groff (Ubuntu)
Fix Released
High
Colin Watson

Bug Description

Ubuntu 20.04.1 LTS

groff's date & time (visible in variable \n[hours] for example) are always in UTC, not the local time. The TZ environment variable is ignored.

The upstream version doesn't have this bug; it honors TZ as it should. I downloaded and built from upstream source the exact same version of groff that the Ubuntu package claims to contain, and it works. But the Ubuntu binary does not work in this respect.

dpkg-query -l groff says: 1.22.4-4build1 amd64

Upstream source code is at http://ftp.gnu.org/gnu/groff/groff-1.22.4.tar.gz

STEPS TO REPRODUCE:
  1. Run the following script

#!/bin/sh
#GROFF=/home/jima/src/groff-1.22.4/inst/bin/groff
GROFF=/usr/bin/groff
echo "Using $GROFF"
for varlist in \
   'PATH=/bin:/usr/bin' \
   'PATH=/bin:/usr/bin TZ=UTC' \
   'PATH=/bin:/usr/bin TZ=America/New_York' \
   'PATH=/bin:/usr/bin TZ=America/Los_Angeles' \
; do
  echo "--------------------------------------"
  eval "env -i $varlist /bin/sh" <<SHELLEOF
#(set -x; env)
echo "TZ is \${TZ:-(unset)}"
echo -n "date says: "; date +'%Y-%m-%d %H:%M:%S'
$GROFF <<'GEND' 2>&1 >/dev/null
.tm groff says: \n[year]-\n[mo]-\n[dy] \n[hours]:\n[minutes]:\n[seconds]
GEND
SHELLEOF
done

***
Here is output on my system (notice that \n[hours] is always in UTC regardless of TZ):

Using /usr/bin/groff
--------------------------------------
TZ is (unset)
date says: 2020-12-15 16:54:38
groff says: 2020-12-16 0:54:38
--------------------------------------
TZ is UTC
date says: 2020-12-16 00:54:38
groff says: 2020-12-16 0:54:38
--------------------------------------
TZ is America/New_York
date says: 2020-12-15 19:54:38
groff says: 2020-12-16 0:54:38
--------------------------------------
TZ is America/Los_Angeles
date says: 2020-12-15 16:54:38
groff says: 2020-12-16 0:54:38

***
Here is output using groff built from upstream source:

Using /home/jima/src/groff-1.22.4/inst/bin/groff
--------------------------------------
TZ is (unset)
date says: 2020-12-15 16:55:05
groff says: 2020-12-15 16:55:5
--------------------------------------
TZ is UTC
date says: 2020-12-16 00:55:05
groff says: 2020-12-16 0:55:5
--------------------------------------
TZ is America/New_York
date says: 2020-12-15 19:55:05
groff says: 2020-12-15 19:55:5
--------------------------------------
TZ is America/Los_Angeles
date says: 2020-12-15 16:55:05
groff says: 2020-12-15 16:55:5

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: groff 1.22.4-4build1
ProcVersionSignature: Ubuntu 5.4.0-54.60-generic 5.4.65
Uname: Linux 5.4.0-54-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.13
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Tue Dec 15 16:40:41 2020
InstallationDate: Installed on 2020-03-24 (266 days ago)
InstallationMedia: Ubuntu 19.10 "Eoan Ermine" - Release amd64 (20191017)
SourcePackage: groff
UpgradeStatus: Upgraded to focal on 2020-05-16 (213 days ago)

Revision history for this message
jimav (james-avera) wrote :
Revision history for this message
jimav (james-avera) wrote :
Revision history for this message
Jouni Mettala (jouni-mettala) wrote :

It is debian/display-utc-times.patch

Subject: Always use UTC times for display

Using localtime is problematic for reproducible builds. For now, always
use UTC times (gmtime etc.) for display. (Note that this changes the
semantics of \n[hours] etc., so may need further work.)

Changed in groff (Ubuntu):
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

I also mentioned this in the upstream mailing list thread that this came from: https://lists.gnu.org/archive/html/groff/2020-12/msg00041.html

Revision history for this message
Colin Watson (cjwatson) wrote :

Also the upstream bug report https://savannah.gnu.org/bugs/?57218 is relevant here, in terms of possible future upstream changes.

Revision history for this message
jimav (james-avera) wrote :

 > Subject: Always use UTC times for display

@Jouni - do you have a link to the bug or discussion which made this change?

It preposterous to break applications so they ignore TZ as a solution for a problematic build system. A build system could simply run everything with TZ=UTC, which would make apps display in UTC regardless of where the build executes.

** What would people think if the "date" command were changed to ignore the locale?

Revision history for this message
jimav (james-avera) wrote :

Debian's choice to permanently make groff ignore TZ is obviously wrong (and unnecessary bc builds could set TZ=UTC if desired).

What is the best way to get Debian to look at this? I guess I mean file a bug with Debian.

Colin Watson (cjwatson)
Changed in groff (Ubuntu):
importance: Undecided → High
status: Confirmed → In Progress
assignee: nobody → Colin Watson (cjwatson)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package groff - 1.23.0-2

---------------
groff (1.23.0-2) unstable; urgency=medium

  * Map CW to R for nroff (closes: #1040975).

 -- Colin Watson <email address hidden> Fri, 14 Jul 2023 17:44:41 +0100

Changed in groff (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.