From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: thunk2@arcor.de (Thomas Plass) Newsgroups: gmane.emacs.bugs Subject: bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone handling Date: Thu, 1 Oct 2020 16:38:51 +0300 Message-ID: <24437.56299.111042.412318@AGAME7.local> References: <23640.9851.562972.730234@AGAME7.local> <875ztog7hx.fsf@panama> <87wom1otsw.fsf@panama> <87zh7267sy.fsf@gnus.org> <87pn7yo54t.fsf@panama> <83o8ni4fhu.fsf@gnu.org> <24369.32256.954408.774614@AGAME7.local> <87y2mlxx8r.fsf@gnus.org> <87d03x43kz.fsf@panama> <24371.59842.984273.402129@AGAME7.local> <87y2mkknyc.fsf@gnus.org> <24371.61149.995030.284670@AGAME7.local> <87364rq4yl.fsf@panama> <87imcwf404.fsf@panama> <24400.43911.666145.400179@AGAME7.local> <874kof2aui.fsf@panama> <24435.1743.473339.944597@AGAME7.local> <874knewwfc.fsf@gnus.org> Reply-To: Thomas Plass Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33636"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 34315@debbugs.gnu.org, Jan Tatarik To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 01 15:41:05 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNypU-0008eW-RU for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Oct 2020 15:41:04 +0200 Original-Received: from localhost ([::1]:57938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNypT-0007jE-Ta for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Oct 2020 09:41:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNyoU-0006oP-BU for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2020 09:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNyoU-0001XT-1w for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2020 09:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kNyoT-0001dY-To for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2020 09:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: thunk2@arcor.de (Thomas Plass) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Oct 2020 13:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34315 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 34315-submit@debbugs.gnu.org id=B34315.16015595566236 (code B ref 34315); Thu, 01 Oct 2020 13:40:01 +0000 Original-Received: (at 34315) by debbugs.gnu.org; 1 Oct 2020 13:39:16 +0000 Original-Received: from localhost ([127.0.0.1]:34849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNynj-0001cW-WA for submit@debbugs.gnu.org; Thu, 01 Oct 2020 09:39:16 -0400 Original-Received: from vsmx011.vodafonemail.xion.oxcs.net ([153.92.174.89]:31476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNyni-0001cI-PW for 34315@debbugs.gnu.org; Thu, 01 Oct 2020 09:39:15 -0400 Original-Received: from vsmx003.vodafonemail.xion.oxcs.net (unknown [192.168.75.197]) by mta-5-out.mta.xion.oxcs.net (Postfix) with ESMTP id 2B91259D2D0; Thu, 1 Oct 2020 13:39:09 +0000 (UTC) Original-Received: from agame7.arcor.de (unknown [2.200.173.137]) by mta-7-out.mta.xion.oxcs.net (Postfix) with ESMTPA id 56A08539ACD; Thu, 1 Oct 2020 13:38:56 +0000 (UTC) In-Reply-To: Your message of Thursday, October 1 2020 03:45:59 (ID: <874knewwfc.fsf@gnus.org>). X-VADE-STATUS: LEGIT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189517 Archived-At: Lars Ingebrigtsen wrote at 03:45 on October 1, 2020: : : However, the code makes two tests fail: Like with the previous patch, I hoped to get away with offloading the testing part to the maintainer... But the failures prompted me to get familiar with the test setup for the two culprits. : 2 unexpected results: : FAILED icalendar--convert-tz-offset : FAILED icalendar--parse-vtimezone My latest patch requires some test definitions to be modified as well as existing commented out code to be commented in. Background: In light of the way an abandonment of daylight saving time is expressed in VTIMEZONE, my patch will always make sure that - when no recurrence rules RRULE are specified - the (most recent) UTC offset of the most recent DAYLIGHT or STANDARD is returned. This offset is what counts, IMHO. Computing and using a TZ spec - even a default one - seems inappropriate for theses cases. : In addition, the test cases included aren't actually used? Implicitly, they are when my patch to icalendar-tests.el (below, not a --git, sorry) is applied. The raw ICS data seem rather large for incorporation into the Lisp code. But I'd rather let Ulf have the final say about the patches and how the data is to be tested. ---------------------------------------------------------------------- diff -Naur icalendar-tests.el.bce7de769e0c024b26729c45c2c27c7f3749c499 icalendar-tests.el --- icalendar-tests.el.bce7de769e0c024b26729c45c2c27c7f3749c499 2020-10-01 12:59:40.051753100 +0200 +++ icalendar-tests.el 2020-10-01 14:04:42.106937900 +0200 @@ -248,7 +248,7 @@ (setq result (icalendar--parse-vtimezone vtimezone)) (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result))) (message (cdr result)) - (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00" + (should (string= "STD-05:30" (cdr result))) ;; FIXME: add testcase that covers changes for fix of bug#34315 @@ -557,28 +557,29 @@ (RRULE nil "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU")) t))) - ;; testcase: dtstart is mandatory - (should (null (icalendar--convert-tz-offset + ;; testcase: dtstart is mandatory but if not set return at least the offset + (should (equal '("DST-02:00") + (icalendar--convert-tz-offset '((TZOFFSETFROM nil "+0100") (TZOFFSETTO nil "+0200") (RRULE nil "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU")) t))) - ;; FIXME: rrule and rdate are NOT mandatory! Must fix code - ;; before activating these testcases - ;; ;; testcase: no rrule and no rdate => no result - ;; (should (null (icalendar--convert-tz-offset - ;; '((TZOFFSETFROM nil "+0100") - ;; (TZOFFSETTO nil "+0200") - ;; (DTSTART nil "19700329T020000")) - ;; t))) - ;; ;; testcase: no rrule with rdate => no result - ;; (should (null (icalendar--convert-tz-offset - ;; '((TZOFFSETFROM nil "+0100") - ;; (TZOFFSETTO nil "+0200") - ;; (DTSTART nil "18840101T000000") - ;; (RDATE nil "18840101T000000")) - ;; t))) + ;; rrule and rdate are NOT mandatory: return the offset and a placeholder + (should (equal '("DST-02:00" . "19700329T020000") + (icalendar--convert-tz-offset + '((TZOFFSETFROM nil "+0100") + (TZOFFSETTO nil "+0200") + (DTSTART nil "19700329T020000")) + t))) + ;; ;; testcase: no rrule with rdate => return offset and a default TZ spec + (should (equal '("DST-02:00" . "M1.1.1/00:00:00") + (icalendar--convert-tz-offset + '((TZOFFSETFROM nil "+0100") + (TZOFFSETTO nil "+0200") + (DTSTART nil "18840101T000000") + (RDATE nil "18840101T000000")) + t))) ) ;; restore time-zone even if something went terribly wrong (setenv "TZ" tz))))