Subject: bug#59023: 26.1; Setting find-name-arg to -regex breaks dired-do-find-regexp and dired-do-find-regexp-and-replace

From: [email-masked]
Date: Fri, 4 Nov 2022 19:01:43 +0100

In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2021-01-31, modified by Debian built on x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description:	Debian GNU/Linux 10 (buster)

Recent messages:
Quit
Type "q" in help window to restore its previous buffer.
Quit [2 times]
Type "q" in help window to restore its previous buffer, C-M-v to scroll help.
Quit [2 times]
Type "q" in help window to restore its previous buffer.
Mark set
scroll-up-command: End of buffer
Quit

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-9Yet8u/emacs-26.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2

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

Major mode: Dired by name

Minor modes in effect:
  hl-line-mode: t
  diff-auto-refine-mode: t
  openwith-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/renke/.emacs.d/elpa/seq-2.23/seq hides /usr/share/emacs/26.1/lisp/emacs-lisp/seq
/home/renke/.emacs.d/elpa/map-3.2.1/map hides /usr/share/emacs/26.1/lisp/emacs-lisp/map

Features:
(shadow sort mail-extr eieio-opt speedbar sb-image ezimage dframe
emacsbug sendmail time-stamp cl-print completion dos-w32 find-cmd
thingatpt help-fns radix-tree find-dired semantic/fw mode-local xref
project grep compile dired-aux elec-pair cl-extra help-mode eww mm-url
url-queue url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap shr svg xml dom browse-url
cap-words superword subword org-rmail org-mhe org-irc org-info org-gnus
nnir gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source tls gnutls utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
gnus-win org-docview doc-view jka-compr image-mode org-bibtex bibtex
org-bbdb org-w3m org-element avl-tree generator org advice org-macro
org-footnote org-pcomplete pcomplete org-list org-faces org-entities
noutline outline org-version ob-R ob-latex ob-emacs-lisp ob ob-tangle
org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs vc-arch sh-script
smie executable hl-line dired dired-loaddefs cus-edit vc-git diff-mode
easy-mmode bookmark pp openwith edmacro kmacro pcase map finder-inf
tex-site rx info package easymenu epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr wid-edit desktop frameset cl-loaddefs
cl-lib cus-start cus-load 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 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 dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 330501 52033)
 (symbols 48 38310 1)
 (miscs 40 576 576)
 (strings 32 107674 6592)
 (string-bytes 1 3014434)
 (vectors 16 45235)
 (vector-slots 8 1627611 234174)
 (floats 8 251 258)
 (intervals 56 13023 412)
 (buffers 992 57))
--text follows this line--

Hello,

setting the variable "find-name-arg" to "-regex" (as opposed to the
default "-name") causes "dired-do-find-regexp" and
"dired-do-find-regexp-and-replace" to falsely report that no matches
were found, even though the selected files clearly contain the search
string.

Steps to reproduce:
1. Create a file containing the string "hello".
2. Set the variable "find-name-arg" to "-regex" via Easy Customization.
3. Visit the directory containing the file created in step 1 in dired.
4. Mark the file created in step 1 in dired.
5a. Execute "dired-do-find-regexp" on the marked file by pressing "A"
    and enter "hello" in the prompt.
    => Function reports "user-error: No matches for: hello" but I
       expected it to open an "*xref*" buffer listing the file created
       in step 1.
5b. Execute "dired-do-find-regexp-and-replace" on the marked file by
    pressing "Q", enter "hello" in the first prompt and an arbitrary
    replacement string in the second prompt.
    => Function reports "user-error: No matches for: hello" but I
       expected it to open the file created in step 1 with the option to
       replace "hello" with the replacement string.

Kind regards

Renke