unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29116: 24.5; Parsing dates from VCAL
@ 2017-11-02  8:57 Vegard Vesterheim
  2017-11-05 10:19 ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Vegard Vesterheim @ 2017-11-02  8:57 UTC (permalink / raw)
  To: 29116

I received an email containing a VCAL attachment which Gnus is unable to
render, the error in the minibuffer says:

  Wrong type argument: char-or-string-p, nil

The VCAL-attachment contains this:

    DTSTART;VALUE=DATE:20171208

The spec for DTSTART states that the value type for DTSTART can be
either DATE-TIME or DATE, so this seems like a valid format, so I am
inclined to think that this is a bug in emacs.

Here is the backtrace (parameters removed 
  timezone-make-arpa-date(2000 0 0 "01:00:00" (3600 "CET"))
  timezone-make-date-arpa-standard("20171208" nil nil)
  gnus-icalendar-event--decode-datefield(...)
  gnus-icalendar-event-from-ical(...)
  gnus-icalendar-event-from-buffer(...)
  gnus-icalendar-event-from-handle(...)
  gnus-icalendar-mm-inline(...)
  mm-display-inline(...)
  mm-display-part(...)
  gnus-mime-display-alternative(...)
  gnus-mime-display-part(..)
  gnus-display-mime()
  gnus-article-prepare-display()
  gnus-article-prepare(94599 nil)
  gnus-summary-display-article(94599)
  gnus-summary-next-article(nil)

Looking at the backtrace it seems that the problem is related to parsing
the date string: "20171208".






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29116: 24.5; Parsing dates from VCAL
  2017-11-02  8:57 bug#29116: 24.5; Parsing dates from VCAL Vegard Vesterheim
@ 2017-11-05 10:19 ` Robert Pluim
  2017-11-06  7:45   ` Vegard Vesterheim
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2017-11-05 10:19 UTC (permalink / raw)
  To: Vegard Vesterheim; +Cc: 29116

Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:

> I received an email containing a VCAL attachment which Gnus is unable to
> render, the error in the minibuffer says:
>
>   Wrong type argument: char-or-string-p, nil
>
> The VCAL-attachment contains this:
>
>     DTSTART;VALUE=DATE:20171208
>
> The spec for DTSTART states that the value type for DTSTART can be
> either DATE-TIME or DATE, so this seems like a valid format, so I am
> inclined to think that this is a bug in emacs.

Yes, it's allowed, but annoying.

> Here is the backtrace (parameters removed 
>   timezone-make-arpa-date(2000 0 0 "01:00:00" (3600 "CET"))
>   timezone-make-date-arpa-standard("20171208" nil nil)
>   gnus-icalendar-event--decode-datefield(...)
>   gnus-icalendar-event-from-ical(...)
>   gnus-icalendar-event-from-buffer(...)
>   gnus-icalendar-event-from-handle(...)
>   gnus-icalendar-mm-inline(...)
>   mm-display-inline(...)
>   mm-display-part(...)
>   gnus-mime-display-alternative(...)
>   gnus-mime-display-part(..)
>   gnus-display-mime()
>   gnus-article-prepare-display()
>   gnus-article-prepare(94599 nil)
>   gnus-summary-display-article(94599)
>   gnus-summary-next-article(nil)
>
> Looking at the backtrace it seems that the problem is related to parsing
> the date string: "20171208".

timezone-parse-date assumes that the time-of-day is present in the
string to be parsed, which is not the case here. Looking at the code
icalendar should set the time to "00000" in that case. Would you have
a complete example VCAL file?

Thanks

Robert





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29116: 24.5; Parsing dates from VCAL
  2017-11-05 10:19 ` Robert Pluim
@ 2017-11-06  7:45   ` Vegard Vesterheim
  2017-11-06 10:01     ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Vegard Vesterheim @ 2017-11-06  7:45 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 29116

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On Sun, 05 Nov 2017 11:19:08 +0100 Robert Pluim <rpluim@gmail.com> wrote:

> Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:
>> Looking at the backtrace it seems that the problem is related to parsing
>> the date string: "20171208".
>
> timezone-parse-date assumes that the time-of-day is present in the
> string to be parsed, which is not the case here. Looking at the code
> icalendar should set the time to "00000" in that case. Would you have
> a complete example VCAL file?

Attached:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cal.ical --]
[-- Type: text/x-vcalendar, Size: 1264 bytes --]

BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Vegard Ves
 terheim:MAILTO:vegard.vesterheim@uninett.no
DESCRIPTION;LANGUAGE=en-US:Meeting description
 SUMMARY;LANGUAGE=en-US:Re-certification
DTSTART;VALUE=DATE:20171208
DTEND;VALUE=DATE:20171209
UID:040000008200E00074C5B7101A82E00800000000434E72372153D301000000000000000
 010000000B8E13E691E414545A6B9D006B49136EC
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20171101T145345Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
LOCATION;LANGUAGE=en-US:UNINETT 5.etg Perl [vbro.no/Perl] (260.502)
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-OWNERAPPTID:2115701571
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DISALLOW-COUNTER:FALSE
END:VEVENT
END:VCALENDAR

[-- Attachment #3: Type: text/plain, Size: 680 bytes --]


My naive workaraound for this bug was to modify the function
gnus-icalendar-event--decode-datafile:

(defun gnus-icalendar-event--decode-datefield (ical field)
  (let* ((date (icalendar--get-event-property ical field))
         (date-props (icalendar--get-event-property-attributes ical field))
         (tz (plist-get date-props 'TZID)))

    ;; VVWASHERE-start, fix bug in parsing DATE
    (and (eq (car date-props) 'VALUE)
         (string= (car (cdr date-props)) "DATE")
         (setq date (concat date "T00:00")))
    ;; VVWASHERE-end, fix bug in parsing DATE
    
    (cdr date-props)
    (date-to-time (timezone-make-date-arpa-standard date nil tz))))


-- 
- Vegard V -

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29116: 24.5; Parsing dates from VCAL
  2017-11-06  7:45   ` Vegard Vesterheim
@ 2017-11-06 10:01     ` Robert Pluim
  2017-11-06 11:16       ` Vegard Vesterheim
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2017-11-06 10:01 UTC (permalink / raw)
  To: Vegard Vesterheim; +Cc: 29116

Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:

> On Sun, 05 Nov 2017 11:19:08 +0100 Robert Pluim <rpluim@gmail.com> wrote:
>
>> Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:
>>> Looking at the backtrace it seems that the problem is related to parsing
>>> the date string: "20171208".
>>
>> timezone-parse-date assumes that the time-of-day is present in the
>> string to be parsed, which is not the case here. Looking at the code
>> icalendar should set the time to "00000" in that case. Would you have
>> a complete example VCAL file?
>
> Attached:
>

Thanks for that.

> My naive workaraound for this bug was to modify the function
> gnus-icalendar-event--decode-datafile:
>
> (defun gnus-icalendar-event--decode-datefield (ical field)
>   (let* ((date (icalendar--get-event-property ical field))
>          (date-props (icalendar--get-event-property-attributes ical field))
>          (tz (plist-get date-props 'TZID)))
>
>     ;; VVWASHERE-start, fix bug in parsing DATE
>     (and (eq (car date-props) 'VALUE)
>          (string= (car (cdr date-props)) "DATE")
>          (setq date (concat date "T00:00")))
>     ;; VVWASHERE-end, fix bug in parsing DATE
>

I thought the spec called for T000000, but if it's working for you,
then leave well enough alone.

>     (cdr date-props)
>     (date-to-time (timezone-make-date-arpa-standard date nil tz))))

Duh, I've been looking at the wrong branch. This looks like it was
fixed by 417cf67485, which is available in the 25.1 release or later.

Robert





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29116: 24.5; Parsing dates from VCAL
  2017-11-06 10:01     ` Robert Pluim
@ 2017-11-06 11:16       ` Vegard Vesterheim
  2017-11-06 11:19         ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Vegard Vesterheim @ 2017-11-06 11:16 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 29116

On Mon, 06 Nov 2017 11:01:32 +0100 Robert Pluim <rpluim@gmail.com> wrote:

> Duh, I've been looking at the wrong branch. This looks like it was
> fixed by 417cf67485, which is available in the 25.1 release or later.

Thanks for looking into this. Case closed.

For now, I guess I'll just wrap my workaround with a
  (if version< emacs-version "25.1")

-- 
- Vegard V -





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#29116: 24.5; Parsing dates from VCAL
  2017-11-06 11:16       ` Vegard Vesterheim
@ 2017-11-06 11:19         ` Robert Pluim
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Pluim @ 2017-11-06 11:19 UTC (permalink / raw)
  To: Vegard Vesterheim; +Cc: 29116-done

Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:

> On Mon, 06 Nov 2017 11:01:32 +0100 Robert Pluim <rpluim@gmail.com> wrote:
>
>> Duh, I've been looking at the wrong branch. This looks like it was
>> fixed by 417cf67485, which is available in the 25.1 release or later.
>
> Thanks for looking into this. Case closed.
>

Closing, thanks.

Robert





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-06 11:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-02  8:57 bug#29116: 24.5; Parsing dates from VCAL Vegard Vesterheim
2017-11-05 10:19 ` Robert Pluim
2017-11-06  7:45   ` Vegard Vesterheim
2017-11-06 10:01     ` Robert Pluim
2017-11-06 11:16       ` Vegard Vesterheim
2017-11-06 11:19         ` Robert Pluim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).