From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "R. Diez" via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#48321: 27.2; Text copied from *grep* buffer has NUL (0x00) characters Date: Sun, 9 May 2021 21:14:38 +0200 Message-ID: <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d@yahoo.de> References: <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d.ref@yahoo.de> Reply-To: "R. Diez" Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2516"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 To: 48321@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 09 21:15:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lfotd-0000ZF-KT for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 21:15:21 +0200 Original-Received: from localhost ([::1]:34888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfotc-0000J3-KW for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 May 2021 15:15:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfotQ-0000Is-Uv for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 15:15:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfotL-0000Ue-9F for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 15:15:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lfotL-0000Pk-2C for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 15:15:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "R. Diez" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 May 2021 19:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48321 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16205877011563 (code B ref -1); Sun, 09 May 2021 19:15:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 May 2021 19:15:01 +0000 Original-Received: from localhost ([127.0.0.1]:56620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfotI-0000P9-6X for submit@debbugs.gnu.org; Sun, 09 May 2021 15:15:00 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:36494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfotF-0000P0-Ls for submit@debbugs.gnu.org; Sun, 09 May 2021 15:14:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfotF-0000Gp-Gn for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 15:14:57 -0400 Original-Received: from sonic309-25.consmr.mail.ir2.yahoo.com ([77.238.179.83]:46222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfotA-0000KR-5H for bug-gnu-emacs@gnu.org; Sun, 09 May 2021 15:14:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1620587688; bh=lXiMvDEyOg1RhXji4TgC41H42O3OiH0xYH73GU+GiY0=; h=From:Subject:To:Date:References:From:Subject:Reply-To; b=Vto1FMmuYGfH6oVE7KyJ/K0CU/iEeXdzRwcf+lf8VEzuF2n2h9o4N/D1lwuOxDXmUo2rcgH15HYQhWpUUlZiXVe5cGxdN2DnPQVtxGy9W41d/wRKdpiVyt8VHdbG/522jwSyb82OMj65UaOnbEC9Tj6Hia1+BN343lb6FY5DrTnZGAZ3cGS64Cgnz7c6XpEl1TFtPuKzCIlO7C9jqbc//GIxgoI2LiWWPNTaG10ubl/kXGQCzushndLq+e4RCXMARD48ixC4TWM/ID5uIyxqPjV9Jg6BtPz3BFdIiTqhSPNuXTWtXrUI6poeDDVYRVL9xWD7vT0+JseIdpcR7cDkeQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1620587688; bh=/lNm5R6wzJqf+teSDE3Hsagq9Vip+M9WEZ7gxvIDvqM=; h=X-Sonic-MF:From:Subject:To:Date:From:Subject; b=Wdi8MHKc71BtfdSaXHmeOen+RaLrY0/ibPgxG5eslJix1ln4/5TzbzF4cVV+tzU24kjbY21d26NfEcNy5+cNcW4tmz9f3oIReWicGa2O3iYK6ZrX96Wy/NKIlrnMYHK8ORyOTM9eQxZa2QEt97oE0l2EctlvR04xqhZq8ic1CKmoDLOl2Q+++2EuELxML21rp2srMK6KHdCJtSEx6CpGoQWq2Y4YmzMNScPL0QAzYHWcORnFJdrxfF03KmqUnFweEPEylT5T4ANZS/uLhhuIk+GK/NtfG8EjX6fWz3tNOHpd1+TZj5bZQYTvl31OS3AK5Hhdsw/YgCig3n6DHCG7gA== X-YMail-OSG: ijJ8OQoVM1kuhR1muXvZk7aIpmlbL_ryO7onJy.YTbOhOz.nmrAGGTVzC3XKfrB eZPbxLZFHulfVZ1GPMTtIueAV3oZdWrKdti3GTWbU8x1.v4XdAEDLKBBCKDubHDtp0hr4NvZaaTl ZHuBJUmS8y2B4yC7zQABfQ7XZBr_oHRXrqAEvVK9WHxNxrD.2Oh2F7PU2HMVR_phv_947BnPQrJH lbJHFkS_pmOsUs.GapWBhSCqLKMZwY7Dft5i6rPK33q95BsSjNjPwoe.WiFu7wQY.fgoo1jbtgHG bhSWSuBECqjXdvY7_DE00OtegYEk2KVKPBd9O0eNqeTvAkVNkYHKarwyadnB4yaDCiV.uFkDeHuw 61jUKh_wM_gHunC336U4XbaKZpgBpWOhdYNt2iE5NV7yauYP1IJfjL2tVAvZHE7n0eiuar1INhyx iMQCgSEyPsoRMOhpcQVJLeA.Dz26zy_027S0sylVOH8We9CROYiYxeY9vlKrXwqf1RVNVzrS6gSy RycHyR7Ky61tTk.ax_uBzf.4GCT.ga0tu3CENZa4CAk9deFPct9GkQ109COuz5AhhaZbvJEL3y20 3QunjPkv4sznE59MoiTOdF5b5RcZYDDxkcP2COuZikZL0frAGDssfJkU4nn2EgSlinhNGRCRH0NR bh90PsMZtOlndPtdXvmtC0QXv7FsubVjDq.NUqHV50.401PkQbWeOGHPgqhSE.pMSIjD.e0UsUJE yeBpXRHLa8YkVUcPu7Xb.1Y7Nf4.vBz7UB30k.GMGavZX8iarsBP1X9z5YYTemK66xUwt0IChDEg tQsG9MdzFqcgFpNs7RIIfrk6SAreTkL.KljNKUWE8e X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Sun, 9 May 2021 19:14:48 +0000 Original-Received: by kubenode512.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 7e878a34b6899fcf3b37625d207c501b; Sun, 09 May 2021 19:14:39 +0000 (UTC) Content-Language: en-GB X-Mailer: WebService/1.1.18231 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/16) Received-SPF: pass client-ip=77.238.179.83; envelope-from=ruben10post@yahoo.de; helo=sonic309-25.consmr.mail.ir2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:206109 Archived-At: Emacs' default "Grep Command" is "grep --color -nH --null -e ", which includes option "--null". This means that grep is embedding an ASCII NUL character (a binary 0x00) after the filenames. This is what an rgrep text search occurrence looks like in the *grep* buffer: ./some/file.txt:123:some text line The first ':' is actually a binary null, but the *grep* buffer hides this fact. If you copy that text line to an Emacs text file buffer, it then looks like this: ./some/file.txt^@123:some text line The ^@ is the representation for the binary null, but that is easy to miss in long text lines. A text file with an embedded NUL character causes problems everywhere. There are errors or warnings with Meld, Pluma, Geany, Mousepad, and probably many more. In my opinion, copying text from a *grep* buffer that looks like ":" should not suddenly deliver a NUL character instead. That's just unexpected and prone to problems down the line. Stefan Monnier suggested the following: ----8<----8<----8<---- This "what you see in NOT what you get" is indeed undesirable. I'm not sure it's easy to fix in a reliable way in Emacs (beside not using `--null` as Eli points out), but I suggest you `M-x report-emacs-bug`. Maybe grep-mode can add a `filter-buffer-substring-function` that converts those NUL into `:`. ----8<----8<----8<---- For more information, see the discussion starting with this mailing list message: Text copied from *grep* buffer has NUL (0x00) characters https://lists.gnu.org/archive/html/help-gnu-emacs/2021-05/msg00360.html