Subject: bug#26249: 26.0.50; vc-hg.el assumes wrong default ignore pattern syntax

From: Jim Blandy <[email-masked]>
Date: Fri, 24 Mar 2017 18:07:18 -0700

The problem requires vc-hg-state-fast to try to take the fast path, so you
need to follow these instructions exactly (except that ~/emacs/src/emacs
can be whatever your development emacs executable is):

$ hg init snoo
$ cd snoo
$ echo '\.py(c|o)$' > .hgignore
$ hg add .hgignore
$ echo hi > file
$ ~/emacs/src/emacs -Q file

You should see this error in the minibuffer:

Error: (invalid-regexp "Unmatched ) or \\)")

The problem is that vc-hg--slurp-hgignore-1 believes that default-syntax
should be vc-hg--hgignore-add-glob, but the default syntax in an .hgignore
file is actually Python/Perl regular expressions. Changing the default
value to vc-hg--hgignore-add-pcre seems to fix the problem:

modified   lisp/vc/vc-hg.el
@@ -826,7 +826,7 @@ vc-hg--hgignore-add-path
      prefix)))

 (defun vc-hg--slurp-hgignore-1 (hgignore prefix)
-  (let ((default-syntax 'vc-hg--hgignore-add-glob))
+  (let ((default-syntax 'vc-hg--hgignore-add-pcre))
     (with-temp-buffer
       (let ((attr (file-attributes hgignore)))
         (when attr (insert-file-contents hgignore))

In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.10)
 of 2017-03-24 built on shibui
Repository revision: 211d41a6fe23fefef0e29d036d8599716e484657
Windowing system distributor 'Fedora Project', version 11.0.11901000
System Description:    Fedora release 25 (Twenty Five)

Recent messages:
Running git commit -- [2 times]
Diffing changes to be committed (C-g to abort diffing) [2 times]
When done with a buffer, type C-c C-c
Type C-c C-c to finish, or C-c C-k to cancel
Quit
Saving file /home/jimb/emacs/.git/COMMIT_EDITMSG...
Wrote /home/jimb/emacs/.git/COMMIT_EDITMSG
Git finished [2 times]
Quit [3 times]
C-h x is undefined

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 LIBSYSTEMD

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  magit-auto-revert-mode: t
  auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  icomplete-mode: t
  rcirc-track-minor-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  mouse-wheel-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:
/home/jimb/elisp/haskell-mode-2.4/haskell-font-lock hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/haskell-font-lock
/home/jimb/elisp/haskell-mode-2.4/haskell-cabal hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/haskell-cabal
/home/jimb/elisp/haskell-mode-2.4/haskell-mode hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/haskell-mode
/home/jimb/elisp/haskell-mode-2.4/inf-haskell hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/inf-haskell
/home/jimb/elisp/haskell-mode-2.4/haskell-doc hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/haskell-doc
/home/jimb/elisp/haskell-mode-2.4/haskell-decl-scan hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/haskell-decl-scan
/home/jimb/elisp/haskell-mode-2.4/haskell-indent hides
/home/jimb/.emacs.d/elpa/haskell-mode-20170204.556/haskell-indent

Features:
(shadow sort mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime dig gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source tls gnutls utf7 netrc nnoo gnus-spec gnus-int
gnus-range gnus-win gnus nnheader emacsbug vc-annotate vc vc-dispatcher
conf-mode eieio-opt speedbar sb-image ezimage dframe magit-obsolete
magit-blame magit-stash magit-bisect magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-branch magit-files
magit-refs magit-status magit magit-repos magit-apply magit-wip
magit-log magit-diff smerge-mode magit-core magit-autorevert autorevert
filenotify magit-process magit-margin magit-mode magit-git crm
magit-section magit-popup git-commit log-edit message puny rfc822 mml
mml-sec epa derived epg gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
pcvs-util add-log with-editor async-bytecomp async tramp-sh tramp
tramp-compat tramp-loaddefs trampver shell pcomplete parse-time
format-spec magit-utils jka-compr misearch multi-isearch vc-git
diff-mode debug cus-edit wid-edit help-fns radix-tree vc-hg cc-mode
cc-fonts cc-guess cc-menus cc-cmds icomplete cus-start cus-load
rcirc-reconnect easy-mmode rcirc sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils patchutils jimb-patch page-ext server
alt-dired-view dired dired-loaddefs diff-find-mq-file mozilla-c-style
google-c-style cc-styles cc-align cc-engine cc-vars cc-defs jimb-frames
ffap org-install bugzilla url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap jimb-js
compile comint ansi-color mercurial-queues cl flycheck-rust flycheck
json map find-func rx company racer f s ucs-normalize rust-mode etags
xref project ring dash multiple-cursors mc-hide-unmatched-lines-mode
mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more
thingatpt mc-cycle-cursors mc-edit-lines multiple-cursors-core advice
rect typo edmacro kmacro rust-book-md finder-inf info package epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt subr-x gv bytecomp
byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd 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 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 613476 13950)
 (symbols 48 43918 6)
 (miscs 40 302 811)
 (strings 32 105682 19279)
 (string-bytes 1 3435161)
 (vectors 16 66603)
 (vector-slots 8 1059747 15804)
 (floats 8 311 503)
 (intervals 56 31616 4429)
 (buffers 976 30))