From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#6991: Please keep bytecode out of *Backtrace* buffers Date: Tue, 22 Nov 2016 16:07:06 -0500 Message-ID: References: <8739tm9vzl.fsf@jidanni.org> <87vb5ct1lz.fsf@gnus.org> <2223f654-1e67-4a9a-a471-828fd4078410@default> <87fumokzbp.fsf@users.sourceforge.net> <83oa1bc3x2.fsf@gnu.org> <87d1hrlek2.fsf@users.sourceforge.net> <83eg27bjah.fsf@gnu.org> <87a8cvlcmk.fsf@users.sourceforge.net> <8360njb9o5.fsf@gnu.org> <877f7zksm0.fsf@users.sourceforge.net> <83oa1a9msk.fsf@gnu.org> <83vavf73ei.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1479848896 16526 195.159.176.226 (22 Nov 2016 21:08:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 22 Nov 2016 21:08:16 +0000 (UTC) Cc: Juanma Barranquero , John Wiegley , Stefan Monnier , 6991@debbugs.gnu.org, Lars Magne Ingebrigtsen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 22 22:08:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9IIV-0003Xd-HW for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Nov 2016 22:08:11 +0100 Original-Received: from localhost ([::1]:57999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9IIZ-0004dC-4l for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Nov 2016 16:08:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9IIQ-0004d5-AL for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 16:08:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9IIM-0005Sy-KI for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 16:08:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51467) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c9IIM-0005Sr-EW for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 16:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c9IIM-0001HC-3U for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2016 16:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Nov 2016 21:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6991 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6991-submit@debbugs.gnu.org id=B6991.14798488444851 (code B ref 6991); Tue, 22 Nov 2016 21:08:02 +0000 Original-Received: (at 6991) by debbugs.gnu.org; 22 Nov 2016 21:07:24 +0000 Original-Received: from localhost ([127.0.0.1]:38633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9IHg-0001G5-8r for submit@debbugs.gnu.org; Tue, 22 Nov 2016 16:07:24 -0500 Original-Received: from mail-oi0-f68.google.com ([209.85.218.68]:36371) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9IHY-0001Fk-SO for 6991@debbugs.gnu.org; Tue, 22 Nov 2016 16:07:16 -0500 Original-Received: by mail-oi0-f68.google.com with SMTP id u15so4612113oie.3 for <6991@debbugs.gnu.org>; Tue, 22 Nov 2016 13:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JvxF92pYNty+YFz5S7SwaWNZF5GWO+3CbmyHeEgdUxc=; b=WNlnRD4883fvfDBUXO5xhBU2dDF3ge+mAvvdLHDVMlzAHpYH1jl1by++hpho8Vjttm DCTYGLFNQIWihs11mZ5tLl0upY44/z4JhrMYdSIj/Ka7NckFdkBTbdwc82sh7eyegnkl fwbY/zvixcWPaaxbG1saEBD7PG0ltwYbhpW3wAAomU4Dp4AUSe4afF8olAPdARyFVZvB RI/dnJk9GumVA94PjhcEcqpgu9PEob3ySSd7eACy88yAgi0+MDlYHK8Tf6lsXjd/Ru+V /UeUK1XhBBz3XGByGVBcIiZ28Nw3cu2+82WvPhOfQKvVlErBJhbAe3Gjp6/gxVsESYz0 IRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=JvxF92pYNty+YFz5S7SwaWNZF5GWO+3CbmyHeEgdUxc=; b=gI71qS4s9fEUQVPEjDrXw1P7XPm6h2x1zeH/8iN2k6jtS9dOw9rQIAtf7cqd1UaQel 0qWi4+443ZglRqfwmnyUjVYshHGv/rWawpwjBOPfmMJIJ18BRYuA5t5ng/OjcC3RR7Zc aSA/WK9XpQ30M5C36UrWiGuSM3xuddOc24v1OkCZg5Uo0kQUvCpV2yBhvi7VYD3WwXll 0o0KJPjt85rXchtMtw1ynqbrZs+ewEXN3J6pCei9eMkYZ/72/7Lq6Z+EX1BGxz3oZ35h DfGfqD9weBkwg8XaI95ajNHRGdpQ0W5e2cZ1G3DDAxkQ1ls59sNT6ahGSJNMaWe/dAgJ nNhg== X-Gm-Message-State: AKaTC00oFQC6Kk2hRybJMdZgr45ZabvmzY4tc4bIqrDRVdcD5oL3QORVaP34JmNse4RwVexy8wYdhLDOU6Mp/Q== X-Received: by 10.202.198.23 with SMTP id w23mr14523717oif.187.1479848826933; Tue, 22 Nov 2016 13:07:06 -0800 (PST) Original-Received: by 10.157.4.67 with HTTP; Tue, 22 Nov 2016 13:07:06 -0800 (PST) In-Reply-To: <83vavf73ei.fsf@gnu.org> X-Google-Sender-Auth: s1qbQ4sTIUza7V6iWsxsCs20ChU X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125996 Archived-At: On Tue, Nov 22, 2016 at 1:52 PM, Eli Zaretskii wrote: >> From: Noam Postavsky >> Date: Tue, 22 Nov 2016 13:07:13 -0500 >> Cc: 6991@debbugs.gnu.org, Juanma Barranquero , John Wiegley , >> Stefan Monnier , Lars Magne Ingebrigtsen , >> Drew Adams >> >> On Sun, Nov 20, 2016 at 10:46 AM, Eli Zaretskii wrote: >> > >> > It just doesn't feel right to me to fix a problem that is specific to >> > selections in a general-purpose low-level facility for printing >> > strings. Emacs can handle null bytes in strings very well, so I see >> > no need to change the print functions. >> >> Does the fact that this replacement would only happen when >> `print-escape-nonascii' is non-nil help at all? And the fact that this >> same function already escapes newline, formfeed, and every character >> larger than 0x80 (all of which Emacs can handle in strings too)? >> >> Can we have both solutions? The selection fix is lossy, so avoiding >> the need for it where possible seems like a good thing to me. > > I'm confused: which problem the above is supposed to fix? Are we > still talking about putting null bytes in selections, or are we > talking about something else? The original bug report is about copying backtraces containing byte code to other applications (e.g., web browser, mail client, etc). The byte code in backtraces is currently printed with several characters backslash escaped (newline, formfeed, backslash, double quote, and characters higher than 0x80). I propose to extend this escaping to null bytes as well. That will (somewhat indirectly) solve the problem of copying backtraces to other applications, without lossyness (i.e., (equal (read (print str)) str) remains true). It won't solve the problem of copying arbitrary text containing null bytes to other applications, it only avoids the most common case of the user needing to copy text containing null bytes. So in addition to that, your proposal to escape null bytes in xselect and w32select would still be needed to cover the general case. The drawback to replacing nulls in the {x,w32}select code is that the conversion is lossy, and there is a slightly increased chance of the user not noticing there was lossy conversion (relative to the current lossy "conversion" of truncating the string).