Subject: 26.0.50; compile.el multiline regexp handling

From: Felix Klock <[email-masked]>
Date: Wed, 7 Dec 2016 15:11:48 -1000

Multiline compilation regexps do not reliably match.

I have attached two files to this email: demo-twoline.el and
demo-twoline2.sh

Steps to reproduce:

1. Start `emacs -Q`
2. M-x load-file demo-twoline.el
3. M-x compile <enter>
4. Observe not all emitted errors are matched by compilation-mode

The above steps run the `demo-twoline2.sh` shell script as the
compile-command, thus emulating something similar to the compiler error
messages in the compiler that I use. It emits nine such messages, but
not all of the emitted errors are matched as errors by compile.el. You
can tell this by the fact that only some are highlighted accordingly,
and also that hitting the <tab> key to cycle through them skips some of
the emitted errors.

(A colleague and I hypothesize that one likely component of this bug is
the way that compile.el, specifically the
compilation-next-single-property-change function, works in 500 character
chunks. This, combined (we think) with line-based processing elsewhere
in compile.el, yields scenarios where regexps fail to match. At the very
least, when I remove the chunking strategy from compile.el by
unconditionally using `(or limit (point-max))` instead of taking the min
of that and `(+ position 500)`, then the problem does not appear to
arise anymore for me.)

In GNU Emacs 26.0.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1911))
 of 2016-12-06 built on builder10-9.porkrind.org
Windowing system distributor 'Apple', version 10.3.1404
Recent messages:
C-< is undefined
Quit
Mark set
user-error: Moved past last error
user-error: Moved back before first error [2 times]
user-error: Moved past last error [2 times]
user-error: Moved back before first error [2 times]
Setting up indent for shell type sh
Indentation variables are now local.
Indentation setup for shell type sh

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

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

Major mode: Shell-script

Minor modes in effect:
  sh-electric-here-document-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cl-extra help-mode cconv dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils sh-script smie
executable shell pcomplete edmacro kmacro cl-loaddefs pcase cl-lib
compile comint ansi-color ring time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win
ns-win ucs-normalize term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors 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 composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray 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 kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 221384 9266)
 (symbols 48 21106 0)
 (miscs 40 62 219)
 (strings 32 23097 5392)
 (string-bytes 1 726082)
 (vectors 16 36657)
 (vector-slots 8 704287 5512)
 (floats 8 191 116)
 (intervals 56 327 0)
 (buffers 976 13))