Subject: bug#33277: 25.1; icalendar-import-file incorrectly imports events with same start/end time

From: Stefan van der Walt <[email-masked]>
Date: Mon, 05 Nov 2018 10:25:48 -0800

When importing an ical file containing an event with the same start and
end time, that event is converted to an all-day event.

E.g., consider the following Google calendar file, basic.ics:

BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:emacs-ical-import-test
X-WR-TIMEZONE:America/Los_Angeles
BEGIN:VEVENT
DTSTART:20181105T200000Z
DTSTAMP:20181105T181652Z
UID:[email-masked]
CREATED:20181105T181646Z
DESCRIPTION:
LAST-MODIFIED:20181105T181646Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:event with same start/end time
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

I import it using:

(icalendar-import-file "/tmp/basic.ics" "/tmp/basic.diary")

And in basic.diary see:

11/5/2018 event with same start/end time

Instead of:

11/5/2018 12:00-12:00

The source code (icalendar.el) mentions the following:

;;   Please note:
;; - Diary entries which have a start time but no end time are assumed to
;;   last for one hour when they are exported.

Still, then I would expect the diary entry to be:

11/5/2018 12:00-13:00

System information:

In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-14, modified by Debian built on trouble
Windowing system distributor 'The X.Org Foundation', version 11.0.12001000
System Description:	Debian GNU/Linux unstable (sid)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --with-x=yes --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs25-wN2qS3/emacs25-25.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Diary

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode)  S)))
  global-company-mode: t
  company-mode: t
  pyvenv-mode: t
  diff-auto-refine-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  global-whitespace-mode: t
  winner-mode: t
  show-paren-mode: t
  xclip-mode: t
  pdf-occur-global-minor-mode: t
  shell-dirtrack-mode: t
  override-global-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Quit [2 times]

ido-read-internal: Command attempted to use minibuffer while in minibuffer
Quit
Making completion list...
user-error: End of history; no default available
Quit
Mark saved where search started
Quit
Making completion list...

Load-path shadows:
/usr/share/emacs25/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/25.1/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/25.1/lisp/textmodes/rst
/home/stefan/.emacs.d/elpa/org-20170606/org-rmail hides /usr/share/emacs/25.1/lisp/org/org-rmail
/home/stefan/.emacs.d/elpa/org-20170606/org-bbdb hides /usr/share/emacs/25.1/lisp/org/org-bbdb
/home/stefan/.emacs.d/elpa/org-20170606/ob-dot hides /usr/share/emacs/25.1/lisp/org/ob-dot
/home/stefan/.emacs.d/elpa/org-20170606/org-habit hides /usr/share/emacs/25.1/lisp/org/org-habit
/home/stefan/.emacs.d/elpa/org-20170606/ob-haskell hides /usr/share/emacs/25.1/lisp/org/ob-haskell
/home/stefan/.emacs.d/elpa/org-20170606/ob-ditaa hides /usr/share/emacs/25.1/lisp/org/ob-ditaa
/home/stefan/.emacs.d/elpa/org-20170606/ob-gnuplot hides /usr/share/emacs/25.1/lisp/org/ob-gnuplot
/home/stefan/.emacs.d/elpa/org-20170606/ob-table hides /usr/share/emacs/25.1/lisp/org/ob-table
/home/stefan/.emacs.d/elpa/org-20170606/ob-maxima hides /usr/share/emacs/25.1/lisp/org/ob-maxima
/home/stefan/.emacs.d/elpa/org-20170606/org-table hides /usr/share/emacs/25.1/lisp/org/org-table
/home/stefan/.emacs.d/elpa/org-20170606/org-eshell hides /usr/share/emacs/25.1/lisp/org/org-eshell
/home/stefan/.emacs.d/elpa/org-20170606/ob-ocaml hides /usr/share/emacs/25.1/lisp/org/ob-ocaml
/home/stefan/.emacs.d/elpa/org-20170606/ob-emacs-lisp hides /usr/share/emacs/25.1/lisp/org/ob-emacs-lisp
/home/stefan/.emacs.d/elpa/org-20170606/ob-io hides /usr/share/emacs/25.1/lisp/org/ob-io
/home/stefan/.emacs.d/elpa/org-20170606/org-mouse hides /usr/share/emacs/25.1/lisp/org/org-mouse
/home/stefan/.emacs.d/elpa/org-20170606/org-mobile hides /usr/share/emacs/25.1/lisp/org/org-mobile
/home/stefan/.emacs.d/elpa/org-20170606/org-faces hides /usr/share/emacs/25.1/lisp/org/org-faces
/home/stefan/.emacs.d/elpa/org-20170606/ob-screen hides /usr/share/emacs/25.1/lisp/org/ob-screen
/home/stefan/.emacs.d/elpa/org-20170606/ob-sqlite hides /usr/share/emacs/25.1/lisp/org/ob-sqlite
/home/stefan/.emacs.d/elpa/org-20170606/org hides /usr/share/emacs/25.1/lisp/org/org
/home/stefan/.emacs.d/elpa/org-20170606/ob-core hides /usr/share/emacs/25.1/lisp/org/ob-core
/home/stefan/.emacs.d/elpa/org-20170606/ob-css hides /usr/share/emacs/25.1/lisp/org/ob-css
/home/stefan/.emacs.d/elpa/org-20170606/ox-publish hides /usr/share/emacs/25.1/lisp/org/ox-publish
/home/stefan/.emacs.d/elpa/org-20170606/ob-fortran hides /usr/share/emacs/25.1/lisp/org/ob-fortran
/home/stefan/.emacs.d/elpa/org-20170606/org-capture hides /usr/share/emacs/25.1/lisp/org/org-capture
/home/stefan/.emacs.d/elpa/org-20170606/ob-js hides /usr/share/emacs/25.1/lisp/org/ob-js
/home/stefan/.emacs.d/elpa/org-20170606/ob hides /usr/share/emacs/25.1/lisp/org/ob
/home/stefan/.emacs.d/elpa/org-20170606/org-datetree hides /usr/share/emacs/25.1/lisp/org/org-datetree
/home/stefan/.emacs.d/elpa/org-20170606/org-element hides /usr/share/emacs/25.1/lisp/org/org-element
/home/stefan/.emacs.d/elpa/org-20170606/ob-mscgen hides /usr/share/emacs/25.1/lisp/org/ob-mscgen
/home/stefan/.emacs.d/elpa/org-20170606/ob-org hides /usr/share/emacs/25.1/lisp/org/ob-org
/home/stefan/.emacs.d/elpa/org-20170606/ox-html hides /usr/share/emacs/25.1/lisp/org/ox-html
/home/stefan/.emacs.d/elpa/org-20170606/org-crypt hides /usr/share/emacs/25.1/lisp/org/org-crypt
/home/stefan/.emacs.d/elpa/org-20170606/org-footnote hides /usr/share/emacs/25.1/lisp/org/org-footnote
/home/stefan/.emacs.d/elpa/org-20170606/ob-awk hides /usr/share/emacs/25.1/lisp/org/ob-awk
/home/stefan/.emacs.d/elpa/org-20170606/ob-eval hides /usr/share/emacs/25.1/lisp/org/ob-eval
/home/stefan/.emacs.d/elpa/org-20170606/ob-clojure hides /usr/share/emacs/25.1/lisp/org/ob-clojure
/home/stefan/.emacs.d/elpa/org-20170606/ob-python hides /usr/share/emacs/25.1/lisp/org/ob-python
/home/stefan/.emacs.d/elpa/org-20170606/ob-latex hides /usr/share/emacs/25.1/lisp/org/ob-latex
/home/stefan/.emacs.d/elpa/org-20170606/org-attach hides /usr/share/emacs/25.1/lisp/org/org-attach
/home/stefan/.emacs.d/elpa/org-20170606/ox-icalendar hides /usr/share/emacs/25.1/lisp/org/ox-icalendar
/home/stefan/.emacs.d/elpa/org-20170606/org-version hides /usr/share/emacs/25.1/lisp/org/org-version
/home/stefan/.emacs.d/elpa/org-20170606/ob-sql hides /usr/share/emacs/25.1/lisp/org/ob-sql
/home/stefan/.emacs.d/elpa/org-20170606/ob-calc hides /usr/share/emacs/25.1/lisp/org/ob-calc
/home/stefan/.emacs.d/elpa/org-20170606/org-loaddefs hides /usr/share/emacs/25.1/lisp/org/org-loaddefs
/home/stefan/.emacs.d/elpa/org-20170606/org-docview hides /usr/share/emacs/25.1/lisp/org/org-docview
/home/stefan/.emacs.d/elpa/org-20170606/ob-matlab hides /usr/share/emacs/25.1/lisp/org/ob-matlab
/home/stefan/.emacs.d/elpa/org-20170606/org-archive hides /usr/share/emacs/25.1/lisp/org/org-archive
/home/stefan/.emacs.d/elpa/org-20170606/org-id hides /usr/share/emacs/25.1/lisp/org/org-id
/home/stefan/.emacs.d/elpa/org-20170606/ob-makefile hides /usr/share/emacs/25.1/lisp/org/ob-makefile
/home/stefan/.emacs.d/elpa/org-20170606/ob-R hides /usr/share/emacs/25.1/lisp/org/ob-R
/home/stefan/.emacs.d/elpa/org-20170606/org-colview hides /usr/share/emacs/25.1/lisp/org/org-colview
/home/stefan/.emacs.d/elpa/org-20170606/ox-man hides /usr/share/emacs/25.1/lisp/org/ox-man
/home/stefan/.emacs.d/elpa/org-20170606/ob-lilypond hides /usr/share/emacs/25.1/lisp/org/ob-lilypond
/home/stefan/.emacs.d/elpa/org-20170606/org-src hides /usr/share/emacs/25.1/lisp/org/org-src
/home/stefan/.emacs.d/elpa/org-20170606/org-install hides /usr/share/emacs/25.1/lisp/org/org-install
/home/stefan/.emacs.d/elpa/org-20170606/org-list hides /usr/share/emacs/25.1/lisp/org/org-list
/home/stefan/.emacs.d/elpa/org-20170606/ob-java hides /usr/share/emacs/25.1/lisp/org/ob-java
/home/stefan/.emacs.d/elpa/org-20170606/org-bibtex hides /usr/share/emacs/25.1/lisp/org/org-bibtex
/home/stefan/.emacs.d/elpa/org-20170606/ox-md hides /usr/share/emacs/25.1/lisp/org/ox-md
/home/stefan/.emacs.d/elpa/org-20170606/org-info hides /usr/share/emacs/25.1/lisp/org/org-info
/home/stefan/.emacs.d/elpa/org-20170606/ob-ref hides /usr/share/emacs/25.1/lisp/org/ob-ref
/home/stefan/.emacs.d/elpa/org-20170606/ox-latex hides /usr/share/emacs/25.1/lisp/org/ox-latex
/home/stefan/.emacs.d/elpa/org-20170606/org-indent hides /usr/share/emacs/25.1/lisp/org/org-indent
/home/stefan/.emacs.d/elpa/org-20170606/org-inlinetask hides /usr/share/emacs/25.1/lisp/org/org-inlinetask
/home/stefan/.emacs.d/elpa/org-20170606/ob-ledger hides /usr/share/emacs/25.1/lisp/org/ob-ledger
/home/stefan/.emacs.d/elpa/org-20170606/org-macs hides /usr/share/emacs/25.1/lisp/org/org-macs
/home/stefan/.emacs.d/elpa/org-20170606/ob-shen hides /usr/share/emacs/25.1/lisp/org/ob-shen
/home/stefan/.emacs.d/elpa/org-20170606/ob-perl hides /usr/share/emacs/25.1/lisp/org/ob-perl
/home/stefan/.emacs.d/elpa/org-20170606/ob-exp hides /usr/share/emacs/25.1/lisp/org/ob-exp
/home/stefan/.emacs.d/elpa/org-20170606/ob-keys hides /usr/share/emacs/25.1/lisp/org/ob-keys
/home/stefan/.emacs.d/elpa/org-20170606/ob-octave hides /usr/share/emacs/25.1/lisp/org/ob-octave
/home/stefan/.emacs.d/elpa/org-20170606/ox-odt hides /usr/share/emacs/25.1/lisp/org/ox-odt
/home/stefan/.emacs.d/elpa/org-20170606/ob-C hides /usr/share/emacs/25.1/lisp/org/ob-C
/home/stefan/.emacs.d/elpa/org-20170606/org-timer hides /usr/share/emacs/25.1/lisp/org/org-timer
/home/stefan/.emacs.d/elpa/org-20170606/ob-sass hides /usr/share/emacs/25.1/lisp/org/ob-sass
/home/stefan/.emacs.d/elpa/org-20170606/org-ctags hides /usr/share/emacs/25.1/lisp/org/org-ctags
/home/stefan/.emacs.d/elpa/org-20170606/ob-ruby hides /usr/share/emacs/25.1/lisp/org/ob-ruby
/home/stefan/.emacs.d/elpa/org-20170606/ob-comint hides /usr/share/emacs/25.1/lisp/org/ob-comint
/home/stefan/.emacs.d/elpa/org-20170606/org-protocol hides /usr/share/emacs/25.1/lisp/org/org-protocol
/home/stefan/.emacs.d/elpa/org-20170606/org-w3m hides /usr/share/emacs/25.1/lisp/org/org-w3m
/home/stefan/.emacs.d/elpa/org-20170606/org-gnus hides /usr/share/emacs/25.1/lisp/org/org-gnus
/home/stefan/.emacs.d/elpa/org-20170606/org-macro hides /usr/share/emacs/25.1/lisp/org/org-macro
/home/stefan/.emacs.d/elpa/org-20170606/org-clock hides /usr/share/emacs/25.1/lisp/org/org-clock
/home/stefan/.emacs.d/elpa/org-20170606/ob-tangle hides /usr/share/emacs/25.1/lisp/org/ob-tangle
/home/stefan/.emacs.d/elpa/org-20170606/ob-scala hides /usr/share/emacs/25.1/lisp/org/ob-scala
/home/stefan/.emacs.d/elpa/org-20170606/ox hides /usr/share/emacs/25.1/lisp/org/ox
/home/stefan/.emacs.d/elpa/org-20170606/org-entities hides /usr/share/emacs/25.1/lisp/org/org-entities
/home/stefan/.emacs.d/elpa/org-20170606/ob-lisp hides /usr/share/emacs/25.1/lisp/org/ob-lisp
/home/stefan/.emacs.d/elpa/org-20170606/org-pcomplete hides /usr/share/emacs/25.1/lisp/org/org-pcomplete
/home/stefan/.emacs.d/elpa/org-20170606/ox-beamer hides /usr/share/emacs/25.1/lisp/org/ox-beamer
/home/stefan/.emacs.d/elpa/org-20170606/ob-plantuml hides /usr/share/emacs/25.1/lisp/org/ob-plantuml
/home/stefan/.emacs.d/elpa/org-20170606/ox-texinfo hides /usr/share/emacs/25.1/lisp/org/ox-texinfo
/home/stefan/.emacs.d/elpa/org-20170606/ob-picolisp hides /usr/share/emacs/25.1/lisp/org/ob-picolisp
/home/stefan/.emacs.d/elpa/org-20170606/org-irc hides /usr/share/emacs/25.1/lisp/org/org-irc
/home/stefan/.emacs.d/elpa/org-20170606/ox-ascii hides /usr/share/emacs/25.1/lisp/org/ox-ascii
/home/stefan/.emacs.d/elpa/org-20170606/org-plot hides /usr/share/emacs/25.1/lisp/org/org-plot
/home/stefan/.emacs.d/elpa/org-20170606/ob-asymptote hides /usr/share/emacs/25.1/lisp/org/ob-asymptote
/home/stefan/.emacs.d/elpa/org-20170606/org-mhe hides /usr/share/emacs/25.1/lisp/org/org-mhe
/home/stefan/.emacs.d/elpa/org-20170606/ob-scheme hides /usr/share/emacs/25.1/lisp/org/ob-scheme
/home/stefan/.emacs.d/elpa/org-20170606/org-feed hides /usr/share/emacs/25.1/lisp/org/org-feed
/home/stefan/.emacs.d/elpa/org-20170606/org-compat hides /usr/share/emacs/25.1/lisp/org/org-compat
/home/stefan/.emacs.d/elpa/org-20170606/ox-org hides /usr/share/emacs/25.1/lisp/org/ox-org
/home/stefan/.emacs.d/elpa/org-20170606/ob-lob hides /usr/share/emacs/25.1/lisp/org/ob-lob
/home/stefan/.emacs.d/elpa/org-20170606/org-agenda hides /usr/share/emacs/25.1/lisp/org/org-agenda
/home/stefan/.emacs.d/elpa/let-alist-1.0.5/let-alist hides /usr/share/emacs/25.1/lisp/emacs-lisp/let-alist

Features:
(shadow sort mail-extr emacsbug sendmail icalendar nroff-mode deft
pcmpl-unix browse-url org-archive tramp-cmds novice tabify org-capture
wgrep cursor-sensor js2-mode js sgml-mode cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ruby-mode
rst css-mode make-mode web-mode disp-table cal-move parse-time tmm
org-table markdown-mode view cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew holidays hol-loaddefs diary-lib diary-loaddefs
cal-iso apropos thai-util thai-word eieio-opt speedbar sb-image ezimage
dframe dabbrev tramp-cache yasnippet highlight-indentation flymake
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-css company-nxml company-bbdb company elpy
find-file-in-project ivy derived ivy-overlay ffap thingatpt url-parse
url-vars pyvenv elpy-shell rx elpy-profile elpy-django elpy-refactor
grep files-x etags xref project debug message rfc822 mml mml-sec epg
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader misearch
multi-isearch vc-git diff-mode sh-script smie executable term/xterm
xterm vc-hg image-file org-rmail org-mhe org-irc org-info org-gnus
org-docview org-bibtex bibtex org-bbdb org-w3m server autorevert
filenotify dired-x delsel whitespace windmove winner paren avoid xclip
paredit color-theme zenburn-theme ido pdf-occur ibuf-ext ibuffer tablist
tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch
let-alist pdf-misc imenu ob-shell ob-js org-protocol org-agenda
ox-reveal ox-md ox-odt rng-loc rng-uri rng-parse rng-match rng-dt
rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar ox-html table ox-ascii ox-publish ox ob-ipython cl python
tramp-sh json map f s dash-functional dash ob-python darkroom interleave
pdf-tools compile cus-edit cus-start cus-load wid-edit pdf-view bookmark
pp pdf-cache pdf-info tq pdf-util doc-view subr-x jka-compr image-mode
dired org-element avl-tree org org-macro org-footnote org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint tramp tramp-compat auth-source cl-seq eieio eieio-core cl-macs
gnus-util time-date mm-util help-fns mail-prsvr password-cache
tramp-loaddefs trampver ucs-normalize shell pcomplete advice comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs edmacro kmacro
use-package diminish bind-key easy-mmode finder-inf info package
epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode
easymenu cconv cl-loaddefs pcase cl-lib time mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 3585911 225979)
 (symbols 48 72829 0)
 (miscs 40 9094 6747)
 (strings 32 241992 103565)
 (string-bytes 1 6661008)
 (vectors 16 174612)
 (vector-slots 8 3877145 67605)
 (floats 8 2599 14640)
 (intervals 56 272233 3159)
 (buffers 976 313))