unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29916: 26.0.90; CRLF in diff-command output breaks smerge hunk header parsing
@ 2017-12-31 18:33 Richard Copley
  2017-12-31 19:06 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Copley @ 2017-12-31 18:33 UTC (permalink / raw)
  To: 29916

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

On Windows, CRLF line endings in the output of diff-command can lead to
an error in `smerge-refine-regions'. To reproduce, download this patch:

https://lists.gnu.org/archive/html/emacs-devel/2017-06/txtWF9rI8yqfI.txt

(It is an example of a perfectly ordinary patch, with Unix line endings.)

From 'emacs -Q', visit the patch file, do "M-x diff-mode RET", then
move point into the second diff hunk (in editfns.c) and type RET
(diff-goto-source).

The minibuffer shows this error, with a literal carriage return, shown
here as ^M:

  Error running timer: (error "Unexpected patch hunk header: 41a42,121^M")

The error doesn't seem to be critical (diff-goto-source still succeeds)
but it's annoying, as it obscures a minibuffer prompt.

As a data point, the error doesn't happen after applying the attached
patch which partially reverts this commit:

  commit 184d74ce002ecb7399cb2b47fc671bfb2feb9855
  Author: Stefan Monnier <monnier@iro.umontreal.ca>
  Date:   Wed May 17 15:44:36 2017 -0400
  * lisp/vc/smerge-mode.el (smerge-refine-regions): Work in multi-bufs

The Lisp backtrace is:

Debugger entered--Lisp error: (error "Unexpected patch hunk header:
41a42,121\015")
  signal(error ("Unexpected patch hunk header: 41a42,121\015"))
  error("Unexpected patch hunk header: %s" "41a42,121\015")
  smerge-refine-regions(1019 1212 1212 1485 nil diff-refine-preproc
((diff-mode . fine) (face diff-refine-removed)) ((diff-mode . fine)
(face diff-refine-added)))
  diff-refine-hunk()
  #f(compiled-function () #<bytecode 0x1b0d50d>)()
  apply(#f(compiled-function () #<bytecode 0x1b0d50d>) nil)
  timer-event-handler([t 23113 10990 354825 nil #f(compiled-function
() #<bytecode 0x1b0d50d>) nil nil 0])
  read-from-minibuffer("Use file
c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: "
("c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" . 42) (keymap
...) nil file-name-history
"c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" nil)
  completing-read-default("Use file
c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: "
read-file-name-internal file-exists-p t
("c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" . 41)
file-name-history "c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c"
nil)
  completing-read("Use file
c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: "
read-file-name-internal file-exists-p t
("c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" . 41)
file-name-history
"c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c")
  read-file-name-default("Use file
c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: "
"c:/Users/xxxxxx/AppData/Local/Temp/b/src/"
"c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" t "editfns.c"
nil)
  read-file-name("Use file
c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: "
"c:/Users/xxxxxx/AppData/Local/Temp/b/src/"
"c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" t "editfns.c")
  diff-find-file-name(nil nil)
  diff-find-source-location(nil t)
  diff-goto-source(nil return)
  funcall-interactively(diff-goto-source nil return)
  call-interactively(diff-goto-source nil nil)
  command-execute(diff-goto-source)



In GNU Emacs 26.0.90 (build 1, x86_64-w64-mingw32)
 of 2017-12-31 built on MACHINE
Repository revision: 39ca289a7a33d514c2a46f005db4e7173fb7e9f5
Windowing system distributor 'Microsoft Corp.', version 10.0.16299
Recent messages:
Wrote c:/projects/emacs/lisp/vc/smerge-mode.el
Quit [2 times]
Finding changes in c:/projects/emacs/lisp/vc/smerge-mode.el...done
Hunk already applied
Annotating...
Redisplaying annotation...done (Spanned from 6597.8 to 16.8 days old)
Annotating... done
Mark set
Mark deactivated
x is undefined

Configured using:
 'configure --config-cache --with-modules --without-pop 'CFLAGS=-O3
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES LCMS2

Important settings:
  value of $EMACSLOADPATH: c:\emacs-lisp;
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: Git-Log-View

Minor modes in effect:
  diff-auto-refine-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
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny format-spec rfc822 mml
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 vc-annotate vc-dir ewoc smerge-mode
m4-mode whitespace add-log log-view pcvs-util cl-extra help-mode vc-git
diff-mode easymenu easy-mmode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
vc vc-dispatcher map seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib dired dired-loaddefs elec-pair time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars
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 charprop 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 w32notify dbusbind w32 lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 130359 22263)
 (symbols 56 22153 2)
 (miscs 48 105 257)
 (strings 32 36280 1509)
 (string-bytes 1 943844)
 (vectors 16 23670)
 (vector-slots 8 1322832 187678)
 (floats 8 85 611)
 (intervals 56 4285 3571)
 (buffers 992 18))

[-- Attachment #2: decode-diff-output.patch --]
[-- Type: application/octet-stream, Size: 582 bytes --]

diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index ea1e0c726f..89af37d637 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -1084,7 +1084,7 @@ smerge-refine-regions
     ;; Call diff on those files.
     (unwind-protect
         (with-temp-buffer
-          (let ((coding-system-for-read 'emacs-internal))
+          (let ((coding-system-for-read 'emacs-mule))
             (call-process diff-command nil t nil
                           (if (and smerge-refine-ignore-whitespace
                                    (not smerge-refine-weight-hack))

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

end of thread, other threads:[~2018-01-05  9:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-31 18:33 bug#29916: 26.0.90; CRLF in diff-command output breaks smerge hunk header parsing Richard Copley
2017-12-31 19:06 ` Eli Zaretskii
2017-12-31 21:13   ` Richard Copley
2018-01-01  4:37     ` Eli Zaretskii
2018-01-01 11:02       ` Richard Copley
2018-01-01 11:51         ` Richard Copley
2018-01-01 16:39           ` Eli Zaretskii
2018-01-01 16:37         ` Eli Zaretskii
2018-01-01 23:23   ` Stefan Monnier
2018-01-02 21:41     ` Richard Copley
2018-01-03 15:18       ` Eli Zaretskii
2018-01-05  9:23         ` Eli Zaretskii

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).