jq fromdate is one hour off and hence FTBFS when local time is during daylight savings

Bug #1910162 reported by Alex Murray
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
jq (Debian)
Fix Released
Unknown
jq (Ubuntu)
Fix Released
Medium
Christian Ehrhardt 
Focal
Fix Released
Low
Unassigned
Groovy
Fix Released
Low
Unassigned
Hirsute
Fix Released
Medium
Christian Ehrhardt 

Bug Description

[Impact]

 * An upstream change in version 1.6 turned out to break
   depending on the current timezone (that is how it went undetected
   for so long)

 * Upstream undid the change and we want to follow them by backporting
   that.

[Test Case]

 * root@h:~# TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T01:00:00Z"

This should return the same time as it was passed.

[Where problems could occur]

 * jq can do many things and handling date conversions is just a small
   fraction of it. But in that fraction fromdate|todate and regressions
   would happen to take place.
   And vice versa - if a jq user does not use those conversions it should
   be a no-op for him.

   Another regression could be if users were aware and added workarounds
   (like doing -1 after the conversion). Obviously by fixing this it would
   then be -1 off afterwards.

[Other Info]

 * n/a

---

When trying to build jq locally it FTBFS for me since the unit tests that run during the build and check the output of fromdate fail:

Testing 'fromdate' at line number 642
*** Expected 1425599507, but got 1425603107 for test at line number 644: fromdate
Testing 'strptime("%Y-%m-%dT%H:%M:%SZ")' at line number 646
Testing 'strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' at line number 650
*** Expected 1425599507, but got 1425603107 for test at line number 652: strptime("%Y-%m-%dT%H:%M:%SZ")|mktime

This is caused by this upstream bug https://github.com/stedolan/jq/issues/2001 which was fixed by this upstream commit https://github.com/stedolan/jq/commit/3c5b1419a278dfb192666b33197dc182c670290d but this fix is not yet in 1.6-2 as shipped in Ubuntu.

See attached for a debdiff which includes the upstream patch to resolve this.

Revision history for this message
Alex Murray (alexmurray) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "updated debdiff which references this bug number" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks, also the testcase in the issue is pretty obvious and easy to try.

root@h:~# TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T01:00:00Z"

This is broken in 1.6 and up and would be fixed by any new release og jq (but no release happened since Nov 2018).

Changed in jq (Ubuntu):
status: New → Confirmed
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Debian is affected just as much, and I'd try to fix it there as well.
Let me file it there and see how the response time on that works out.
From there we can decide to fix it as Ubuntu Delta or not.

Also given that Focal is an affected LTS I think we should consider fixing it there as well eventually.

Changed in jq (Ubuntu Groovy):
status: New → Triaged
Changed in jq (Ubuntu Focal):
status: New → Triaged
importance: Undecided → Medium
Changed in jq (Ubuntu Groovy):
importance: Undecided → Medium
Changed in jq (Ubuntu Hirsute):
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Changed in jq (Ubuntu Hirsute):
assignee: nobody → Christian Ehrhardt  (paelzer)
tags: added: server-next
Changed in jq (Ubuntu Groovy):
importance: Medium → Low
Changed in jq (Ubuntu Focal):
importance: Medium → Low
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

While waiting for this to be accepted in Debian and being able to be a sync again the change LGTM and is simple enough to be a Delta for now.

Built in [1] and tested to be fine.

root@h:~# TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T00:00:00Z"

Uploaded to Hirsute, thanks Alex!

[1]: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/4385/+packages

Changed in jq (Ubuntu Hirsute):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package jq - 1.6-2.1ubuntu1

---------------
jq (1.6-2.1ubuntu1) hirsute; urgency=medium

  [ Alex Murray ]
  * Fix fromdate when local time is during daylight savings (LP: #1910162)
    - d/p/fix-ftbfs-when-localtime-is-dst.patch: Backport upstream patch
      which ensures fromdate uses the correct time during daylight savings

 -- Christian Ehrhardt <email address hidden> Tue, 05 Jan 2021 08:03:50 +0100

Changed in jq (Ubuntu Hirsute):
status: In Progress → Fix Released
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
description: updated
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Tested fine from the PPA, change is still the same that Alex proposed for Hirsute.
Uploading to F/G-unapproved

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Alex, or anyone else affected,

Accepted jq into groovy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/jq/1.6-1ubuntu0.20.10.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-groovy to verification-done-groovy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-groovy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in jq (Ubuntu Groovy):
status: Triaged → Fix Committed
tags: added: verification-needed verification-needed-groovy
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Alex, or anyone else affected,

Accepted jq into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/jq/1.6-1ubuntu0.20.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in jq (Ubuntu Focal):
status: Triaged → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Alex Murray (alexmurray) wrote :

Verified on up-to-date focal and groovy installs as follows:

# enable proposed
cat <<EOF | sudo tee /etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list
# Enable Ubuntu proposed archive
deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe
EOF

# only selectively upgrade from proposed
cat <<EOF | sudo tee /etc/apt/preferences.d/proposed-updates
# Configure apt to allow selective installs of packages from proposed
Package: *
Pin: release a=$(lsb_release -cs)-proposed
Pin-Priority: 400
EOF

sudo apt-get update
sudo apt-get install -y jq/$(lsb_release -cs)-proposed libjq1/$(lsb_release -cs)-proposed

# run test-case from the bug description
TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate' | grep -q "2018-08-31T00:00:00Z" && echo 'passed' || echo 'FAIL'

In each case, 'passed' was observed (and prior to the update from -proposed FAIL was observed)

tags: added: verification-done verification-done-focal verification-done-groovy
removed: verification-needed verification-needed-focal verification-needed-groovy
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Pre fix on F&G 1.6-1

root@g:~# TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T01:00:00Z"

Post fix versions are on:
1.6-1ubuntu0.20.04.1
1.6-1ubuntu0.20.10.1

root@f:~# TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T00:00:00Z"

root@g:~# TZ=America/New_York jq -n '"2018-08-31T00:00:00Z"|fromdate|todate'
"2018-08-31T00:00:00Z"

Works just fine, I did not see any other issues on upgrades (but haven't done excessive testing).
Marking as verified

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ok, testing it twice it seems :-)
At least it was a cheap and fast test so not much time wasted.

Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for jq has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package jq - 1.6-1ubuntu0.20.04.1

---------------
jq (1.6-1ubuntu0.20.04.1) focal; urgency=medium

  [ Alex Murray ]
  * Fix fromdate when local time is during daylight savings (LP: #1910162)
    - d/p/fix-ftbfs-when-localtime-is-dst.patch: Backport upstream patch
      which ensures fromdate uses the correct time during daylight savings

 -- Christian Ehrhardt <email address hidden> Tue, 05 Jan 2021 08:03:50 +0100

Changed in jq (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package jq - 1.6-1ubuntu0.20.10.1

---------------
jq (1.6-1ubuntu0.20.10.1) groovy; urgency=medium

  [ Alex Murray ]
  * Fix fromdate when local time is during daylight savings (LP: #1910162)
    - d/p/fix-ftbfs-when-localtime-is-dst.patch: Backport upstream patch
      which ensures fromdate uses the correct time during daylight savings

 -- Christian Ehrhardt <email address hidden> Tue, 05 Jan 2021 08:03:50 +0100

Changed in jq (Ubuntu Groovy):
status: Fix Committed → Fix Released
Changed in jq (Debian):
status: Unknown → New
Changed in jq (Debian):
status: New → 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.