X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=em
	oNPb5OSVtSCu7cbLwXDVeSXLMm3NYZ81TI2IBZjF/uX0nYWYLUiNwfUjTosHx5uJ
	7r8TQ0BsAYrS4BbbsqbF+tTpyVYxDQKeptO6pKqV0LHHchxw87reVh1D0iQHmVMe
	ZfkqtgYAZjpV9Tkd+WJGhx9SMPVYaRN84ILAIXsXo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=N8yKmAnv
	QM2HWTo+xaS9XUxbCHQ=; b=qLSdGJ7ZKm8sWAdsHZWn5O8skls8qRu9peI2n4lO
	RBzSP77KL4sp9RW4bY2w+SRtgCKrvma5onpYG1v/5vbZBA1/M3kk0alJrY6k9aSL
	yfjp9ljcB1E8XecQ+CZUEEKr9w73DplslyRNV94EfDwbH5sEOG7WcBeWAxpLPS6E
	qgg=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RDNS_NONE,SPF_PASS autolearn=ham version=3.3.1
MIME-Version: 1.0
X-Received: by 10.180.82.101 with SMTP id h5mr1115596wiy.27.1376024038848; Thu, 08 Aug 2013 21:53:58 -0700 (PDT)
In-Reply-To: <5203C238.6010809@cs.utoronto.ca>
References: <5203A1A3.30200@cs.utoronto.ca>	<20130808153250.GN16868@calimero.vinschen.de>	<20130808154842.GQ16868@calimero.vinschen.de>	<5203C238.6010809@cs.utoronto.ca>
Date: Fri, 9 Aug 2013 05:53:58 +0100
Message-ID: <CAHWeT-Yd7Bk4vxFqxJGBeDfQzrVA=QAv6miF37vJeQuufS00Ow@mail.gmail.com>
Subject: Re: Redirecting cat and paste to file gives garbage
From: Andy Koppe <andy.koppe@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8

On 8 August 2013 17:07, Ryan Johnson wrote:
> On 08/08/2013 11:48 AM, Corinna Vinschen wrote:
>>
>> On Aug  8 17:32, Corinna Vinschen wrote:
>>>
>>> On Aug  8 09:48, Ryan Johnson wrote:
>>>>
>>>> Hi all,
>>>>
>>>> (no, that's not a typo in the subject line)
>>>>
>>>> 64-bit install, bash inside mintty, all latest packages with the
>>>> cygwin1.dll snapshot shown below...
>>>>
>>>> # <<< --- begin STC --->>>
>>>> $ uname -a
>>>> CYGWIN_NT-6.1 ryan-laptop-v02 1.7.23s(0.268/5/3) 20130729 19:11:42
>>>> x86_64 Cygwin
>>>>
>>>> $ echo "Reading" > /dev/clipboard
>>>>
>>>> # hit [shift]+[insert] to paste
>>>> # (hopefully 8 characters is not "too long" to paste into a TTY)
>>>> # then hit ^D to finish
>>>> $ cat > tmp.txt
>>>>
>>>> $ cat tmp.txt
>>>> Rg
>>>> eRaedaidnign
>>>> g
>>>
>>> The only idea I have is this.  The clipboard data is stored as
>>> CF_UNICODETEXT and as the Cygwin-private CYGWIN_NATIVE_CLIPBOARD format.
>>> How's shift-insert implemented in mintty?  If it reads the CF_UNICODETEXT
>>> part and sends it to the pty unchanged, that could explain
>>> this behaviour.
>>
>> The pty already gets 16 chars.  And pasting the text into CMD or, FWIW,
>> any Windows console window works as expected.  So this looks like a
>> mintty bug right now.
>
> That's what I thought at first, too, but it pastes fine directly into the
> terminal... and then I had a brain cramp and didn't add that to the STC:
>
> $ echo reading > /dev/clipboard
> # press [shift]+[insert] here...
> $ echo
> reading
>
> Still a mintty bug?

Don't think so. Mintty has no idea what it's pasting to; it just
writes the clipboard content to the pty (which it obtains from
CF_UNICODETEXT and converts to the current charset).

I couldn't reproduce the problem with 1.7.22, but I could with the
20130729 snapshot. With 1.7.22, when you paste during the 'cat
>tmp.txt', the text is correctly echoed back to the terminal and put
into the file. With the snapshot, it looks like the actual input and
the echo both end up in the file.

Andy

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

