Subject: Re: Incompatible clipboard format between 32bit and 64bit cygwin
From: Brian Inglis <[email-masked]>
To: [email-masked]
Date: Sun, 26 Sep 2021 14:46:56 -0600
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>

On 2021-09-26 13:09, Lee via Cygwin wrote:
> On 9/26/21, Thomas Wolff wrote:
>> Am 26.09.2021 um 20:37 schrieb Thomas Wolff:
>>> Am 26.09.2021 um 11:50 schrieb Mark Geisert:
>>>> Takashi Yano via Cygwin wrote:
>>>>> I noticed that cygwin clipboard is not compatible
>>>>> between 32bit and 64bit cygwin.
>>>>> If I run 'echo AAAAAAAA > /dev/clipboard' in 32bit cygwin,
>>>>> and run 'cat /dev/clipboard' in 64bit cygwin, this result in
>>>>> cat: /dev/clipboard: Bad address
>>>>> This is because the structure
>>>>> typedef struct
>>>>> {
>>>>>     timestruc_t   timestamp;
>>>>>     size_t    len;
>>>>>     char      data[1];
>>>>> } cygcb_t;
>>>>> defined in fhandler_clipboard.cc has different size.
>>>>> Is this the known issue?

>>>> I doubt anybody has ever tried what you did.

>>> I have and it failed; I just didn't find it important enough to report
>>> it here... Thanks for the plan to fix it.

>>>> I have been testing getclip and putclip between 32- and 64-bit
>>>> environments, but neglected to test Cygwin-internal clipboard format
>>>> that prepends cygcb_t to the user-supplied data.

>> As we're at it, what's the purpose of a cygwin-internal clipboard format
>> at all?

> speed?
> Maybe I'm not understanding the question, but I put a question to this
> list ~3 years ago about right-click/paste into a mintty window being
> **really** slow and the answer was to use getclip:
> $ time d2u < /dev/clipboard > hosts-3.txt
> real    0m11.372s
> user    0m3.749s
> sys     0m6.984s
> $ time cat /dev/clipboard | tr -d '\r' > hosts-2.txt
> real    0m4.405s
> user    0m0.124s
> sys     0m3.577s
> $ time getclip -u > hosts.txt
> real    0m0.734s
> user    0m0.031s
> sys     0m0.031s

I'm not so worried about speed, except where that stops clipboard 
contents being updated quickly for consistency, but I ended up 
explicitly using /dev/clipboard under Cygwin for consistent 
interoperation with gvim and lxterminal under Linux VMs and gvim and 
mintty in Cygwin.

It would be good to test any changes across systems, or I could do so if 
the developer(s? - Mark?) don't run the environments to do so.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple