From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test)
Date: Mon, 22 Nov 2021 17:14:01 +0900 [thread overview]
Message-ID: <20211122171401.1f8dc11ef579106ad2e34cd6@nifty.ne.jp> (raw)
In-Reply-To: <f8015fd7-adc2-88c3-7ccb-d52ecb5d0e4c@dronecode.org.uk>
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>
next prev parent reply other threads:[~2021-11-22 8:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 9:59 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 [this message]
2021-11-23 9:08 ` Mark Geisert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211122171401.1f8dc11ef579106ad2e34cd6@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).