public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
@ 2021-11-03  9:59 Mark Geisert
  2021-11-03 13:04 ` Takashi Yano
  2021-11-14 17:23 ` Denis Excoffier
  0 siblings, 2 replies; 18+ messages in thread
From: Mark Geisert @ 2021-11-03  9:59 UTC (permalink / raw)
  To: cygwin; +Cc: Mark Geisert

The following packages have been uploaded to the Cygwin distribution:

* cygutils-1.4.16-8
* cygutils-extra-1.4.16-8
* cygutils-x11-1.4.16-8

This update fixes a couple issues with getclip and putclip, namely:
1) Mistakenly assuming charset is always UTF-8,
2) Opening and closing the clipboard multiple times (putclip only),
   sometimes causing ERROR_ACCESS_DENIED.
Thanks to Takashi Yano for bug reports with testcases, and especially
the patches!

This update also provides a new feature: robust copy/paste between
32-bit and 64-bit Cygwin environments, provided both are running
3.3.0 (Test) or higher.

NB. Since this is a Test release, you'll have to specifically select
this version from the setup*.exe Version dropdown to install it.  If
there are no issues reported, in a couple weeks this version will be
promoted for automatic updating on your system.
Cheers,

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-03  9:59 [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test) Mark Geisert
@ 2021-11-03 13:04 ` Takashi Yano
  2021-11-04  4:31   ` Mark Geisert
  2021-11-05  3:20   ` Takashi Yano
  2021-11-14 17:23 ` Denis Excoffier
  1 sibling, 2 replies; 18+ messages in thread
From: Takashi Yano @ 2021-11-03 13:04 UTC (permalink / raw)
  To: cygwin

On Wed,  3 Nov 2021 02:59:38 -0700
Mark Geisert wrote:
> The following packages have been uploaded to the Cygwin distribution:
> 
> * cygutils-1.4.16-8
> * cygutils-extra-1.4.16-8
> * cygutils-x11-1.4.16-8
> 
> This update fixes a couple issues with getclip and putclip, namely:
> 1) Mistakenly assuming charset is always UTF-8,
> 2) Opening and closing the clipboard multiple times (putclip only),
>    sometimes causing ERROR_ACCESS_DENIED.
> Thanks to Takashi Yano for bug reports with testcases, and especially
> the patches!
> 
> This update also provides a new feature: robust copy/paste between
> 32-bit and 64-bit Cygwin environments, provided both are running
> 3.3.0 (Test) or higher.

I have tested the 1.4.16-8 (Test) and confirmed the following cases
work as expected.

1) Charset conversion under locale other than UTF-8.
2) putclip error.
3) 32-bit and 64-bit inter-operability.

Thanks much.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-03 13:04 ` Takashi Yano
@ 2021-11-04  4:31   ` Mark Geisert
  2021-11-04  4:58     ` Thomas Wolff
  2021-11-05  3:20   ` Takashi Yano
  1 sibling, 1 reply; 18+ messages in thread
From: Mark Geisert @ 2021-11-04  4:31 UTC (permalink / raw)
  To: cygwin

Takashi Yano via Cygwin wrote:
> On Wed,  3 Nov 2021 02:59:38 -0700
> Mark Geisert wrote:
>> The following packages have been uploaded to the Cygwin distribution:
>>
>> * cygutils-1.4.16-8
>> * cygutils-extra-1.4.16-8
>> * cygutils-x11-1.4.16-8
[...]
> 
> I have tested the 1.4.16-8 (Test) and confirmed the following cases
> work as expected.
> 
> 1) Charset conversion under locale other than UTF-8.
> 2) putclip error.
> 3) 32-bit and 64-bit inter-operability.
> 
> Thanks much.

Thank you for testing!

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-04  4:31   ` Mark Geisert
@ 2021-11-04  4:58     ` Thomas Wolff
  2021-11-04  8:47       ` Mark Geisert
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Wolff @ 2021-11-04  4:58 UTC (permalink / raw)
  To: cygwin



Am 04.11.2021 um 05:31 schrieb Mark Geisert:
> Takashi Yano via Cygwin wrote:
>> On Wed,  3 Nov 2021 02:59:38 -0700
>> Mark Geisert wrote:
>>> The following packages have been uploaded to the Cygwin distribution:
>>>
>>> * cygutils-1.4.16-8
>>> * cygutils-extra-1.4.16-8
>>> * cygutils-x11-1.4.16-8
> [...]
>>
>> I have tested the 1.4.16-8 (Test) and confirmed the following cases
>> work as expected.
>>
>> 1) Charset conversion under locale other than UTF-8.
>> 2) putclip error.
>> 3) 32-bit and 64-bit inter-operability.
I was trying to check changes, and clipboard handling, but the contents 
of the source packages is identical; files are from 2017‽

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-04  4:58     ` Thomas Wolff
@ 2021-11-04  8:47       ` Mark Geisert
  2021-11-04 20:08         ` Brian Inglis
  0 siblings, 1 reply; 18+ messages in thread
From: Mark Geisert @ 2021-11-04  8:47 UTC (permalink / raw)
  To: cygwin

Hi Thomas,

Thomas Wolff wrote:
> 
> 
> Am 04.11.2021 um 05:31 schrieb Mark Geisert:
>> Takashi Yano via Cygwin wrote:
>>> On Wed,  3 Nov 2021 02:59:38 -0700
>>> Mark Geisert wrote:
>>>> The following packages have been uploaded to the Cygwin distribution:
>>>>
>>>> * cygutils-1.4.16-8
>>>> * cygutils-extra-1.4.16-8
>>>> * cygutils-x11-1.4.16-8
>> [...]
>>>
>>> I have tested the 1.4.16-8 (Test) and confirmed the following cases
>>> work as expected.
>>>
>>> 1) Charset conversion under locale other than UTF-8.
>>> 2) putclip error.
>>> 3) 32-bit and 64-bit inter-operability.
> I was trying to check changes, and clipboard handling, but the contents of the 
> source packages is identical; files are from 2017‽

Yes, an artifact of how Charles (original author) set up package builds.  One has 
to do a 'cygport cygutils.cygport prep' step to apply patches to get the most 
up-to-date source.

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-04  8:47       ` Mark Geisert
@ 2021-11-04 20:08         ` Brian Inglis
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Inglis @ 2021-11-04 20:08 UTC (permalink / raw)
  To: cygwin

On 2021-11-04 02:47, Mark Geisert wrote:
> Hi Thomas,
> Thomas Wolff wrote:
>> Am 04.11.2021 um 05:31 schrieb Mark Geisert:
>>> Takashi Yano via Cygwin wrote:
>>>> On Wed,  3 Nov 2021 02:59:38 -0700 Mark Geisert wrote:
>>>>> The following packages have been uploaded to the Cygwin distribution:
>>>>> * cygutils-1.4.16-8
>>>>> * cygutils-extra-1.4.16-8
>>>>> * cygutils-x11-1.4.16-8

>>>> I have tested the 1.4.16-8 (Test) and confirmed the following cases
>>>> work as expected.
>>>>
>>>> 1) Charset conversion under locale other than UTF-8.
>>>> 2) putclip error.
>>>> 3) 32-bit and 64-bit inter-operability.

>> I was trying to check changes, and clipboard handling, but the 
>> contents of the source packages is identical; files are from 2017‽

> Yes, an artifact of how Charles (original author) set up package 
> builds. One has to do a 'cygport cygutils.cygport prep' step to apply 
> patches to get the most up-to-date source.

	$ cygport cygutils.cygport get prep	#	[nit]

it's also checked in to cygwin-apps:

	https://cygwin.com/git/?p=cygwin-apps/cygutils.git;a=commitdiff

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-03 13:04 ` Takashi Yano
  2021-11-04  4:31   ` Mark Geisert
@ 2021-11-05  3:20   ` Takashi Yano
  2021-11-05  5:40     ` Mark Geisert
  1 sibling, 1 reply; 18+ messages in thread
From: Takashi Yano @ 2021-11-05  3:20 UTC (permalink / raw)
  To: cygwin

On Wed, 3 Nov 2021 22:04:05 +0900
Takashi Yano wrote:
> On Wed,  3 Nov 2021 02:59:38 -0700
> Mark Geisert wrote:
> > The following packages have been uploaded to the Cygwin distribution:
> > 
> > * cygutils-1.4.16-8
> > * cygutils-extra-1.4.16-8
> > * cygutils-x11-1.4.16-8
> > 
> > This update fixes a couple issues with getclip and putclip, namely:
> > 1) Mistakenly assuming charset is always UTF-8,
> > 2) Opening and closing the clipboard multiple times (putclip only),
> >    sometimes causing ERROR_ACCESS_DENIED.
> > Thanks to Takashi Yano for bug reports with testcases, and especially
> > the patches!
> > 
> > This update also provides a new feature: robust copy/paste between
> > 32-bit and 64-bit Cygwin environments, provided both are running
> > 3.3.0 (Test) or higher.
> 
> I have tested the 1.4.16-8 (Test) and confirmed the following cases
> work as expected.
> 
> 1) Charset conversion under locale other than UTF-8.
> 2) putclip error.
> 3) 32-bit and 64-bit inter-operability.

One small thing I noticed is that time stamp of /dev/clipboard
is broken with the following scenario.
1) Run 'echo A | putclip' in 32bit cygwin
2) Run 'ls -l /dev/clipboard' in 64bit cygwin

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-05  3:20   ` Takashi Yano
@ 2021-11-05  5:40     ` Mark Geisert
  2021-11-05  8:06       ` Takashi Yano
  0 siblings, 1 reply; 18+ messages in thread
From: Mark Geisert @ 2021-11-05  5:40 UTC (permalink / raw)
  To: cygwin

Hi Takashi,

Takashi Yano via Cygwin wrote:
> On Wed, 3 Nov 2021 22:04:05 +0900
> Takashi Yano wrote:
>> On Wed,  3 Nov 2021 02:59:38 -0700
>> Mark Geisert wrote:
>>> The following packages have been uploaded to the Cygwin distribution:
>>>
>>> * cygutils-1.4.16-8
>>> * cygutils-extra-1.4.16-8
>>> * cygutils-x11-1.4.16-8
[...]
>>> This update also provides a new feature: robust copy/paste between
>>> 32-bit and 64-bit Cygwin environments, provided both are running
>>> 3.3.0 (Test) or higher.
>>
>> I have tested the 1.4.16-8 (Test) and confirmed the following cases
>> work as expected.
>>
>> 1) Charset conversion under locale other than UTF-8.
>> 2) putclip error.
>> 3) 32-bit and 64-bit inter-operability.
> 
> One small thing I noticed is that time stamp of /dev/clipboard
> is broken with the following scenario.
> 1) Run 'echo A | putclip' in 32bit cygwin
> 2) Run 'ls -l /dev/clipboard' in 64bit cygwin

Yes indeed :-()
I'll debug this.  Thanks for the report.

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-05  5:40     ` Mark Geisert
@ 2021-11-05  8:06       ` Takashi Yano
  2021-11-05  8:53         ` Mark Geisert
  0 siblings, 1 reply; 18+ messages in thread
From: Takashi Yano @ 2021-11-05  8:06 UTC (permalink / raw)
  To: cygwin

On Thu, 4 Nov 2021 22:40:40 -0700
Mark Geisert wrote:
> Takashi Yano via Cygwin wrote:
> > On Wed, 3 Nov 2021 22:04:05 +0900
> > Takashi Yano wrote:
> >> On Wed,  3 Nov 2021 02:59:38 -0700
> >> Mark Geisert wrote:
> >>> The following packages have been uploaded to the Cygwin distribution:
> >>>
> >>> * cygutils-1.4.16-8
> >>> * cygutils-extra-1.4.16-8
> >>> * cygutils-x11-1.4.16-8
> [...]
> >>> This update also provides a new feature: robust copy/paste between
> >>> 32-bit and 64-bit Cygwin environments, provided both are running
> >>> 3.3.0 (Test) or higher.
> >>
> >> I have tested the 1.4.16-8 (Test) and confirmed the following cases
> >> work as expected.
> >>
> >> 1) Charset conversion under locale other than UTF-8.
> >> 2) putclip error.
> >> 3) 32-bit and 64-bit inter-operability.
> > 
> > One small thing I noticed is that time stamp of /dev/clipboard
> > is broken with the following scenario.
> > 1) Run 'echo A | putclip' in 32bit cygwin
> > 2) Run 'ls -l /dev/clipboard' in 64bit cygwin
> 
> Yes indeed :-()
> I'll debug this.  Thanks for the report.

I guess you just forgot to expand struct timespec in 32bit to
64bit layout in the following code.

-      if (cygNewFormat)
+      if (cygNewFormat == 2)
         {
           cygcb_t *clipbufX = (cygcb_t *) clipbuf;
+          clipbufX->cb_size = convlen;
+          clock_gettime (CLOCK_REALTIME, &clipbufX->ts);
+          memcpy (&clipbufX[1], convbuf, convlen);
+        }
+      else if (cygNewFormat == 1)
+        {
+          cygcb_old_t *clipbufX = (cygcb_old_t *) clipbuf;

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-05  8:06       ` Takashi Yano
@ 2021-11-05  8:53         ` Mark Geisert
  0 siblings, 0 replies; 18+ messages in thread
From: Mark Geisert @ 2021-11-05  8:53 UTC (permalink / raw)
  To: cygwin

Hi Takashi,

Takashi Yano via Cygwin wrote:
[...]
> I guess you just forgot to expand struct timespec in 32bit to
> 64bit layout in the following code.
> 
> -      if (cygNewFormat)
> +      if (cygNewFormat == 2)
>           {
>             cygcb_t *clipbufX = (cygcb_t *) clipbuf;
> +          clipbufX->cb_size = convlen;
> +          clock_gettime (CLOCK_REALTIME, &clipbufX->ts);
> +          memcpy (&clipbufX[1], convbuf, convlen);
> +        }
> +      else if (cygNewFormat == 1)
> +        {
> +          cygcb_old_t *clipbufX = (cygcb_old_t *) clipbuf;

I appreciate the assist.  I had just completed the needed builds when your message 
came in :-).  You are correct on the root cause.

I have tested and committed a fix to the cygutils git repository if you or anybody 
else needs the fix before -9 is released in a couple weeks:
https://cygwin.com/git?p=cygwin-apps/cygutils.git;a=commitdiff;h=ecb76449ca233873d01feacd3dfd22cbf7e95e34

Thanks & Regards,

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-03  9:59 [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test) Mark Geisert
  2021-11-03 13:04 ` Takashi Yano
@ 2021-11-14 17:23 ` Denis Excoffier
  2021-11-14 17:55   ` Mark Geisert
                     ` (2 more replies)
  1 sibling, 3 replies; 18+ messages in thread
From: Denis Excoffier @ 2021-11-14 17:23 UTC (permalink / raw)
  To: cygwin; +Cc: Denis Excoffier, Mark Geisert

Hello,

> On 2021-11-03 10:59, Mark Geisert wrote:
> 
> The following packages have been uploaded to the Cygwin distribution:
> 
> * cygutils-1.4.16-8
> * cygutils-extra-1.4.16-8
> * cygutils-x11-1.4.16-8


The '-u' or '-d' option of getclip does not seem to work properly under xterm.
How to reproduce:
1) Open an xterm
2) Select a simple piece of text (with no line ending)
3) getclip -u
4) Observe 'Segmentation fault(core dumped)'

If step 2 is replaced by ‘printf AAAA | putclip', no error.
If step 3 is replaced by ‘getclip’, no error.

I can’t tell whether this is new or not.

Remarks:
1) If (under xterm) i select a piece of text with a line end, then i can observe ‘\r\n’ at the end (using getclip | od -c)
2) If i select a piece of text with a line end with putclip, i can only observe ‘\n’ at the end (echo "AAAA" | putclip | getclip | od -c)
3) I launch ‘xwin’ with ‘option -clipboard’ (the default), i suppose this does not matter
4) It might be related to xorg-server-21.1.0-1 (TEST) that i installed recently (2021-11-04), however xwinclip-21-1.0-1 didn’t come with the rest

Regards,

Denis Excoffier.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-14 17:23 ` Denis Excoffier
@ 2021-11-14 17:55   ` Mark Geisert
  2021-11-14 17:55   ` Brian Inglis
  2021-11-21 10:36   ` Mark Geisert
  2 siblings, 0 replies; 18+ messages in thread
From: Mark Geisert @ 2021-11-14 17:55 UTC (permalink / raw)
  Cc: cygwin


Nov 14, 2021 7:24:43 PM Denis Excoffier <cygwin@Denis-Excoffier.org>:

> Hello,
> 
>> On 2021-11-03 10:59, Mark Geisert wrote:
>> 
>> The following packages have been uploaded to the Cygwin distribution:
>> 
>> * cygutils-1.4.16-8
>> * cygutils-extra-1.4.16-8
>> * cygutils-x11-1.4.16-8
> 
> 
> The '-u' or '-d' option of getclip does not seem to work properly under xterm.
> How to reproduce:
> 1) Open an xterm
> 2) Select a simple piece of text (with no line ending)
> 3) getclip -u
> 4) Observe 'Segmentation fault(core dumped)'
> 
> If step 2 is replaced by ‘printf AAAA | putclip', no error.
> If step 3 is replaced by ‘getclip’, no error.
> 
> I can’t tell whether this is new or not.
> 
> Remarks:
> 1) If (under xterm) i select a piece of text with a line end, then i can observe ‘\r\n’ at the end (using getclip | od -c)
> 2) If i select a piece of text with a line end with putclip, i can only observe ‘\n’ at the end (echo "AAAA" | putclip | getclip | od -c)
> 3) I launch ‘xwin’ with ‘option -clipboard’ (the default), i suppose this does not matter
> 4) It might be related to xorg-server-21.1.0-1 (TEST) that i installed recently (2021-11-04), however xwinclip-21-1.0-1 didn’t come with the rest
> 
> Regards,
> 
> Denis Excoffier.
Hi Denis,
Thank you for the report. I am out of town for another week. I will investigate upon my return.

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-14 17:23 ` Denis Excoffier
  2021-11-14 17:55   ` Mark Geisert
@ 2021-11-14 17:55   ` Brian Inglis
  2021-11-21 10:36   ` Mark Geisert
  2 siblings, 0 replies; 18+ messages in thread
From: Brian Inglis @ 2021-11-14 17:55 UTC (permalink / raw)
  To: cygwin

On 2021-11-14 10:23, Denis Excoffier wrote:
>> On 2021-11-03 10:59, Mark Geisert wrote:
>> The following packages have been uploaded to the Cygwin distribution:
>> * cygutils-1.4.16-8
>> * cygutils-extra-1.4.16-8
>> * cygutils-x11-1.4.16-8

> The '-u' or '-d' option of getclip does not seem to work properly under xterm.
> How to reproduce:
> 1) Open an xterm
> 2) Select a simple piece of text (with no line ending)
> 3) getclip -u
> 4) Observe 'Segmentation fault(core dumped)'

Should not SEGV even if there is nothing to paste!

Those utilities do not have access to the X Window select buffer, only 
the X window copy buffer is copied to the Windows clipboard 
/dev/clipboard, so you may have to *COPY* the selected text to the 
clipboard, however that is done from xterm, perhaps C-S-v or using 
command xclip -sel c, before you can paste it.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-14 17:23 ` Denis Excoffier
  2021-11-14 17:55   ` Mark Geisert
  2021-11-14 17:55   ` Brian Inglis
@ 2021-11-21 10:36   ` Mark Geisert
  2021-11-21 14:51     ` Jon Turney
  2 siblings, 1 reply; 18+ messages in thread
From: Mark Geisert @ 2021-11-21 10:36 UTC (permalink / raw)
  To: cygwin

Hi Denis,

Denis Excoffier wrote:
> Hello,
> 
>> On 2021-11-03 10:59, Mark Geisert wrote:
>>
>> The following packages have been uploaded to the Cygwin distribution:
>>
>> * cygutils-1.4.16-8
>> * cygutils-extra-1.4.16-8
>> * cygutils-x11-1.4.16-8
> 
> 
> The '-u' or '-d' option of getclip does not seem to work properly under xterm.
> How to reproduce:
> 1) Open an xterm
> 2) Select a simple piece of text (with no line ending)
> 3) getclip -u
> 4) Observe 'Segmentation fault(core dumped)'
> 
> If step 2 is replaced by ‘printf AAAA | putclip', no error.
> If step 3 is replaced by ‘getclip’, no error.
> 
> I can’t tell whether this is new or not.

It appears to be old.  An xterm selection is placed on the Windows clipboard in 
CF_UNICODETEXT format.  'getclip' can deal with this, 'getclip -u' and 'getclip 
-d' cannot; they always request CF_TEXT (i.e., ANSI) format and assume they get a 
buffer of data.  But the formats don't match and there's no data supplied.  That's 
why the segfault occurs.

I've committed a patch to the cygutils git repository that fixes the segfault:
https://cygwin.com/git/?p=cygwin-apps/cygutils.git;a=commit;h=3e94e050af7ad4ac84d12c18e9408e4c4f34cb56

The fix will be part of an upcoming build of cygutils, 1.4.16-9, hopefully in the 
next few days.  Beyond that, the limitation in formats with "-u" and "-d" will be 
relaxed later on.
Regards,

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-21 10:36   ` Mark Geisert
@ 2021-11-21 14:51     ` Jon Turney
  2021-11-22  7:08       ` Andrey Repin
                         ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Jon Turney @ 2021-11-21 14:51 UTC (permalink / raw)
  To: Mark Geisert, The Cygwin Mailing List

On 21/11/2021 10:36, Mark Geisert wrote:
> Hi Denis,
> 
> Denis Excoffier wrote:
>> Hello,
>>
>>> On 2021-11-03 10:59, Mark Geisert wrote:
>>>
>>> The following packages have been uploaded to the Cygwin distribution:
>>>
>>> * cygutils-1.4.16-8
>>> * cygutils-extra-1.4.16-8
>>> * cygutils-x11-1.4.16-8
>>
>>
>> The '-u' or '-d' option of getclip does not seem to work properly 
>> under xterm.
>> How to reproduce:
>> 1) Open an xterm
>> 2) Select a simple piece of text (with no line ending)
>> 3) getclip -u
>> 4) Observe 'Segmentation fault(core dumped)'
>>
>> If step 2 is replaced by ‘printf AAAA | putclip', no error.
>> If step 3 is replaced by ‘getclip’, no error.
>>
>> I can’t tell whether this is new or not.
> 
> It appears to be old.  An xterm selection is placed on the Windows 
> clipboard in CF_UNICODETEXT format.  'getclip' can deal with this, 
> 'getclip -u' and 'getclip -d' cannot; they always request CF_TEXT (i.e., 
> ANSI) format and assume they get a buffer of data.  But the formats 
> don't match and there's no data supplied.  That's why the segfault occurs.

Odd... I think that Windows should convert CF_UNICODETEXT to CF_TEXT if 
needed

See 
https://docs.microsoft.com/en-gb/windows/win32/dataxchg/clipboard-formats#synthesized-clipboard-formats

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-21 14:51     ` Jon Turney
@ 2021-11-22  7:08       ` Andrey Repin
  2021-11-22  8:14       ` Takashi Yano
  2021-11-23  9:08       ` Mark Geisert
  2 siblings, 0 replies; 18+ messages in thread
From: Andrey Repin @ 2021-11-22  7:08 UTC (permalink / raw)
  To: Jon Turney, cygwin

Greetings, Jon Turney!

> On 21/11/2021 10:36, Mark Geisert wrote:
>> Hi Denis,
>> 
>> Denis Excoffier wrote:
>>> Hello,
>>>
>>>> On 2021-11-03 10:59, Mark Geisert wrote:
>>>>
>>>> The following packages have been uploaded to the Cygwin distribution:
>>>>
>>>> * cygutils-1.4.16-8
>>>> * cygutils-extra-1.4.16-8
>>>> * cygutils-x11-1.4.16-8
>>>
>>>
>>> The '-u' or '-d' option of getclip does not seem to work properly 
>>> under xterm.
>>> How to reproduce:
>>> 1) Open an xterm
>>> 2) Select a simple piece of text (with no line ending)
>>> 3) getclip -u
>>> 4) Observe 'Segmentation fault(core dumped)'
>>>
>>> If step 2 is replaced by ‘printf AAAA | putclip', no error.
>>> If step 3 is replaced by ‘getclip’, no error.
>>>
>>> I can’t tell whether this is new or not.
>> 
>> It appears to be old.  An xterm selection is placed on the Windows 
>> clipboard in CF_UNICODETEXT format.  'getclip' can deal with this, 
>> 'getclip -u' and 'getclip -d' cannot; they always request CF_TEXT (i.e., 
>> ANSI) format and assume they get a buffer of data.  But the formats 
>> don't match and there's no data supplied.  That's why the segfault occurs.

> Odd... I think that Windows should convert CF_UNICODETEXT to CF_TEXT if 
> needed

> See 
> https://docs.microsoft.com/en-gb/windows/win32/dataxchg/clipboard-formats#synthesized-clipboard-formats

It could convert to UNICODE, but the reverse would be lossy.


-- 
With best regards,
Andrey Repin
Monday, November 22, 2021 10:07:50

Sorry for my terrible english...

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-21 14:51     ` Jon Turney
  2021-11-22  7:08       ` Andrey Repin
@ 2021-11-22  8:14       ` Takashi Yano
  2021-11-23  9:08       ` Mark Geisert
  2 siblings, 0 replies; 18+ messages in thread
From: Takashi Yano @ 2021-11-22  8:14 UTC (permalink / raw)
  To: cygwin

On Sun, 21 Nov 2021 14:51:08 +0000
Jon Turney wrote:
> On 21/11/2021 10:36, Mark Geisert wrote:
> > Hi Denis,
> > 
> > Denis Excoffier wrote:
> >> Hello,
> >>
> >>> On 2021-11-03 10:59, Mark Geisert wrote:
> >>>
> >>> The following packages have been uploaded to the Cygwin distribution:
> >>>
> >>> * cygutils-1.4.16-8
> >>> * cygutils-extra-1.4.16-8
> >>> * cygutils-x11-1.4.16-8
> >>
> >>
> >> The '-u' or '-d' option of getclip does not seem to work properly 
> >> under xterm.
> >> How to reproduce:
> >> 1) Open an xterm
> >> 2) Select a simple piece of text (with no line ending)
> >> 3) getclip -u
> >> 4) Observe 'Segmentation fault(core dumped)'
> >>
> >> If step 2 is replaced by ‘printf AAAA | putclip', no error.
> >> If step 3 is replaced by ‘getclip’, no error.
> >>
> >> I can’t tell whether this is new or not.
> > 
> > It appears to be old.  An xterm selection is placed on the Windows 
> > clipboard in CF_UNICODETEXT format.  'getclip' can deal with this, 
> > 'getclip -u' and 'getclip -d' cannot; they always request CF_TEXT (i.e., 
> > ANSI) format and assume they get a buffer of data.  But the formats 
> > don't match and there's no data supplied.  That's why the segfault occurs.
> 
> Odd... I think that Windows should convert CF_UNICODETEXT to CF_TEXT if 
> needed

This seems to be a problem of xorg-server.

SetClipboardData(CF_TEXT, NULL) calls in xorg-server disturb the
conversion from CF_UNICODETEXT to CF_TEXT.  I confirmed that the
default conversion gets working if the following patch is applied
to xorg-server.

diff --git a/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/wndproc.c b/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/wndproc.c
index 63de4b9..8db89e5 100644
--- a/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/wndproc.c
+++ b/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/wndproc.c
@@ -424,7 +424,9 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
           {
             /* Paste no data, to satisfy required call to SetClipboardData */
             SetClipboardData(CF_UNICODETEXT, NULL);
+#if 0 /* Do not set CF_TEXT to NULL to allow default conversion. */
             SetClipboardData(CF_TEXT, NULL);
+#endif
           }
 
         winDebug("winClipboardWindowProc - WM_RENDERFORMAT - Returning.\n");
diff --git a/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/xevents.c b/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/xevents.c
index 1fae558..6c8d481 100644
--- a/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/xevents.c
+++ b/src/xserver-xserver-cygwin-21.1.0-1/hw/xwin/winclipboard/xevents.c
@@ -380,7 +380,9 @@ winClipboardSelectionNotifyData(HWND hwnd, xcb_window_t iWindow, xcb_connection_
         GlobalUnlock(hGlobal);
     if (fSetClipboardData) {
         SetClipboardData(CF_UNICODETEXT, NULL);
+#if 0 /* Do not set CF_TEXT to NULL to allow default conversion. */
         SetClipboardData(CF_TEXT, NULL);
+#endif
     }
     return WIN_XEVENTS_NOTIFY_DATA;
 }
@@ -798,7 +800,9 @@ winClipboardFlushXEvents(HWND hwnd,
 
                 /* Advertise regular text and unicode */
                 SetClipboardData(CF_UNICODETEXT, NULL);
+#if 0 /* Do not set CF_TEXT to NULL to allow default conversion. */
                 SetClipboardData(CF_TEXT, NULL);
+#endif
 
                 /* Release the clipboard */
                 if (!CloseClipboard()) {


However, since getclip does not support charset conversion for
CF_TEXT, non-ascii string will be garbled if getclip -u/-d is
used. This is the problem of cygutils side and also occurs
when copying from mintty or Windows apps.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
  2021-11-21 14:51     ` Jon Turney
  2021-11-22  7:08       ` Andrey Repin
  2021-11-22  8:14       ` Takashi Yano
@ 2021-11-23  9:08       ` Mark Geisert
  2 siblings, 0 replies; 18+ messages in thread
From: Mark Geisert @ 2021-11-23  9:08 UTC (permalink / raw)
  To: The Cygwin Mailing List

Jon Turney wrote:
> On 21/11/2021 10:36, Mark Geisert wrote:
>> Hi Denis,
>>
>> Denis Excoffier wrote:
>>> Hello,
>>>
>>>> On 2021-11-03 10:59, Mark Geisert wrote:
>>>>
>>>> The following packages have been uploaded to the Cygwin distribution:
>>>>
>>>> * cygutils-1.4.16-8
>>>> * cygutils-extra-1.4.16-8
>>>> * cygutils-x11-1.4.16-8
>>>
>>>
>>> The '-u' or '-d' option of getclip does not seem to work properly under xterm.
>>> How to reproduce:
>>> 1) Open an xterm
>>> 2) Select a simple piece of text (with no line ending)
>>> 3) getclip -u
>>> 4) Observe 'Segmentation fault(core dumped)'
>>>
>>> If step 2 is replaced by ‘printf AAAA | putclip', no error.
>>> If step 3 is replaced by ‘getclip’, no error.
>>>
>>> I can’t tell whether this is new or not.
>>
>> It appears to be old.  An xterm selection is placed on the Windows clipboard in 
>> CF_UNICODETEXT format.  'getclip' can deal with this, 'getclip -u' and 'getclip 
>> -d' cannot; they always request CF_TEXT (i.e., ANSI) format and assume they get 
>> a buffer of data.  But the formats don't match and there's no data supplied.  
>> That's why the segfault occurs.
> 
> Odd... I think that Windows should convert CF_UNICODETEXT to CF_TEXT if needed
> 
> See 
> https://docs.microsoft.com/en-gb/windows/win32/dataxchg/clipboard-formats#synthesized-clipboard-formats 

I did notice that doc when I was updating getclip and putclip.  I wondered why 
that conversion didn't seem to be happening in the testcases and whether that was 
a Windows change over time.  I had no answer.

What surprised me about the segfault was that GetClipboardData(CF_TEXT) was 
returning zero, the error indication, but a subsequent GetLastError() returned 
zero as well, so no specific error.

..mark

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-11-23  9:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  9:59 [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test) Mark Geisert
2021-11-03 13:04 ` Takashi Yano
2021-11-04  4:31   ` Mark Geisert
2021-11-04  4:58     ` Thomas Wolff
2021-11-04  8:47       ` Mark Geisert
2021-11-04 20:08         ` Brian Inglis
2021-11-05  3:20   ` Takashi Yano
2021-11-05  5:40     ` Mark Geisert
2021-11-05  8:06       ` Takashi Yano
2021-11-05  8:53         ` Mark Geisert
2021-11-14 17:23 ` Denis Excoffier
2021-11-14 17:55   ` Mark Geisert
2021-11-14 17:55   ` Brian Inglis
2021-11-21 10:36   ` Mark Geisert
2021-11-21 14:51     ` Jon Turney
2021-11-22  7:08       ` Andrey Repin
2021-11-22  8:14       ` Takashi Yano
2021-11-23  9:08       ` Mark Geisert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).