From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9662 invoked by alias); 28 Jun 2012 18:33:28 -0000 Received: (qmail 9653 invoked by uid 22791); 28 Jun 2012 18:33:27 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from moutng.kundenserver.de (HELO moutng.kundenserver.de) (212.227.126.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Jun 2012 18:33:14 +0000 Received: from [127.0.0.1] (dslb-088-073-004-112.pools.arcor-ip.net [88.73.4.112]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MVJlO-1SLcxy2Cgo-00YALl; Thu, 28 Jun 2012 20:33:12 +0200 Message-ID: <4FECA35E.7060302@towo.net> Date: Thu, 28 Jun 2012 18:33:00 -0000 From: Thomas Wolff User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: /dev/clipboard corrupted References: <4FEB863A.7030108@towo.net> <20120628082021.GF17071@calimero.vinschen.de> In-Reply-To: <20120628082021.GF17071@calimero.vinschen.de> X-TagToolbar-Keys: D20120628203302248 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-06/txt/msg00535.txt.bz2 Am 28.06.2012 10:20, schrieb Corinna Vinschen: > On Jun 28 00:16, Thomas Wolff wrote: >> If the clipboard contains large data, the contents retrieved from >> /dev/clipboard gets corrupted. >> I compared the following in a few cases: >> * cat /dev/clipboard or cp /dev/clipboard (which are equal) >> * mouse-paste into mintty, read with cat >> * read /dev/clipboard within application >> >> and I found all three results to be different, the correct one >> sometimes being cat /dev/clipboard but not always. >> In today's case, the differences occured at byte 10240 and 65536 >> respectively, thus 10K-1 bytes or 64K-1 bytes being equal. > I can't reprocude this. There's also nothing in the /dev/clipboard > code which would rely on a 10K buffer or so. 64K, yes. But still, > I tried with wordpad, vi, mintty, cat, and cp with a text file of > about 90K. No problems. Do you have any reproducible testcase? Not really reproducible (maybe later) but some more observations. I made a small test program to read /dev/clipboard directly with different buffer sizes. I verified that this happens at borders of read() invocations. It is more likely to happen if there are non-ASCII characters just at this border, however, in one case it occurred after 2 blocks read where the non-ASCII was between blocks 1 and 2. Also, in one case, a CRLF newline at a border was just skipped (with non-ASCII somewhere before, probably). Typically, I see 2 bytes skipped, sometimes 1 but sometimes also ~100. Quite weird. I looked at the fhandler_clipboard read() code and somehow suspect the wcstomb although the observations are not strictly conclusive. (It's the non-cygwin-specific branch, after filling the clipboard from Windows, e.g. Firefox.) ------ Thomas -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple