On Mon, 23 Feb 2026 23:04:31 -0700 Brian Inglis wrote: > On 2026-02-23 18:36, Takashi Yano via Cygwin wrote: > > I encountered a clipboard issue common to cygwin. > > > > Affected components: > > /dev/clipboard, putclip/getclip, mintty > > > > The issue: > > If the clipbard is opened by `OpenClipboard(NULL)`, occasionally > > SetClipboardData() and GetClipboardData() fails with > > ERROR_CLIPBOARD_NOT_OPEN. > > > > When UltraVNC Viewer (https://uvnc.com/) is opened, this issue > > happens with a very high probability (> ~90%). > > > > $ echo AAAA > /dev/clipboard > > echo: write error: Permission denied > > > > On mintty, text selection by mouse and clicking center button > > fails at the first attempt. > > > > For putlclip/getclip, the following command outputs nothing > > in a few attempts. ("ABCD" is lost.) > > $ echo ABCD |putclip; for a in `seq 100`; do getclip |putclip; done; getclip > > Hi, > > Your patch attachment is typed as: > > Content-Type: plain/text; > > rather than the standard mime type text/plain; > please check your /etc/mime.types, ~/.sylpheed/mime.types, ~/.*/mime.types, > or > other alternatives for that incorrect mime type mapping, replace with the > standard, and resend with the attachment, so we can read it inline, without > saving or other operations to decode it.
Thanks! Actually, my MUA (sylpheed) uses "application/octet-stream" for .patch file, so I manually changed it to "text/plain". But accsidendly, it was "plain/text" by my mistake. I resend it on this mail. -- Takashi Yano <[email protected]>
From 1e1f3aca99a9309c7521980d364c32cba02f038e Mon Sep 17 00:00:00 2001 From: Takashi Yano <[email protected]> Date: Thu, 19 Feb 2026 16:04:15 +0900 Subject: [PATCH] Cygwin: clipboard: Add workaround for ERROR_CLIPBOARD_NOT_OPEN --- winsup/cygwin/fhandler/clipboard.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler/clipboard.cc b/winsup/cygwin/fhandler/clipboard.cc index 12691c7c1..221aaac62 100644 --- a/winsup/cygwin/fhandler/clipboard.cc +++ b/winsup/cygwin/fhandler/clipboard.cc @@ -26,10 +26,16 @@ static inline bool open_clipboard () { const int max_retry = 10; +retry: for (int i = 0; i < max_retry; i++) { if (OpenClipboard (NULL)) - return true; + { + if (!GetClipboardData (CF_UNICODETEXT) + && GetLastError () == ERROR_CLIPBOARD_NOT_OPEN) + goto retry; + return true; + } Sleep (1); } return false; -- 2.51.0
-- 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

