X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48FE33858015 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1637568909; bh=edPwhFydyyp1pNewywPGS98HnrAgsNbwWIrT1RcsW+k=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=S6dgn4P5KceG6+ev9ok6HTB+ngDXjE6B8YEMn21UnYY/2NlaeXJV7U3U/g/zayYnS aNIRDp6HLCes9tnh2288/sOAlvBW8tuWpysiAv2kv3JEoYTQnps7jHT4MfWWrySdvm SJqp06Xgs6Qgrl1jN0Nzbx++GzjkFJqU6h9doKl8= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14887385842B 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 To: cygwin AT cygwin DOT 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 AT Denis-Excoffier DOT org> <2f219874-accb-5c79-d513-ccc0902f88fe AT maxrnd DOT com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 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 AT cygwin DOT 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: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 1AM8FAYH016270 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 -- 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