Subject: 29.0.50; Diff file motion commands skip file mode changes

From: Matthias Meulien <[email-masked]>
Date: Sat, 09 Apr 2022 14:19:10 +0200

Steps to reproduce:

1. Save the following diff in a file, say bug.diff:

diff --git a/INSTALL b/INSTALL
index b1e3c72c4b..ddf8787078 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,3 +1,4 @@
+foo
 GNU Emacs Installation Guide
 Copyright (C) 1992, 1994, 1996-1997, 2000-2022 Free Software Foundation,
 Inc.
diff --git a/README b/README
old mode 100644
new mode 100755
diff --git a/src/cm.c b/src/cm.c
index a175b4a338..b1c7db0b52 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -1,3 +1,5 @@
+/* bar */
+
 /* Cursor motion subroutines for GNU Emacs.
    Copyright (C) 1985, 1995, 2001-2022 Free Software Foundation, Inc.
     based primarily on public domain code written by Chris Torek

2. Visit that file using emacs -Q; The buffer major mode is expected to
be Diff mode, thus the M-{ and M-} keys are mapped to the `diff-file-prev'
and `diff-file-next' commands.

3. The diff file describes changes involving three files, INSTALL,
README and src/cm.c; But M-{ and M-} skip the diff concerning README

Analysis: Git diff shows file mode changes when the execution bit is
affected by the change. There may be no file content change, thus no
lines starting with --- or +++. In such case the regexp defined by
`diff-file-header-re' doesn't match which explains the bug.

This bug was identified while working on bug #54034.

Note that, after one enables Outline minor mode, then moving through
first level outline headers with C-c @ C-f
(`outline-forward-same-level') and C-c @ C-b works as expected, the
three file changes have been identified.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2022-04-04 built on carbon
Repository revision: f365607bc059169e5aa9f98c8418661d6fc6477d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM GTK3 ZLIB

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

Major mode: C/*l

Minor modes in effect:
  shell-dirtrack-mode: t
  bug-reference-prog-mode: t
  display-line-numbers-mode: t
  highlight-changes-mode: t
  minions-mode: t
  global-company-mode: t
  company-mode: t
  desktop-save-mode: t
  save-place-mode: t
  electric-pair-mode: t
  icomplete-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/transient-20220331.2312/transient hides /usr/local/share/emacs/29.0.50/lisp/transient
/home/matthias/.config/emacs/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/29.0.50/lisp/net/dictionary

Features:
(shadow emacsbug shortdoc shr-color view qp gnus-topic nndraft nnmh
nnfolder utf-7 epa-file mailalias smtpmail sort smiley gnus-cite
mail-extr gnus-async gnus-bcklg gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-ml gnus-msg nndoc gnus-cache gnus-dup
mm-archive gnutls network-stream crm debbugs-gnu debbugs soap-client
url-http url-gw nsm pcmpl-unix dabbrev log-edit misearch multi-isearch
tabify image-dired man smerge-mode diff hl-line add-log log-view
pcvs-util meson-mode disp-table make-mode rng-xsd xsd-regexp rng-cmpct
rng-nxml rng-valid nxml-mode nxml-outln nxml-rap follow cwarn generic
yaml-mode rst reftex-dcr reftex reftex-loaddefs reftex-vars tex-mode
shell textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check url-cache url-auth mhtml-mode hideshow cap-words superword
subword css-mode smie js sgml-mode facemenu conf-mode help-fns
radix-tree dired-aux mule-util python flyspell 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 org-agenda ox-html table
ox-ascii ox-publish ox org-element avl-tree ol-eww eww xdg url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu
mml2015 mm-view mml-smime smime dig gnus-sum shr pixel-fill kinsoku
url-file url-dired svg dom ol-docview doc-view jka-compr image-mode exif
ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi goto-addr whitespace vc-dir
bug-reference display-line-numbers hilit-chg vc-mtn vc-hg vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc eglot array jsonrpc ert ewoc debug
backtrace flymake-proc flymake compile imenu company-oddmuse
company-keywords company-etags etags fileloop generator xref project
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb avoid minions company pcase carbon-custom
cus-edit cus-load gnus-demon nntp gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc
parse-time gnus-spec gnus-win nnoo gnus-int gnus-range message sendmail
yank-media rmc puny rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus nnheader
gnus-util mail-utils range mm-util mail-prsvr wid-edit gnus-dired
dired-x dired dired-loaddefs org-capture org-refile org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete comint ansi-color ring org-list org-faces
org-entities org-version ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex iso8601 time-date ol org-keys oc org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
dictionary link connection advice markdown-mode edit-indirect color
thingatpt noutline outline skeleton find-file vc-git diff-mode
easy-mmode vc-dispatcher ispell comp comp-cstr warnings rx cl-extra
help-mode desktop frameset server bookmark text-property-search pp
saveplace elec-pair icomplete so-long autorevert filenotify autoinsert
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs generic-x face-remap proof-site proof-autoloads info
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 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 lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice simple 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 emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1329621 264198)
 (symbols 48 44493 1)
 (strings 32 233626 88247)
 (string-bytes 1 12818082)
 (vectors 16 109036)
 (vector-slots 8 2666192 186060)
 (floats 8 3015 1884)
 (intervals 56 42312 2418)
 (buffers 992 235))

-- 
Matthias