From unknown Wed Jun 18 00:26:50 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#63828 <63828@debbugs.gnu.org> To: bug#63828 <63828@debbugs.gnu.org> Subject: Status: 29.0.90; project-query-replace-regexp tries to find-and-replace in binary files Reply-To: bug#63828 <63828@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:26:50 +0000 retitle 63828 29.0.90; project-query-replace-regexp tries to find-and-repla= ce in binary files reassign 63828 emacs submitter 63828 Spencer Baugh severity 63828 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 01 16:16:22 2023 Received: (at submit) by debbugs.gnu.org; 1 Jun 2023 20:16:23 +0000 Received: from localhost ([127.0.0.1]:38480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q4oic-0008FH-3l for submit@debbugs.gnu.org; Thu, 01 Jun 2023 16:16:22 -0400 Received: from lists.gnu.org ([209.51.188.17]:32908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q4oiW-0008F5-RW for submit@debbugs.gnu.org; Thu, 01 Jun 2023 16:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4oiV-0001kf-Be for bug-gnu-emacs@gnu.org; Thu, 01 Jun 2023 16:16:15 -0400 Received: from mxout6.mail.janestreet.com ([64.215.233.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4oiS-0006sp-Oc for bug-gnu-emacs@gnu.org; Thu, 01 Jun 2023 16:16:15 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: 29.0.90; project-query-replace-regexp tries to find-and-replace in binary files Date: Thu, 01 Jun 2023 16:16:03 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=64.215.233.21; envelope-from=sbaugh@janestreet.com; helo=mxout6.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 1. emacs -Q 2. Open a git repository which has some binary files committed, or any other project that has binary files. 3. C-x p r foo bar 4. query-replace will enter the binary files Perhaps it should not do this? Perhaps fileloop-initialize-replace should skip binary files? Perhaps by some customization? In GNU Emacs 29.0.90 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2023-05-17 built on igm-qws-u22796a Repository revision: 4d08492296c2a6d2910f2b740c2d2508275458fc Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: CentOS Linux 7 (Core) Configured using: 'configure --with-x-toolkit=lucid --with-gif=ifavailable' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: C/*l Minor modes in effect: bug-reference-prog-mode: t jane-fe-minor-mode: t editorconfig-mode: t which-function-mode: t global-git-commit-mode: t magit-auto-revert-mode: t auto-revert-mode: t shell-dirtrack-mode: t server-mode: t windmove-mode: t savehist-mode: t save-place-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-mode: t menu-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 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 Features: (mhtml-mode css-mode js c-ts-common sgml-mode facemenu htmlize ox-odt rng-loc rng-uri rng-parse rng-match 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 rect smiley gnus-cite gnus-async gnus-bcklg gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml gnus-msg disp-table nndoc gnus-cache gnus-dup mm-archive url-http-ntlm ntlm hmac-md5 hex-util md4 network-stream url-cache debbugs-gnu debbugs-compat debbugs soap-client url-http url-gw nsm rng-xsd rng-dt rng-util xsd-regexp hl-line display-line-numbers org-goto sql cal-move textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check etags fileloop cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cc-bytecomp shadow mail-extr emacsbug dabbrev dos-w32 find-cmd tutorial man sort conf-mode make-mode mule-util completion descr-text cus-start quail shortdoc cal-iso org-datetree tabify org-capture org-element org-persist org-id org-refile avl-tree generator oc-basic 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 gnutls dig ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi misc pulse find-dired bug-reference magit-imenu git-rebase face-remap vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc-git cl-print dired-aux help-fns radix-tree misearch multi-isearch vc-fe sh-script treesit executable goto-addr cus-edit cus-load vc-hg vc-dir vc vc-dispatcher tramp tramp-cache time-stamp tramp-loaddefs trampver tramp-integration tramp-compat ls-lisp ffap jane-merlin merlin-imenu merlin-xref merlin-cap merlin jane-async-merlin jane-completion grep jane-common jane-fe-project xref jane-fe-menu ecaml_plugin linum view gopcaml magit-bookmark bookmark image+ advice image-file image-converter editorconfig editorconfig-core editorconfig-core-handle editorconfig-fnmatch whitespace jane-auto-modes vba-mode markdown-mode color jane jane-micro-features jane-diff unified-test-mode shell-file core core-buffer core-error core-util ert pp ewoc debug backtrace jane-sexp jane-ocaml jane-tuareg-theme tuareg tuareg-compat tuareg-opam skeleton flymake-proc flymake warnings thingatpt smie caml-types caml-help caml-emacs find-file compile jane-cr jane-align jane-deprecated jane-smerge gnu-elpa-keyring-update jane-ocp-indent ocp-indent cl jane-util ob-shell page-ext dired-x magit-extras project magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff diff-mode git-commit log-edit pcvs-util add-log magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process with-editor shell server magit-mode transient edmacro kmacro magit-git magit-section magit-utils crm dash cl-extra help-mode windmove org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete pcomplete org-list org-footnote org-faces org-entities noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range message sendmail yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util text-property-search time-date mail-utils range mm-util mail-prsvr wid-edit org-version org-compat org-macs format-spec gdb-mi bindat gud comint easy-mmode files-x derived ansi-osc ansi-color ring vundo pcase cyberpunk-theme savehist saveplace project-autoloads vundo-autoloads magit-autoloads xref-autoloads csv-mode-autoloads magit-section-autoloads cyberpunk-theme-autoloads url-http-ntlm-autoloads url-auth git-commit-autoloads with-editor-autoloads finder-inf info dash-autoloads vc-hgcmd-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv 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 seq simple cl-generic indonesian philippine 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 theme-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 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 1368302 192959) (symbols 48 70838 33) (strings 32 300583 10905) (string-bytes 1 10472195) (vectors 16 121005) (vector-slots 8 2726004 176199) (floats 8 754 373) (intervals 56 70981 4481) (buffers 976 141) (heap 1024 768733 170632)) From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 02 02:07:44 2023 Received: (at 63828) by debbugs.gnu.org; 2 Jun 2023 06:07:44 +0000 Received: from localhost ([127.0.0.1]:38965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q4xwu-0006Yw-EM for submit@debbugs.gnu.org; Fri, 02 Jun 2023 02:07:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q4xwp-0006Yd-0W for 63828@debbugs.gnu.org; Fri, 02 Jun 2023 02:07:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4xwj-0006dL-Iw; Fri, 02 Jun 2023 02:07:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=clXSdPL0soVor/EEwQZXo0jJzhMbmntE21nJLlAQ5dY=; b=MYB8Wtv8lD8h uxzWAQ3s0dYrBZ6RlhMyQsncLtjblbTfNEFhYqaIJKdUD9PXCbbxfit1yJkwh5gTP9VKG+w7l0oVE vSTQSCKSyodt99weybqz2QzMr5IjGNBiTJEnUviwGMDaNUxFU7t0ygm88n5Yq2SSkzYoQilwE/At7 eKVSYW6BdpfTFSIc3XZVSW+E7GnKXsBU5QjD+NiskZ6GJqrUHVoU4RqRPmtU0M9qB02iz1Ts6svKM 41PpU/qmDJUWcOBPkIPgmJpKrNmFB0vkCIH4MzsjCw3M3C03hcxu3uqQ3ogWPiCgcDKDjjH5MnyjM B+1QrEpj5c5ru67dpG23qA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4xwe-0004bM-Em; Fri, 02 Jun 2023 02:07:33 -0400 Date: Fri, 02 Jun 2023 09:08:16 +0300 Message-Id: <83y1l2bdm7.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Thu, 01 Jun 2023 16:16:03 -0400) Subject: Re: bug#63828: 29.0.90; project-query-replace-regexp tries to find-and-replace in binary files References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 63828 Cc: 63828@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Date: Thu, 01 Jun 2023 16:16:03 -0400 > > > 1. emacs -Q > 2. Open a git repository which has some binary files committed, or any > other project that has binary files. > 3. C-x p r foo bar > 4. query-replace will enter the binary files > > Perhaps it should not do this? Perhaps fileloop-initialize-replace > should skip binary files? Perhaps by some customization? Either user option or prefix argument, IMO. And this should be documented with the caveat that a VCS can decide that a file is binary even when it is not. For example, I've seen Git treating very large parser.c files in tree-sitter grammar repositories as binary files for some reason. Another example is CVS on MS-Windows: best practice is to checkout all the files with the -kb switch, so that the client doesn't attempt to convert EOLs to the Windows CR-LF format (which ruins some files). From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 02 21:47:16 2023 Received: (at 63828) by debbugs.gnu.org; 3 Jun 2023 01:47:16 +0000 Received: from localhost ([127.0.0.1]:41099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5GMN-0006oS-Od for submit@debbugs.gnu.org; Fri, 02 Jun 2023 21:47:16 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:44699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5GMJ-0006oB-H5 for 63828@debbugs.gnu.org; Fri, 02 Jun 2023 21:47:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E1E5F3200961; Fri, 2 Jun 2023 21:47:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 02 Jun 2023 21:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1685756825; x=1685843225; bh=KAz1zCsEvYK7qZ9Hj8b6rkhmkRQCLFBk+ke VTomMh+g=; b=cAj6ghOJTFIw88xPQ7tmg8eOTDiHRsf57KAZlLTLl2YA0ERn2Qk UOgxoweDa3+3C/dJ+BP+yInpopLi5a0Z9jGca8ZkbdcwbX1bCnkY2TheCBzkZjzv iBxP9PGtp4rikvTst1akYKanUFUqYS5ovrr//l+hPG1afAie39FirYt5e+/y8FAb k+RrnKaTVvzj4lCJn0ETbYMIidtQrKK9oNkWD7IvCh4cx567zqr0mv6XI0FtlyBQ SvOis3ieNkGTn0LKmek28F3m4snkemBXAsbNKoHsRdUQqc924HrlAXSK2jd+VjXF 4f11y/Oj92rwDqkl9zAwCNbpCMQgHMc37eQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1685756825; x= 1685843225; bh=KAz1zCsEvYK7qZ9Hj8b6rkhmkRQCLFBk+keVTomMh+g=; b=F /4Ta26y6H20qzlTcGYzlBLYFqElvZ3VF0AeDsZ8CWOyRLJOD2yhJ58y6k58+0iN/ pgliwnK23ZaISj3clOkyU33mXksNi5Naj860oLUFR3SvjJGPeLnhJZ9mxNQ7zuyI uWsK8mMGRJr9bEOP1csMbYrQhuD5ut126Wlbna/RXuPNf6uifUSV/0je8CoHGlv1 p2fP2vTRKIT61EWXIprI12KO7Zqs1+jTI+EJ22UlJMiKtvWMdicrdlgfccJyi1UV Zd0OsDAsYhnbd1ntMAHb6mwtmDTyX3u0gcuCkKBFxQrWMv9E97HC0s/1pOSrZvtK WHpSLxvBUU9hur0P8oC6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeelgedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeghedthedujeeiteeutddtjeekheejteeukeehffdutdejuedvfeevueeviedu udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 2 Jun 2023 21:47:04 -0400 (EDT) Message-ID: <0d8df374-dcb7-0dd7-f14c-11713ede2bc8@gutov.dev> Date: Sat, 3 Jun 2023 04:47:02 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: bug#63828: 29.0.90; project-query-replace-regexp tries to find-and-replace in binary files Content-Language: en-US To: Spencer Baugh , 63828@debbugs.gnu.org References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 63828 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On 01/06/2023 23:16, Spencer Baugh wrote: > 1. emacs -Q > 2. Open a git repository which has some binary files committed, or any > other project that has binary files. > 3. C-x p r foo bar > 4. query-replace will enter the binary files > > Perhaps it should not do this? Perhaps fileloop-initialize-replace > should skip binary files? Perhaps by some customization? It would be useful if you compare to what project-find-regexp does in such project: does it produce the matches in said binary files? If it behaves better (from your POV), one solution could be to pre-filter the list of project files using the same search, before passing them to project-query-replace-regexp. It can have benefits in performance as well. (BTW JFYI, you can press 'r' inside the project-find-regexp output buffer instead of using 'project-query-replace-regexp'.)