GNU bug report logs - #48321
27.2; Text copied from *grep* buffer has NUL (0x00) characters

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "R. Diez" <rdiezmail-emacs@HIDDEN>; dated Sun, 9 May 2021 19:15:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 48321 <at> debbugs.gnu.org:


Received: (at 48321) by debbugs.gnu.org; 11 May 2021 12:53:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 11 08:53:19 2021
Received: from localhost ([127.0.0.1]:35298 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lgRt1-0001KS-I1
	for submit <at> debbugs.gnu.org; Tue, 11 May 2021 08:53:19 -0400
Received: from quimby.gnus.org ([95.216.78.240]:46370)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1lgRsy-0001KC-Nt
 for 48321 <at> debbugs.gnu.org; Tue, 11 May 2021 08:53:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=VOTmGvSF+Ya05StlCTqMSbF5h3d5GMbZw+LPmz4zjdM=; b=p/gC5IsEiAUBjnxMxjp4vE9Upu
 3L7TEYXLMhDLmgtwG1YVXnXb7AtTJ0V4YFKlJIaAs6GRUVfE7SCd1jrVsX1VwuMSpChGyBhf1AmBs
 GE710oOd0MIi8hvqiQvvE5Y8ZTqEiMrSXiuek7Pf7+hat8P4B75Ki488Fv4Ihgo7gjqk=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1lgRsq-00052v-4L; Tue, 11 May 2021 14:53:10 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: "R. Diez" <rdiezmail-emacs@HIDDEN>
Subject: Re: bug#48321: 27.2; Text copied from *grep* buffer has NUL (0x00)
 characters
References: <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d.ref@HIDDEN>
 <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d@HIDDEN>
X-Now-Playing: Coil's _Love's Secret Domain (1)_: "Titan Arch"
Date: Tue, 11 May 2021 14:53:07 +0200
In-Reply-To: <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d@HIDDEN> (R. Diez's
 message of "Sun, 9 May 2021 21:14:38 +0200")
Message-ID: <875yzpph3g.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: "R. Diez" <rdiezmail-emacs@HIDDEN> writes: > 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. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 48321
Cc: 48321 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

"R. Diez" <rdiezmail-emacs@HIDDEN> writes:

> 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.

Yup.  This is cleverly done by this bit in `grep-regexp-alist':

     nil nil
     (3 '(face nil display ":")))

That is -- the "highlight" we're applying is a `display' spec that says
that the separator should be displayed as ":".

Stefan's suggestion to transform the nul character in the filter in grep
wouldn't quite work, I think -- the filtering is done before the
matching.  So instead we need the thing that processes
`compilation-error-regexp-alist' to do the transformation after the
matches, I think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#48321; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 May 2021 19:15:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 09 15:15:00 2021
Received: from localhost ([127.0.0.1]:56620 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lfotI-0000P9-6X
	for submit <at> debbugs.gnu.org; Sun, 09 May 2021 15:15:00 -0400
Received: from lists.gnu.org ([209.51.188.17]:36494)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ruben10post@HIDDEN>) id 1lfotF-0000P0-Ls
 for submit <at> debbugs.gnu.org; Sun, 09 May 2021 15:14:58 -0400
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 <ruben10post@HIDDEN>)
 id 1lfotF-0000Gp-Gn
 for bug-gnu-emacs@HIDDEN; Sun, 09 May 2021 15:14:57 -0400
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 <ruben10post@HIDDEN>)
 id 1lfotA-0000KR-5H
 for bug-gnu-emacs@HIDDEN; 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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with HTTP; Sun, 9 May 2021 19:14:48 +0000
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)
From: "R. Diez" <rdiezmail-emacs@HIDDEN>
Subject: 27.2; Text copied from *grep* buffer has NUL (0x00) characters
To: bug-gnu-emacs@HIDDEN
Message-ID: <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d@HIDDEN>
Date: Sun, 9 May 2021 21:14:38 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.8.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
References: <0ed1c9c7-26c1-b801-1910-6d5bb50dec3d.ref@HIDDEN>
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)
Content-Length: 1552
Received-SPF: pass client-ip=77.238.179.83; envelope-from=ruben10post@HIDDEN;
 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-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.7 (--)

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





Acknowledgement sent to "R. Diez" <rdiezmail-emacs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#48321; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 11 May 2021 13:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.