From unknown Thu Aug 14 18:37:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8672: 23.3; diff-fixup-modifs fails for some small diffs Resent-From: PJ Weisberg Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 May 2011 20:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8672 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 8672@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.130540486621759 (code B ref -1); Sat, 14 May 2011 20:28:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 May 2011 20:27:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLLRA-0005eu-Uc for submit@debbugs.gnu.org; Sat, 14 May 2011 16:27:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLLR8-0005ei-AV for submit@debbugs.gnu.org; Sat, 14 May 2011 16:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QLLR1-0001Jd-SQ for submit@debbugs.gnu.org; Sat, 14 May 2011 16:27:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:38786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLLR1-0001JZ-QN for submit@debbugs.gnu.org; Sat, 14 May 2011 16:27:35 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLLR0-0007MT-Ch for bug-gnu-emacs@gnu.org; Sat, 14 May 2011 16:27:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QLLQy-0001Iw-Eu for bug-gnu-emacs@gnu.org; Sat, 14 May 2011 16:27:34 -0400 Received: from p3plsmtpa06-05.prod.phx3.secureserver.net ([173.201.192.106]:34296) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QLLQx-0001Ib-Uu for bug-gnu-emacs@gnu.org; Sat, 14 May 2011 16:27:32 -0400 Received: (qmail 21473 invoked from network); 14 May 2011 20:27:28 -0000 Received: from unknown (209.85.161.41) by p3plsmtpa06-05.prod.phx3.secureserver.net (173.201.192.106) with ESMTP; 14 May 2011 20:27:28 -0000 Received: by fxm18 with SMTP id 18so2969200fxm.0 for ; Sat, 14 May 2011 13:27:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.57.86 with SMTP id b22mr1281510fah.95.1305404846515; Sat, 14 May 2011 13:27:26 -0700 (PDT) Received: by 10.223.69.141 with HTTP; Sat, 14 May 2011 13:27:26 -0700 (PDT) Date: Sat, 14 May 2011 13:27:26 -0700 Message-ID: From: PJ Weisberg Content-Type: multipart/alternative; boundary=0015174734302a24cc04a34240ba X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.6 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.6 (-----) --0015174734302a24cc04a34240ba Content-Type: text/plain; charset=ISO-8859-1 Start with these commands in the shell: echo test > file.txt echo "foo\ntest\nbar" > other.txt diff -u file.txt other.txt > diff.patch The resulting diff.patch contains: --- other.txt 2011-05-14 12:56:21.000000000 -0700 +++ file.txt 2011-05-12 23:35:47.000000000 -0700 @@ -1 +1,3 @@ +foo text +bar Now open that file with emacs -Q and run 'M-x diff-fixup-modifs'. It chokes because there's no , after the -1. If I'm reading diff-mode.el correctly, the line that raises the error will *always* raise that error, because it's trying to use (match-end 2) as a character position after (match-string 2) has already returned nil. Oops. :-/ In case it matters, my version of diff is: $ diff --version diff (GNU diffutils) 3.0 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, and Len Tower. In GNU Emacs 23.3.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2011-04-10 on raven, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10905000 configured using `configure '--build' 'i486-linux-gnu' '--build' 'i486-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/emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.3/leim' '--with-x=yes' '--with-x-toolkit=lucid' '--with-toolkit-scroll-bars' '--without-gconf' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Diff Minor modes in effect: diff-auto-refine-mode: t tooltip-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-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x d i f SPC f i x M-x r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Loading vc-git...done Making completion list... call-interactively: Wrong type argument: integer-or-marker-p, nil Load-path shadows: /usr/share/emacs/23.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs/23.3/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/23.3/lisp/tempo /usr/share/emacs/23.3/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.3/lisp/textmodes/flyspell /usr/share/emacs/23.3/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.3/lisp/textmodes/ispell /usr/share/emacs/23.3/site-lisp/css-mode/css-mode hides /usr/share/emacs/23.3/lisp/textmodes/css-mode Features: (shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils emacsbug help-mode view vc-git diff-mode easymenu easy-mmode tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind font-render-setting x-toolkit x multi-tty emacs) --0015174734302a24cc04a34240ba Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Start with these commands in the shell:

echo test > file.txt
e= cho "foo\ntest\nbar" > other.txt
diff -u file.txt other.txt= > diff.patch

The resulting diff.patch contains:

--- other= .txt=A0=A0=A0 2011-05-14 12:56:21.000000000 -0700
+++ file.txt=A0=A0=A0 2011-05-12 23:35:47.000000000 -0700
@@ -1 +1,3 @@<= br>+foo
=A0text
+bar

Now open that file with emacs -Q and run = 'M-x diff-fixup-modifs'.=A0 It
chokes because there's no , a= fter the -1.

If I'm reading diff-mode.el correctly, the line that raises the err= or
will *always* raise that error, because it's trying to use (match= -end 2)
as a character position after (match-string 2) has already retur= ned
nil.=A0 Oops. :-/

In case it matters, my version of diff is:

= $ diff --version
diff (GNU diffutils) 3.0
Copyright (C) 2010 Free Sof= tware Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html= >.
This is free software: you are free to change and redistribute it.
There= is NO WARRANTY, to the extent permitted by law.

Written by Paul Egg= ert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.


In GNU Emacs 23.3.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bar= s)
=A0of 2011-04-10 on raven, modified by Debian
Windowing system dis= tributor `The X.Org Foundation', version 11.0.10905000
configured us= ing `configure=A0 '--build' 'i486-linux-gnu' '--build&#= 39; 'i486-linux-gnu' '--prefix=3D/usr' '--sharedstatedi= r=3D/var/lib' '--libexecdir=3D/usr/lib' '--localstatedir=3D= /var/lib' '--infodir=3D/usr/share/info' '--mandir=3D/usr/sh= are/man' '--with-pop=3Dyes' '--enable-locallisppath=3D/etc/= emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/e= macs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp:/= usr/share/emacs/23.3/leim' '--with-x=3Dyes' '--with-x-toolk= it=3Dlucid' '--with-toolkit-scroll-bars' '--without-gconf&#= 39; 'build_alias=3Di486-linux-gnu' 'CFLAGS=3D-DDEBIAN -g -O2= 9; 'LDFLAGS=3D-g' 'CPPFLAGS=3D''

Important settings:
=A0 value of $LC_ALL: nil
=A0 value of $LC_CO= LLATE: nil
=A0 value of $LC_CTYPE: nil
=A0 value of $LC_MESSAGES: nil=
=A0 value of $LC_MONETARY: nil
=A0 value of $LC_NUMERIC: nil
=A0 = value of $LC_TIME: nil
=A0 value of $LANG: en_US.UTF-8
=A0 value of $XMODIFIERS: nil
=A0 loc= ale-coding-system: utf-8-unix
=A0 default enable-multibyte-characters: t=

Major mode: Diff

Minor modes in effect:
=A0 diff-auto-ref= ine-mode: t
=A0 tooltip-mode: t
=A0 mouse-wheel-mode: t
=A0 tool-bar-mode: t
= =A0 menu-bar-mode: t
=A0 file-name-shadow-mode: t
=A0 global-font-loc= k-mode: t
=A0 font-lock-mode: t
=A0 blink-cursor-mode: t
=A0 auto-= encryption-mode: t
=A0 auto-compression-mode: t
=A0 line-number-mode: t
=A0 transient-ma= rk-mode: t

Recent input:
<help-echo> <help-echo> <= help-echo> M-x d i f <tab>
SPC f i <tab> x <tab> &= lt;return> <help-echo> M-x r e
p o r <tab> <return>

Recent messages:
For information= about GNU Emacs and the GNU system, type C-h C-a.
Loading vc-git...done=
Making completion list...
call-interactively: Wrong type argument: i= nteger-or-marker-p, nil

Load-path shadows:
/usr/share/emacs/23.3/site-lisp/debian-startup hi= des /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/23.3/site= -lisp/html-helper-mode/tempo hides /usr/share/emacs/23.3/lisp/tempo
/usr/share/emacs/23.3/site-lisp/dictionaries-common/flyspell hides /usr/sha= re/emacs/23.3/lisp/textmodes/flyspell
/usr/share/emacs/23.3/site-lisp/di= ctionaries-common/ispell hides /usr/share/emacs/23.3/lisp/textmodes/ispell<= br> /usr/share/emacs/23.3/site-lisp/css-mode/css-mode hides /usr/share/emacs/23= .3/lisp/textmodes/css-mode

Features:
(shadow sort mail-extr messa= ge sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-de= code mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netr= c time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha= 1 hex-util hashcash mail-utils emacsbug help-mode view vc-git
diff-mode = easymenu easy-mmode tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
ima= ge fringe lisp-mode register page menu-bar rfn-eshadow timer select
scro= ll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame c= ham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech europeanethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook helpsimple abbrev loaddefs button minibuffer faces cus-face files
text-prop= erties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
= font-render-setting x-toolkit x multi-tty emacs)

--0015174734302a24cc04a34240ba-- From unknown Thu Aug 14 18:37:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8672: 23.3; diff-fixup-modifs fails for some small diffs Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 May 2011 14:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8672 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: PJ Weisberg Cc: 8672@debbugs.gnu.org Received: via spool by 8672-submit@debbugs.gnu.org id=B8672.130546860928253 (code B ref 8672); Sun, 15 May 2011 14:11:01 +0000 Received: (at 8672) by debbugs.gnu.org; 15 May 2011 14:10:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLc1J-0007Le-Ch for submit@debbugs.gnu.org; Sun, 15 May 2011 10:10:09 -0400 Received: from [12.21.149.2] (helo=shcommander.singledigits.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLc1H-0007LI-Hl for 8672@debbugs.gnu.org; Sun, 15 May 2011 10:10:08 -0400 Received: from [10.71.1.172] (helo=furball) by shcommander.singledigits.com with esmtp (Exim 4.70) (envelope-from ) id 1QLc1A-0007dV-4m; Sun, 15 May 2011 10:10:01 -0400 Received: by furball (Postfix, from userid 1000) id AA4431604A8; Sun, 15 May 2011 10:09:59 -0400 (EDT) From: Chong Yidong References: Date: Sun, 15 May 2011 10:09:59 -0400 In-Reply-To: (PJ Weisberg's message of "Sat, 14 May 2011 13:27:26 -0700") Message-ID: <87ei40ukaw.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.5 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) PJ Weisberg writes: > echo test > file.txt > echo "foo\ntest\nbar" > other.txt > diff -u file.txt other.txt > diff.patch > > Now open that file with emacs -Q and run 'M-x diff-fixup-modifs'.=C2=A0 It > chokes because there's no , after the -1. Thanks, I have committed a fix. From debbugs-submit-bounces@debbugs.gnu.org Sun May 15 10:10:20 2011 Received: (at control) by debbugs.gnu.org; 15 May 2011 14:10:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLc1T-0007Lz-Jk for submit@debbugs.gnu.org; Sun, 15 May 2011 10:10:19 -0400 Received: from [12.21.149.2] (helo=shcommander.singledigits.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QLc1S-0007Lo-Ke for control@debbugs.gnu.org; Sun, 15 May 2011 10:10:18 -0400 Received: from [10.71.1.172] (helo=furball) by shcommander.singledigits.com with esmtp (Exim 4.70) (envelope-from ) id 1QLc1M-0007jC-AP for control@debbugs.gnu.org; Sun, 15 May 2011 10:10:12 -0400 Received: by furball (Postfix, from userid 1000) id 260861604A8; Sun, 15 May 2011 10:10:12 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 8672 Date: Sun, 15 May 2011 10:10:12 -0400 Message-ID: <87vcxcqcl7.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) close 8672 thanks