From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.pretest.bugs,gmane.emacs.devel Subject: Re: Emacs puts binary junk into the clipboard, marking it as text Date: Fri, 15 Sep 2006 10:30:41 -0600 Organization: IHS Message-ID: References: <1158280855.14121.69.camel@chrislap.madeupdomain.com> <450A514E.6020205@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1158337982 19980 80.91.229.2 (15 Sep 2006 16:33:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Sep 2006 16:33:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Fri Sep 15 18:33:01 2006 Return-path: Envelope-to: gebp-emacs-pretest-bug@gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GOGc7-0003eM-2C for gebp-emacs-pretest-bug@gmane.org; Fri, 15 Sep 2006 18:32:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOGc6-00033K-Iv for gebp-emacs-pretest-bug@gmane.org; Fri, 15 Sep 2006 12:32:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GOGc2-0002xB-9G for emacs-pretest-bug@gnu.org; Fri, 15 Sep 2006 12:32:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GOGbz-0002sU-NA for emacs-pretest-bug@gnu.org; Fri, 15 Sep 2006 12:32:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOGbz-0002s4-Ge for emacs-pretest-bug@gnu.org; Fri, 15 Sep 2006 12:32:19 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GOGeB-0005Fw-SP for emacs-pretest-bug@gnu.org; Fri, 15 Sep 2006 12:34:36 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GOGbq-0003YX-16 for emacs-pretest-bug@gnu.org; Fri, 15 Sep 2006 18:32:10 +0200 Original-Received: from 207.167.42.206 ([207.167.42.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 Sep 2006 18:32:10 +0200 Original-Received: from ihs_4664 by 207.167.42.206 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 Sep 2006 18:32:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-pretest-bug@gnu.org Original-Lines: 65 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.206 User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) In-Reply-To: <450A514E.6020205@swipnet.se> X-BeenThere: emacs-pretest-bug@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for CVS Emacs." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Errors-To: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.pretest.bugs:13913 gmane.emacs.devel:59881 Archived-At: Jan Djärv wrote: > > > Chris Moore skrev: >> Please describe exactly what actions triggered the bug >> and the precise symptoms of the bug: >> >> I run the Xfce 4 desktop environment, along with the >> xfce4-clipman-plugin applet which collects clipboard entries and >> allows me to chose between them from a menu. >> >> I have x-select-enable-clipboard set to t in Emacs, so whenever I >> 'kill' regions of the buffer, they get sent to the clipboard. >> >> Occasionally the clipman applet will start consuming all available >> CPU. This happens when I copy certain binary characters. Seems the >> clipman gets stuck in a loop trying to convert illegal an illegal UTF8 >> string. >> >> A very simple case which reproduces the bug: >> >>> I made a 1-byte file containing just character 0300 (octal), >>> copied that using Emacs, and clipman started printing its error >>> message over and over again. >> >> I reported this bug firstly to the Xfce BTS: >> >> http://bugzilla.xfce.org/show_bug.cgi?id=1945 >> >> but they told me it was a gtk bug, so I raised the same bug in the >> GNOME tracker: >> >> http://bugzilla.gnome.org/show_bug.cgi?id=349856 >> >> and they tell me it's an Emacs bug, saying: >> >>> Well, if emacs puts binary junk into a text property it is not gtk's >> fault. >>> Look at gtk_selection_data_get_text(): We only try to convert >> something to >>> utf8 if the sender claims that it is text... >> >> So I'm raising it here too! > > Isn't 0300 a valid unicode character? Yes, but it is not encoded as a single byte in UTF-8, it would be 2 bytes: o303 o200 (xC3 x80). > Anyway, when Emacs gets a > selection request for the clipboard with type UTF8_STRING, it eventually > ends up in xselect-convert-to-string. This function does: > > ((eq type 'UTF8_STRING) > (setq str (encode-coding-string str 'utf-8))) > > As far as I can tell, it does not check if str is all text, it seems to > return non-text unconverted. Should we check str first? And if it > does contain non-text, what should Emacs send back as type? STRING, TEXT? Doesn't that all depend on buffer-file-coding-system and selection-coding-system being set correctly? -- Kevin