From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-05.nifty.com (conssluserg-05.nifty.com [210.131.2.90]) by sourceware.org (Postfix) with ESMTPS id 14887385842B for ; Mon, 22 Nov 2021 08:14:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14887385842B Received: from Express5800-S70 (z221123.dynamic.ppp.asahi-net.or.jp [110.4.221.123]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 1AM8E1W4027682 for ; Mon, 22 Nov 2021 17:14:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 1AM8E1W4027682 X-Nifty-SrcIP: [110.4.221.123] Date: Mon, 22 Nov 2021 17:14:01 +0900 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: [ANNOUNCEMENT] Updated: cygutils 1.4.16-8 (Test) Message-Id: <20211122171401.1f8dc11ef579106ad2e34cd6@nifty.ne.jp> In-Reply-To: References: <95DF7281-9391-4AEE-9427-7351DA47DBDE@Denis-Excoffier.org> <2f219874-accb-5c79-d513-ccc0902f88fe@maxrnd.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2021 08:14:37 -0000 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