GNU logs - #17161, boring messages


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#17161: Bug in date arithmetic of date
Resent-From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Tue, 01 Apr 2014 15:51:04 +0000
Resent-Message-ID: <handler.17161.B.13963674413468 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 17161
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: 17161 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-coreutils@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.13963674413468
          (code B ref -1); Tue, 01 Apr 2014 15:51:04 +0000
Received: (at submit) by debbugs.gnu.org; 1 Apr 2014 15:50:41 +0000
Received: from localhost ([127.0.0.1]:59538 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV0xU-0000ts-77
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 11:50:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57154)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WUwua-0001Hw-P3
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007ng-M5
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38652)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007nc-Ja
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58673)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuJ-0003Np-4L
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007gm-Lm
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:07 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:38073)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007SO-Ga
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:30:59 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0004hW-Jj
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:21 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0007ml-3W
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:16 +0200
Date: Tue, 1 Apr 2014 13:30:16 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Message-ID: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-SNT-Signature: f6dda9c21ec6c20fb742f2ad25af7f8a099a7ad2
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Mailman-Approved-At: Tue, 01 Apr 2014 11:50:38 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi,

There seems to be some weirdness in date arithmetic when dates
include a time stamp (and all provided in ISO formatting):

Correct:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11" +"%Y-%m-%d %H:%M:%S"
2014-03-11 00:00:00

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-10 00:00:00

Incorrect:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 15:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 11:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 13:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 11:34:00





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Subject: bug#17161: Acknowledgement (Bug in date arithmetic of date)
Message-ID: <handler.17161.B.13963674413468.ack <at> debbugs.gnu.org>
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Gnu-PR-Message: ack 17161
X-Gnu-PR-Package: coreutils
Reply-To: 17161 <at> debbugs.gnu.org
Date: Tue, 01 Apr 2014 15:51:05 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-coreutils@HIDDEN

If you wish to submit further information on this problem, please
send it to 17161 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
17161: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17161
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#17161: Acknowledgement (Bug in date arithmetic of date)
Resent-From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Tue, 01 Apr 2014 16:03:02 +0000
Resent-Message-ID: <handler.17161.B17161.13963681344788 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 17161
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: 17161 <at> debbugs.gnu.org
Received: via spool by 17161-submit <at> debbugs.gnu.org id=B17161.13963681344788
          (code B ref 17161); Tue, 01 Apr 2014 16:03:02 +0000
Received: (at 17161) by debbugs.gnu.org; 1 Apr 2014 16:02:14 +0000
Received: from localhost ([127.0.0.1]:59561 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV18b-0001Eu-4X
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:02:13 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:55182)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WV18U-0001Do-0W
 for 17161 <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:02:07 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WV18Q-0001gn-MQ
 for 17161 <at> debbugs.gnu.org; Tue, 01 Apr 2014 18:02:00 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WV18Q-0007iG-FN
 for 17161 <at> debbugs.gnu.org; Tue, 01 Apr 2014 18:01:58 +0200
Date: Tue, 1 Apr 2014 18:01:58 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
In-Reply-To: <handler.17161.B.13963674413468.ack <at> debbugs.gnu.org>
Message-ID: <alpine.DEB.2.00.1404011759430.29039@HIDDEN>
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.B.13963674413468.ack <at> debbugs.gnu.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SNT-Signature: 4f5d08f46eba6dd222b82276e28a5254388c0835
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-Spam-Score: -2.9 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

Additional information -

The behaviour occurs in GNU coreutils 7.4. Version 8.5 appears to work 
correctly so this may be a dupe.




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 1 Apr 2014 16:05:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 01 12:05:36 2014
Received: from localhost ([127.0.0.1]:59567 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV1Bv-0001KS-Gk
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:05:35 -0400
Received: from mx1.redhat.com ([209.132.183.28]:63910)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>)
 id 1WV1Bq-0001KA-7Y; Tue, 01 Apr 2014 12:05:32 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s31G5STX016624
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Tue, 1 Apr 2014 12:05:28 -0400
Received: from [10.3.113.179] (ovpn-113-179.phx2.redhat.com [10.3.113.179])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s31G5Sdb019750; Tue, 1 Apr 2014 12:05:28 -0400
Message-ID: <533AE3C7.8080502@HIDDEN>
Date: Tue, 01 Apr 2014 10:05:27 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161-done <at> debbugs.gnu.org
Subject: Re: bug#17161: Bug in date arithmetic of date
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
In-Reply-To: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="KxhlDcLjA11FDMJb87wBrbhia329BTCW8"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.6 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

tag 17161 notabug
thanks

On 04/01/2014 05:30 AM, Marc R.J. Brevoort wrote:
> Hi,
>=20
> There seems to be some weirdness in date arithmetic when dates
> include a time stamp (and all provided in ISO formatting):

The weirdness is caused by your choice of locale, coupled with your
government's use of daylight savings, and not a bug in 'date'.

See also the FAQ:
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-co=
mmand-is-not-working-right_002e

> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 15:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 11:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 13:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 11:34:00

These examples happen to cross a daylight savings boundary in your
current locale.  If you would amend your example to include time zone
names, you would see the name change, as evidence that the dates listed
are really 2 (or 24) hours apart, even though the wall clock time
appears to be 1 hour off.

You can also force date to operate on --utc, which does not observe
daylight savings, and therefore is immune to these oddities.

As such, I'm closing this as not a bug.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTOuPHAAoJEKeha0olJ0Nqw7AIAK5OcxxcEVA5u04FpnvlHhLN
cfrI3cpPUCV2LIafrAGh+6Tbu8blEa0YC9NrsfJEOKgLMab1JRimcFKfsLXlIBCJ
4bBd4peiMohVN4teUMW1YgOdoMWLRT4pa7VAHt8BKOG5IIQ5uhqNvThq1N1SvxqW
gTHlG++h6W72y+xsIcAosK1B/dh27q8qeuVyvx9l2m8YZ7yY6CV54isWOLog6ChO
EQzZcDfEXjDf565snyhtgdVTT2FxppzYUrMv433T3kdrPRziFY6bNeg9DN/c+bfR
630TAHXfZAFdb2Az4kVBeJN74fD6aB85v2gkcWwuMi0aqGir3u6XlV84Bo/bJ2s=
=41YW
-----END PGP SIGNATURE-----

--KxhlDcLjA11FDMJb87wBrbhia329BTCW8--




Message sent:


MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Eric Blake <eblake@HIDDEN>
Subject: bug#17161: closed (Bug in date arithmetic of date)
CC: tracker <at> debbugs.gnu.org
Message-ID: <handler.17161.D17161.13963683355115.ackdone <at> debbugs.gnu.org>
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Gnu-PR-Message: closed 17161
X-Gnu-PR-Package: coreutils
X-Gnu-PR-Keywords: notabug
Date: Tue, 01 Apr 2014 16:06:03 +0000
Content-Type: multipart/mixed; boundary="----------=_1396368363-5170-0"

This is a multi-part message in MIME format...

------------=_1396368363-5170-0
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8

Your message dated Tue, 01 Apr 2014 10:05:27 -0600
with message-id <533AE3C7.8080502@HIDDEN>
and subject line Re: bug#17161: Bug in date arithmetic of date
has caused the debbugs.gnu.org bug report #17161,
regarding Bug in date arithmetic of date
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@HIDDEN)


--=20
17161: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17161
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems

------------=_1396368363-5170-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at submit) by debbugs.gnu.org; 1 Apr 2014 15:50:41 +0000
Received: from localhost ([127.0.0.1]:59538 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV0xU-0000ts-77
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 11:50:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57154)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WUwua-0001Hw-P3
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007ng-M5
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38652)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007nc-Ja
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58673)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuJ-0003Np-4L
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007gm-Lm
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:07 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:38073)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007SO-Ga
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:30:59 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0004hW-Jj
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:21 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0007ml-3W
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:16 +0200
Date: Tue, 1 Apr 2014 13:30:16 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: Bug in date arithmetic of date
Message-ID: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-SNT-Signature: f6dda9c21ec6c20fb742f2ad25af7f8a099a7ad2
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 01 Apr 2014 11:50:38 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi,

There seems to be some weirdness in date arithmetic when dates
include a time stamp (and all provided in ISO formatting):

Correct:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11" +"%Y-%m-%d %H:%M:%S"
2014-03-11 00:00:00

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-10 00:00:00

Incorrect:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 15:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 11:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 13:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 11:34:00




------------=_1396368363-5170-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 17161-done) by debbugs.gnu.org; 1 Apr 2014 16:05:35 +0000
Received: from localhost ([127.0.0.1]:59565 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV1Bu-0001KO-AO
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:05:35 -0400
Received: from mx1.redhat.com ([209.132.183.28]:63910)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>)
 id 1WV1Bq-0001KA-7Y; Tue, 01 Apr 2014 12:05:32 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s31G5STX016624
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Tue, 1 Apr 2014 12:05:28 -0400
Received: from [10.3.113.179] (ovpn-113-179.phx2.redhat.com [10.3.113.179])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s31G5Sdb019750; Tue, 1 Apr 2014 12:05:28 -0400
Message-ID: <533AE3C7.8080502@HIDDEN>
Date: Tue, 01 Apr 2014 10:05:27 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161-done <at> debbugs.gnu.org
Subject: Re: bug#17161: Bug in date arithmetic of date
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
In-Reply-To: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="KxhlDcLjA11FDMJb87wBrbhia329BTCW8"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: 17161-done
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.6 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

tag 17161 notabug
thanks

On 04/01/2014 05:30 AM, Marc R.J. Brevoort wrote:
> Hi,
>=20
> There seems to be some weirdness in date arithmetic when dates
> include a time stamp (and all provided in ISO formatting):

The weirdness is caused by your choice of locale, coupled with your
government's use of daylight savings, and not a bug in 'date'.

See also the FAQ:
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-co=
mmand-is-not-working-right_002e

> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 15:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 11:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 13:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 11:34:00

These examples happen to cross a daylight savings boundary in your
current locale.  If you would amend your example to include time zone
names, you would see the name change, as evidence that the dates listed
are really 2 (or 24) hours apart, even though the wall clock time
appears to be 1 hour off.

You can also force date to operate on --utc, which does not observe
daylight savings, and therefore is immune to these oddities.

As such, I'm closing this as not a bug.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTOuPHAAoJEKeha0olJ0Nqw7AIAK5OcxxcEVA5u04FpnvlHhLN
cfrI3cpPUCV2LIafrAGh+6Tbu8blEa0YC9NrsfJEOKgLMab1JRimcFKfsLXlIBCJ
4bBd4peiMohVN4teUMW1YgOdoMWLRT4pa7VAHt8BKOG5IIQ5uhqNvThq1N1SvxqW
gTHlG++h6W72y+xsIcAosK1B/dh27q8qeuVyvx9l2m8YZ7yY6CV54isWOLog6ChO
EQzZcDfEXjDf565snyhtgdVTT2FxppzYUrMv433T3kdrPRziFY6bNeg9DN/c+bfR
630TAHXfZAFdb2Az4kVBeJN74fD6aB85v2gkcWwuMi0aqGir3u6XlV84Bo/bJ2s=
=41YW
-----END PGP SIGNATURE-----

--KxhlDcLjA11FDMJb87wBrbhia329BTCW8--


------------=_1396368363-5170-0--


Message sent:


MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Subject: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
Message-ID: <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Gnu-PR-Message: they-closed 17161
X-Gnu-PR-Package: coreutils
X-Gnu-PR-Keywords: notabug
Reply-To: 17161 <at> debbugs.gnu.org
Date: Tue, 01 Apr 2014 16:06:04 +0000
Content-Type: multipart/mixed; boundary="----------=_1396368364-5170-1"

This is a multi-part message in MIME format...

------------=_1396368364-5170-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"

Your bug report

#17161: Bug in date arithmetic of date

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 17161 <at> debbugs.gnu.org.

--=20
17161: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17161
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems

------------=_1396368364-5170-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 17161-done) by debbugs.gnu.org; 1 Apr 2014 16:05:35 +0000
Received: from localhost ([127.0.0.1]:59565 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV1Bu-0001KO-AO
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:05:35 -0400
Received: from mx1.redhat.com ([209.132.183.28]:63910)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>)
 id 1WV1Bq-0001KA-7Y; Tue, 01 Apr 2014 12:05:32 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s31G5STX016624
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Tue, 1 Apr 2014 12:05:28 -0400
Received: from [10.3.113.179] (ovpn-113-179.phx2.redhat.com [10.3.113.179])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s31G5Sdb019750; Tue, 1 Apr 2014 12:05:28 -0400
Message-ID: <533AE3C7.8080502@HIDDEN>
Date: Tue, 01 Apr 2014 10:05:27 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161-done <at> debbugs.gnu.org
Subject: Re: bug#17161: Bug in date arithmetic of date
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
In-Reply-To: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="KxhlDcLjA11FDMJb87wBrbhia329BTCW8"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: 17161-done
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.6 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

tag 17161 notabug
thanks

On 04/01/2014 05:30 AM, Marc R.J. Brevoort wrote:
> Hi,
>=20
> There seems to be some weirdness in date arithmetic when dates
> include a time stamp (and all provided in ISO formatting):

The weirdness is caused by your choice of locale, coupled with your
government's use of daylight savings, and not a bug in 'date'.

See also the FAQ:
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-co=
mmand-is-not-working-right_002e

> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 15:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 11:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 13:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 11:34:00

These examples happen to cross a daylight savings boundary in your
current locale.  If you would amend your example to include time zone
names, you would see the name change, as evidence that the dates listed
are really 2 (or 24) hours apart, even though the wall clock time
appears to be 1 hour off.

You can also force date to operate on --utc, which does not observe
daylight savings, and therefore is immune to these oddities.

As such, I'm closing this as not a bug.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTOuPHAAoJEKeha0olJ0Nqw7AIAK5OcxxcEVA5u04FpnvlHhLN
cfrI3cpPUCV2LIafrAGh+6Tbu8blEa0YC9NrsfJEOKgLMab1JRimcFKfsLXlIBCJ
4bBd4peiMohVN4teUMW1YgOdoMWLRT4pa7VAHt8BKOG5IIQ5uhqNvThq1N1SvxqW
gTHlG++h6W72y+xsIcAosK1B/dh27q8qeuVyvx9l2m8YZ7yY6CV54isWOLog6ChO
EQzZcDfEXjDf565snyhtgdVTT2FxppzYUrMv433T3kdrPRziFY6bNeg9DN/c+bfR
630TAHXfZAFdb2Az4kVBeJN74fD6aB85v2gkcWwuMi0aqGir3u6XlV84Bo/bJ2s=
=41YW
-----END PGP SIGNATURE-----

--KxhlDcLjA11FDMJb87wBrbhia329BTCW8--


------------=_1396368364-5170-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at submit) by debbugs.gnu.org; 1 Apr 2014 15:50:41 +0000
Received: from localhost ([127.0.0.1]:59538 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV0xU-0000ts-77
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 11:50:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57154)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WUwua-0001Hw-P3
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007ng-M5
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38652)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007nc-Ja
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58673)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuJ-0003Np-4L
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007gm-Lm
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:07 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:38073)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007SO-Ga
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:30:59 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0004hW-Jj
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:21 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0007ml-3W
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:16 +0200
Date: Tue, 1 Apr 2014 13:30:16 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: Bug in date arithmetic of date
Message-ID: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-SNT-Signature: f6dda9c21ec6c20fb742f2ad25af7f8a099a7ad2
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 01 Apr 2014 11:50:38 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi,

There seems to be some weirdness in date arithmetic when dates
include a time stamp (and all provided in ISO formatting):

Correct:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11" +"%Y-%m-%d %H:%M:%S"
2014-03-11 00:00:00

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-10 00:00:00

Incorrect:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 15:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 11:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 13:34:00
mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 11:34:00




------------=_1396368364-5170-1--


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
Resent-From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Wed, 02 Apr 2014 08:19:01 +0000
Resent-Message-ID: <handler.17161.B17161.139642668925859 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 17161
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: notabug
To: 17161 <at> debbugs.gnu.org
Received: via spool by 17161-submit <at> debbugs.gnu.org id=B17161.139642668925859
          (code B ref 17161); Wed, 02 Apr 2014 08:19:01 +0000
Received: (at 17161) by debbugs.gnu.org; 2 Apr 2014 08:18:09 +0000
Received: from localhost ([127.0.0.1]:60337 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WVGN5-0006j0-QS
	for submit <at> debbugs.gnu.org; Wed, 02 Apr 2014 04:18:08 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:51801)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WVGN0-0006ia-9V
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 04:18:06 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WVGMt-00032t-V4
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:18:00 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WVGMt-0003ur-OY
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:17:55 +0200
Date: Wed, 2 Apr 2014 10:17:55 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
In-Reply-To: <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
Message-ID: <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SNT-Signature: d6a583d75c59b3983c75df41cc0d08d84334eb49
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-Spam-Score: -2.9 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

Hello,

As a heads-up, the explanation that this is due to time zone+locale doesn't make sense:

mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -1 day" +"%Y-%m-%d 
%H:%M:%S"
2014-03-12 13:34:56
mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -2 days" +"%Y-%m-%d 
%H:%M:%S"
2014-03-12 14:34:56
mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -3 days" +"%Y-%m-%d 
%H:%M:%S"
2014-03-12 15:34:56

The more days I subtract, the more hours are added. If this were a time 
zone issue, the amount of hours added would be constant but the 
resulting date would not.

Best,
Marc

On Tue, 1 Apr 2014, GNU bug Tracking System wrote:

> Your bug report
>
> #17161: Bug in date arithmetic of date
>
> which was filed against the coreutils package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 17161 <at> debbugs.gnu.org.
>
> -- 
> 17161: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17161
> GNU Bug Tracking System
> Contact help-debbugs@HIDDEN with problems
>




Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
Resent-From: Eric Blake <eblake@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Wed, 02 Apr 2014 11:28:02 +0000
Resent-Message-ID: <handler.17161.B17161.139643807312687 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 17161
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: notabug
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161 <at> debbugs.gnu.org, Bug-gnulib <bug-gnulib@HIDDEN>
Received: via spool by 17161-submit <at> debbugs.gnu.org id=B17161.139643807312687
          (code B ref 17161); Wed, 02 Apr 2014 11:28:02 +0000
Received: (at 17161) by debbugs.gnu.org; 2 Apr 2014 11:27:53 +0000
Received: from localhost ([127.0.0.1]:60410 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WVJKi-0003IY-UK
	for submit <at> debbugs.gnu.org; Wed, 02 Apr 2014 07:27:53 -0400
Received: from mx1.redhat.com ([209.132.183.28]:31045)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1WVJKe-0003II-Mi
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 07:27:51 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s32BRj3T027269
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Wed, 2 Apr 2014 07:27:45 -0400
Received: from [10.3.113.66] (ovpn-113-66.phx2.redhat.com [10.3.113.66])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s32BRhEX008453; Wed, 2 Apr 2014 07:27:44 -0400
Message-ID: <533BF42F.30600@HIDDEN>
Date: Wed, 02 Apr 2014 05:27:43 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
References: <533AE3C7.8080502@HIDDEN>	<alpine.DEB.2.00.1404011325170.29333@HIDDEN>	<handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
In-Reply-To: <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -5.6 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.6 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

reopen 17161
thanks

On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
> Hello,
>=20
> As a heads-up, the explanation that this is due to time zone+locale
> doesn't make sense:
>=20
> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -1 day" +"%Y-%m-%=
d
> %H:%M:%S"
> 2014-03-12 13:34:56
> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -2 days"
> +"%Y-%m-%d %H:%M:%S"
> 2014-03-12 14:34:56
> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -3 days"
> +"%Y-%m-%d %H:%M:%S"
> 2014-03-12 15:34:56
>=20
> The more days I subtract, the more hours are added. If this were a time=

> zone issue, the amount of hours added would be constant but the
> resulting date would not.

Thanks for persisting.  I was able to reproduce using coreutils.git, and
I can explain what's happening.  Date is parsing this as:

"(2014-03-11 12:34:56 -3) (days)"

that is, -3 is being treated as the timezone, since it occurs next to
the hour specification; then treating "days" as "+1 day" or "+24 hours".

Watch what happens when you reorder the line to force a different parse:

$ src/date --utc -d "-3 days 2014-03-11 12:34:56" +"%Y-%m-%d %H:%M:%S"
2014-03-08 12:34:56

It does indeed seem awkward that date is not parsing this as:

"(2014-03-11 12:34:56) (-3 days)"

but fixing that will require tweaks to the getdate.y parser in gnulib.
I've reopened the bug to track the issue with awkward precedence in the
parser.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTO/QvAAoJEKeha0olJ0NqR1UH/jjolWOVgbdOScUoOGwUCRzC
HawkO2f/ALo8aG0ZLvFyy3K8SpwaIUfdSFwgX0da0YgAGr8U9MlOCz1vrd2ykeyM
qPk0IyEUk0syaqZLlHOWGJhqShwmxhYxP5304uQN2f/+6rCenCQxpvXS/SoQTGvd
T7W/SxTd4LbOweN27BPzB6NDTVHk0GgXLyXtaqrvAQ1/gqvbn1fJ1WnlOzft4xKX
2sy/0c5l51Tz8urtab5u2hl60SEcgK+Bmp0FpF8C8O348/I9zQJMDDTAIJ5yiY+N
RubFiNutkVfaues5GxsQW57E87HIQgd6S1t0kk5rSZGG29ePhLKUKxdWt+MloxE=
=xj30
-----END PGP SIGNATURE-----

--l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2--




Message received at fakecontrol@fakecontrolmessage:


Received: (at fakecontrol) by fakecontrolmessage;
To: internal_control <at> debbugs.gnu.org
From: Debbugs Internal Request <help-debbugs@HIDDEN>
Subject: Internal Control
Message-Id: Did not alter fixed versions and reopened.
Date: Wed, 02 Apr 2014 11:34:02 +0000
User-Agent: Fakemail v42.6.9

# This is a fake control message.
#
# The action:
# Did not alter fixed versions and reopened.
thanks
# This fakemail brought to you by your local debbugs
# administrator


Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
Resent-From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Wed, 02 Apr 2014 14:49:02 +0000
Resent-Message-ID: <handler.17161.B17161.13964501319575 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 17161
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: notabug
To: Eric Blake <eblake@HIDDEN>
Cc: Bug-gnulib <bug-gnulib@HIDDEN>, 17161 <at> debbugs.gnu.org
Received: via spool by 17161-submit <at> debbugs.gnu.org id=B17161.13964501319575
          (code B ref 17161); Wed, 02 Apr 2014 14:49:02 +0000
Received: (at 17161) by debbugs.gnu.org; 2 Apr 2014 14:48:51 +0000
Received: from localhost ([127.0.0.1]:33055 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WVMTC-0002UM-O7
	for submit <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:48:51 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:45434)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WVMT9-0002UB-TV
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:48:48 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>)
 id 1WVMT2-0006ZG-Df; Wed, 02 Apr 2014 16:48:45 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>)
 id 1WVMT2-0007LE-77; Wed, 02 Apr 2014 16:48:40 +0200
Date: Wed, 2 Apr 2014 16:48:40 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
In-Reply-To: <533BF42F.30600@HIDDEN>
Message-ID: <alpine.DEB.2.00.1404021643230.27572@HIDDEN>
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
 <533BF42F.30600@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SNT-Signature: 2b153a896f0dfa2f28738383baeed568565feb5f
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-Spam-Score: -2.9 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

Hi,

Yes, I've come to the same conclusion (i.e. the numeric value in "+3 days" 
or "-2 days" being treated as time zone). The 8.5 coreutils I tested on 
is in a different time zone so it is possible it doesn't exhibit the same 
behavior because of that, and as such I can't actually tell whether the
behavior is actually resolved in coreutils 8.5.

I confirm that if I type,

mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 0 -1 day" +"%Y-%m-%d
  %H:%M:%S"

(i.e. using "0" as time zone), this gives the expected output,

2014-03-10 12:34:56

Best,
Marc


On Wed, 2 Apr 2014, Eric Blake wrote:

> reopen 17161
> thanks
>
> On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
>> Hello,
>>
>> As a heads-up, the explanation that this is due to time zone+locale
>> doesn't make sense:
>>
>> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -1 day" +"%Y-%m-%d
>> %H:%M:%S"
>> 2014-03-12 13:34:56
>> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -2 days"
>> +"%Y-%m-%d %H:%M:%S"
>> 2014-03-12 14:34:56
>> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -3 days"
>> +"%Y-%m-%d %H:%M:%S"
>> 2014-03-12 15:34:56
>>
>> The more days I subtract, the more hours are added. If this were a time
>> zone issue, the amount of hours added would be constant but the
>> resulting date would not.
>
> Thanks for persisting.  I was able to reproduce using coreutils.git, and
> I can explain what's happening.  Date is parsing this as:
>
> "(2014-03-11 12:34:56 -3) (days)"
>
> that is, -3 is being treated as the timezone, since it occurs next to
> the hour specification; then treating "days" as "+1 day" or "+24 hours".
>
> Watch what happens when you reorder the line to force a different parse:
>
> $ src/date --utc -d "-3 days 2014-03-11 12:34:56" +"%Y-%m-%d %H:%M:%S"
> 2014-03-08 12:34:56
>
> It does indeed seem awkward that date is not parsing this as:
>
> "(2014-03-11 12:34:56) (-3 days)"
>
> but fixing that will require tweaks to the getdate.y parser in gnulib.
> I've reopened the bug to track the issue with awkward precedence in the
> parser.
>
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 8 Apr 2014 17:24:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 08 13:24:29 2014
Received: from localhost ([127.0.0.1]:41149 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WXZl6-0001a7-En
	for submit <at> debbugs.gnu.org; Tue, 08 Apr 2014 13:24:28 -0400
Received: from joseki.proulx.com ([216.17.153.58]:59658)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bob@HIDDEN>) id 1WXZl4-0001Zy-3R
 for control <at> debbugs.gnu.org; Tue, 08 Apr 2014 13:24:26 -0400
Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119])
 by joseki.proulx.com (Postfix) with ESMTP id A929D21228
 for <control <at> debbugs.gnu.org>; Tue,  8 Apr 2014 11:24:25 -0600 (MDT)
Received: by hysteria.proulx.com (Postfix, from userid 1000)
 id 82DA92DC9A; Tue,  8 Apr 2014 11:24:25 -0600 (MDT)
Date: Tue, 8 Apr 2014 11:24:25 -0600
From: Bob Proulx <bob@HIDDEN>
To: control <at> debbugs.gnu.org
Subject: untag notabug
Message-ID: <20140408172425.GA23120@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Spam-Score: -0.3 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

tag 17161 - notabug
thanks

This was re-opened to address the timezone but not untagged.
Untagging now.




Message sent to bug-coreutils@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#17161: date: confusing: "TIME -/+NUM" treated as time zone
Resent-From: Assaf Gordon <assafgordon@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Sat, 20 Oct 2018 03:15:01 +0000
Resent-Message-ID: <handler.17161.B17161.154000524614191 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 17161
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords: 
To: Eric Blake <eblake@HIDDEN>, "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161 <at> debbugs.gnu.org
Received: via spool by 17161-submit <at> debbugs.gnu.org id=B17161.154000524614191
          (code B ref 17161); Sat, 20 Oct 2018 03:15:01 +0000
Received: (at 17161) by debbugs.gnu.org; 20 Oct 2018 03:14:06 +0000
Received: from localhost ([127.0.0.1]:60099 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gDhiI-0003gj-7m
	for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 23:14:06 -0400
Received: from mail-it1-f178.google.com ([209.85.166.178]:39976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1gDhiG-0003g3-Ar; Fri, 19 Oct 2018 23:14:04 -0400
Received: by mail-it1-f178.google.com with SMTP id i191-v6so6719355iti.5;
 Fri, 19 Oct 2018 20:14:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=EbkDK2WIqmiMLVXi8hmFgnQq0bFb+U89WQP7elOlxPwIMgVA2bN9W47p3bZpanBIhF
 q3/HTyMh23ibZj6LyQ9+zMFpz5GeqUIr11CpQwoKwt2K//3hzXb0XYwaBbmOCCKbCaJ2
 5H9Papeubja2GBB65PtBhuVCC9gyGzaXxNLa9aVCOuVBrruIQV+wG0DRh+2JnSxr6r63
 pnBTOnPlXZNP27pGVWpQ6JPt/GtpHlcS3hIXnIoFLHgc6jN/xs8cYb/OdsRJV9YHHBkd
 mb8PCCUkGYkutSy2rLMjtq9Qe7e7yUxNuI5ZK23VOpLpIVNYFF8TjG/KKoBn2dXQw7ZG
 VqvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=unNLEsZIwU5t8OUf/OGk6Fg9wHTIBwLHgFWXWxJNiQZdXW0asg71nlnSdBYx9lKg7e
 L89PdreYIOvl6QKs94ExtD3uYJJ3W4hsTBc0Gs5gnX/cXiNdwucb7fnHpoqM5F9QnGPc
 /fV1Tjtxvn06uVmqjRBQ7S+UZk2dbCoz4cwJPkPLRcr4WAFW4eMKIo0pG/dMCPvheYdQ
 3zYQRnSzV3j42ujH7h/n6j9kyehDhiMmHFVCm9L1KT/MVkJcaCbW/z+zB9qFie6RF2mh
 jjAguVvDl+KZ/bnpkcctEYjXLI8dKb3w+eeBqwk8IQueAMLb4ihcZmQRllb9KAsNBZOs
 qeAw==
X-Gm-Message-State: ABuFfojkv8sqOYh+m8ejCCnBPmP/4LBlISajitrcqIQA2Pgx7gh+kgKr
 CxVI4d91z1bJetiIp1lb3qaO2RNn+fY=
X-Google-Smtp-Source: ACcGV63ghPFegpHnL32Yz+PyjuEF0pqMk7O6SFO5o26sLWMczKpfCxat4T+XfgoT6SDmDrt016L0Rg==
X-Received: by 2002:a02:7f0e:: with SMTP id
 r14-v6mr26158809jac.124.1540005237833; 
 Fri, 19 Oct 2018 20:13:57 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 82-v6sm1937446ita.17.2018.10.19.20.13.56
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 19 Oct 2018 20:13:56 -0700 (PDT)
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
 <533BF42F.30600@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <de234f7a-ec3e-13c4-af7d-ca28696dee4d@HIDDEN>
Date: Fri, 19 Oct 2018 21:13:55 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <533BF42F.30600@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 17161 wishlist
retitle 17161 date: confusing: "TIME -/+NUM" treated as time zone
stop

(triaging old bugs)

Hello,

On 02/04/14 05:27 AM, Eric Blake wrote:
> On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
>>
>> The more days I subtract, the more hours are added. If this were a time
>> zone issue, the amount of hours added would be constant but the
>> resulting date would not.
> 
> Thanks for persisting.  I was able to reproduce using coreutils.git, and
> I can explain what's happening.  Date is parsing this as:
> 
> "(2014-03-11 12:34:56 -3) (days)"
[...]
> It does indeed seem awkward that date is not parsing this as:
> 
> "(2014-03-11 12:34:56) (-3 days)"
> 
> but fixing that will require tweaks to the getdate.y parser in gnulib.
> I've reopened the bug to track the issue with awkward precedence in the
> parser.

In the mean time, date gained the "--debug" option that makes
diagnosing these issues somewhat easier.

Due to the way the date parser works, the following
rules apply:

1.
Time (HH:MM:SS) followed by a plus/minus character
and a number - ALWAYS parsed as time zone.
The unit that followed (e.g. "days" / "minutes")
are then taken to be of value 1 (e.g. 1 day, 1 minute).

Examples:

   ## This is "Timezone=3, plus one day"
   $ date --debug -d "2014-03-11 12:34:56 +3 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC+03
   date: parsed relative part: +1 day(s)
   date: input timezone: parsed date/time string (+03)
   [...]
   Wed Mar 12 03:34:56 MDT 2014

   ## This is "Timezone=-10, plus one month"
   $ date --debug -d "2014-03-11 12:34:56 -10 months"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: +1 month(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Fri Apr 11 16:34:56 MDT 2014


2.
Time (HH:MM:SS) followed by a number without plus/minus sign,
The number applies to the units.

   ## This is "time, plus 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: +7 seconds
   [...]
   Tue Mar 11 12:35:03 MDT 2014

3.
To subtract units (e.g. three days) without using a minus character
(i.e. forcing rule #2 instead of triggering rule #1), use the word "ago":

   ## This is "time - 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -7 seconds
   [...]
   Tue Mar 11 12:34:49 MDT 2014

   ## This is 3 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 3 days ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -3 day(s)
   [...]
   Sat Mar  8 12:34:56 MST 2014

Or use Eric's suggestion of putting the "-3 days"
before the date.

4.
Combining a time zone and a unit value is valid,
e.g.

   ## Timezone = -10, 9 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 -10 -9 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: -9 day(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Sun Mar  2 15:34:56 MST 2014

----

As Eric wrote above, modifying the parser could be done in gnulib.
Not so much a technical problem, but very likely to be backward-
incompatible in a way that will break many many existing scripts.

As such, I'm marking this as "wishlist", but keeping it open -
discussion is welcomed to continue by replying to this thread.

regards,
  - assaf





Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 20 Oct 2018 03:14:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 19 23:14:06 2018
Received: from localhost ([127.0.0.1]:60097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gDhiH-0003gh-To
	for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 23:14:06 -0400
Received: from mail-it1-f178.google.com ([209.85.166.178]:39976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1gDhiG-0003g3-Ar; Fri, 19 Oct 2018 23:14:04 -0400
Received: by mail-it1-f178.google.com with SMTP id i191-v6so6719355iti.5;
 Fri, 19 Oct 2018 20:14:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=EbkDK2WIqmiMLVXi8hmFgnQq0bFb+U89WQP7elOlxPwIMgVA2bN9W47p3bZpanBIhF
 q3/HTyMh23ibZj6LyQ9+zMFpz5GeqUIr11CpQwoKwt2K//3hzXb0XYwaBbmOCCKbCaJ2
 5H9Papeubja2GBB65PtBhuVCC9gyGzaXxNLa9aVCOuVBrruIQV+wG0DRh+2JnSxr6r63
 pnBTOnPlXZNP27pGVWpQ6JPt/GtpHlcS3hIXnIoFLHgc6jN/xs8cYb/OdsRJV9YHHBkd
 mb8PCCUkGYkutSy2rLMjtq9Qe7e7yUxNuI5ZK23VOpLpIVNYFF8TjG/KKoBn2dXQw7ZG
 VqvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=unNLEsZIwU5t8OUf/OGk6Fg9wHTIBwLHgFWXWxJNiQZdXW0asg71nlnSdBYx9lKg7e
 L89PdreYIOvl6QKs94ExtD3uYJJ3W4hsTBc0Gs5gnX/cXiNdwucb7fnHpoqM5F9QnGPc
 /fV1Tjtxvn06uVmqjRBQ7S+UZk2dbCoz4cwJPkPLRcr4WAFW4eMKIo0pG/dMCPvheYdQ
 3zYQRnSzV3j42ujH7h/n6j9kyehDhiMmHFVCm9L1KT/MVkJcaCbW/z+zB9qFie6RF2mh
 jjAguVvDl+KZ/bnpkcctEYjXLI8dKb3w+eeBqwk8IQueAMLb4ihcZmQRllb9KAsNBZOs
 qeAw==
X-Gm-Message-State: ABuFfojkv8sqOYh+m8ejCCnBPmP/4LBlISajitrcqIQA2Pgx7gh+kgKr
 CxVI4d91z1bJetiIp1lb3qaO2RNn+fY=
X-Google-Smtp-Source: ACcGV63ghPFegpHnL32Yz+PyjuEF0pqMk7O6SFO5o26sLWMczKpfCxat4T+XfgoT6SDmDrt016L0Rg==
X-Received: by 2002:a02:7f0e:: with SMTP id
 r14-v6mr26158809jac.124.1540005237833; 
 Fri, 19 Oct 2018 20:13:57 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 82-v6sm1937446ita.17.2018.10.19.20.13.56
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 19 Oct 2018 20:13:56 -0700 (PDT)
Subject: Re: bug#17161: date: confusing: "TIME -/+NUM" treated as time zone
To: Eric Blake <eblake@HIDDEN>, "Marc R.J. Brevoort"
 <mrjb@HIDDEN>, 17161 <at> debbugs.gnu.org
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
 <533BF42F.30600@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <de234f7a-ec3e-13c4-af7d-ca28696dee4d@HIDDEN>
Date: Fri, 19 Oct 2018 21:13:55 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <533BF42F.30600@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 17161 wishlist
retitle 17161 date: confusing: "TIME -/+NUM" treated as time zone
stop

(triaging old bugs)

Hello,

On 02/04/14 05:27 AM, Eric Blake wrote:
> On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
>>
>> The more days I subtract, the more hours are added. If this were a time
>> zone issue, the amount of hours added would be constant but the
>> resulting date would not.
> 
> Thanks for persisting.  I was able to reproduce using coreutils.git, and
> I can explain what's happening.  Date is parsing this as:
> 
> "(2014-03-11 12:34:56 -3) (days)"
[...]
> It does indeed seem awkward that date is not parsing this as:
> 
> "(2014-03-11 12:34:56) (-3 days)"
> 
> but fixing that will require tweaks to the getdate.y parser in gnulib.
> I've reopened the bug to track the issue with awkward precedence in the
> parser.

In the mean time, date gained the "--debug" option that makes
diagnosing these issues somewhat easier.

Due to the way the date parser works, the following
rules apply:

1.
Time (HH:MM:SS) followed by a plus/minus character
and a number - ALWAYS parsed as time zone.
The unit that followed (e.g. "days" / "minutes")
are then taken to be of value 1 (e.g. 1 day, 1 minute).

Examples:

   ## This is "Timezone=3, plus one day"
   $ date --debug -d "2014-03-11 12:34:56 +3 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC+03
   date: parsed relative part: +1 day(s)
   date: input timezone: parsed date/time string (+03)
   [...]
   Wed Mar 12 03:34:56 MDT 2014

   ## This is "Timezone=-10, plus one month"
   $ date --debug -d "2014-03-11 12:34:56 -10 months"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: +1 month(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Fri Apr 11 16:34:56 MDT 2014


2.
Time (HH:MM:SS) followed by a number without plus/minus sign,
The number applies to the units.

   ## This is "time, plus 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: +7 seconds
   [...]
   Tue Mar 11 12:35:03 MDT 2014

3.
To subtract units (e.g. three days) without using a minus character
(i.e. forcing rule #2 instead of triggering rule #1), use the word "ago":

   ## This is "time - 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -7 seconds
   [...]
   Tue Mar 11 12:34:49 MDT 2014

   ## This is 3 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 3 days ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -3 day(s)
   [...]
   Sat Mar  8 12:34:56 MST 2014

Or use Eric's suggestion of putting the "-3 days"
before the date.

4.
Combining a time zone and a unit value is valid,
e.g.

   ## Timezone = -10, 9 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 -10 -9 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: -9 day(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Sun Mar  2 15:34:56 MST 2014

----

As Eric wrote above, modifying the parser could be done in gnulib.
Not so much a technical problem, but very likely to be backward-
incompatible in a way that will break many many existing scripts.

As such, I'm marking this as "wishlist", but keeping it open -
discussion is welcomed to continue by replying to this thread.

regards,
  - assaf





Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 20 Oct 2018 03:14:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 19 23:14:06 2018
Received: from localhost ([127.0.0.1]:60097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gDhiH-0003gh-To
	for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 23:14:06 -0400
Received: from mail-it1-f178.google.com ([209.85.166.178]:39976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1gDhiG-0003g3-Ar; Fri, 19 Oct 2018 23:14:04 -0400
Received: by mail-it1-f178.google.com with SMTP id i191-v6so6719355iti.5;
 Fri, 19 Oct 2018 20:14:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=EbkDK2WIqmiMLVXi8hmFgnQq0bFb+U89WQP7elOlxPwIMgVA2bN9W47p3bZpanBIhF
 q3/HTyMh23ibZj6LyQ9+zMFpz5GeqUIr11CpQwoKwt2K//3hzXb0XYwaBbmOCCKbCaJ2
 5H9Papeubja2GBB65PtBhuVCC9gyGzaXxNLa9aVCOuVBrruIQV+wG0DRh+2JnSxr6r63
 pnBTOnPlXZNP27pGVWpQ6JPt/GtpHlcS3hIXnIoFLHgc6jN/xs8cYb/OdsRJV9YHHBkd
 mb8PCCUkGYkutSy2rLMjtq9Qe7e7yUxNuI5ZK23VOpLpIVNYFF8TjG/KKoBn2dXQw7ZG
 VqvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=unNLEsZIwU5t8OUf/OGk6Fg9wHTIBwLHgFWXWxJNiQZdXW0asg71nlnSdBYx9lKg7e
 L89PdreYIOvl6QKs94ExtD3uYJJ3W4hsTBc0Gs5gnX/cXiNdwucb7fnHpoqM5F9QnGPc
 /fV1Tjtxvn06uVmqjRBQ7S+UZk2dbCoz4cwJPkPLRcr4WAFW4eMKIo0pG/dMCPvheYdQ
 3zYQRnSzV3j42ujH7h/n6j9kyehDhiMmHFVCm9L1KT/MVkJcaCbW/z+zB9qFie6RF2mh
 jjAguVvDl+KZ/bnpkcctEYjXLI8dKb3w+eeBqwk8IQueAMLb4ihcZmQRllb9KAsNBZOs
 qeAw==
X-Gm-Message-State: ABuFfojkv8sqOYh+m8ejCCnBPmP/4LBlISajitrcqIQA2Pgx7gh+kgKr
 CxVI4d91z1bJetiIp1lb3qaO2RNn+fY=
X-Google-Smtp-Source: ACcGV63ghPFegpHnL32Yz+PyjuEF0pqMk7O6SFO5o26sLWMczKpfCxat4T+XfgoT6SDmDrt016L0Rg==
X-Received: by 2002:a02:7f0e:: with SMTP id
 r14-v6mr26158809jac.124.1540005237833; 
 Fri, 19 Oct 2018 20:13:57 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 82-v6sm1937446ita.17.2018.10.19.20.13.56
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 19 Oct 2018 20:13:56 -0700 (PDT)
Subject: Re: bug#17161: date: confusing: "TIME -/+NUM" treated as time zone
To: Eric Blake <eblake@HIDDEN>, "Marc R.J. Brevoort"
 <mrjb@HIDDEN>, 17161 <at> debbugs.gnu.org
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
 <533BF42F.30600@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <de234f7a-ec3e-13c4-af7d-ca28696dee4d@HIDDEN>
Date: Fri, 19 Oct 2018 21:13:55 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <533BF42F.30600@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 17161 wishlist
retitle 17161 date: confusing: "TIME -/+NUM" treated as time zone
stop

(triaging old bugs)

Hello,

On 02/04/14 05:27 AM, Eric Blake wrote:
> On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
>>
>> The more days I subtract, the more hours are added. If this were a time
>> zone issue, the amount of hours added would be constant but the
>> resulting date would not.
> 
> Thanks for persisting.  I was able to reproduce using coreutils.git, and
> I can explain what's happening.  Date is parsing this as:
> 
> "(2014-03-11 12:34:56 -3) (days)"
[...]
> It does indeed seem awkward that date is not parsing this as:
> 
> "(2014-03-11 12:34:56) (-3 days)"
> 
> but fixing that will require tweaks to the getdate.y parser in gnulib.
> I've reopened the bug to track the issue with awkward precedence in the
> parser.

In the mean time, date gained the "--debug" option that makes
diagnosing these issues somewhat easier.

Due to the way the date parser works, the following
rules apply:

1.
Time (HH:MM:SS) followed by a plus/minus character
and a number - ALWAYS parsed as time zone.
The unit that followed (e.g. "days" / "minutes")
are then taken to be of value 1 (e.g. 1 day, 1 minute).

Examples:

   ## This is "Timezone=3, plus one day"
   $ date --debug -d "2014-03-11 12:34:56 +3 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC+03
   date: parsed relative part: +1 day(s)
   date: input timezone: parsed date/time string (+03)
   [...]
   Wed Mar 12 03:34:56 MDT 2014

   ## This is "Timezone=-10, plus one month"
   $ date --debug -d "2014-03-11 12:34:56 -10 months"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: +1 month(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Fri Apr 11 16:34:56 MDT 2014


2.
Time (HH:MM:SS) followed by a number without plus/minus sign,
The number applies to the units.

   ## This is "time, plus 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: +7 seconds
   [...]
   Tue Mar 11 12:35:03 MDT 2014

3.
To subtract units (e.g. three days) without using a minus character
(i.e. forcing rule #2 instead of triggering rule #1), use the word "ago":

   ## This is "time - 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -7 seconds
   [...]
   Tue Mar 11 12:34:49 MDT 2014

   ## This is 3 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 3 days ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -3 day(s)
   [...]
   Sat Mar  8 12:34:56 MST 2014

Or use Eric's suggestion of putting the "-3 days"
before the date.

4.
Combining a time zone and a unit value is valid,
e.g.

   ## Timezone = -10, 9 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 -10 -9 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: -9 day(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Sun Mar  2 15:34:56 MST 2014

----

As Eric wrote above, modifying the parser could be done in gnulib.
Not so much a technical problem, but very likely to be backward-
incompatible in a way that will break many many existing scripts.

As such, I'm marking this as "wishlist", but keeping it open -
discussion is welcomed to continue by replying to this thread.

regards,
  - assaf






Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.