This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Writing to /dev/clipboard from multiple processes in Bash gives inconsistent behaviour
- From: Adam Dinwoodie <adam at dinwoodie dot org>
- To: cygwin at cygwin dot com
- Date: Fri, 13 Feb 2015 10:59:17 +0000
- Subject: Re: Writing to /dev/clipboard from multiple processes in Bash gives inconsistent behaviour
- Authentication-results: sourceware.org; auth=none
- References: <20150212134550 dot GC20741 at dinwoodie dot org> <20150212170342 dot GB7818 at calimero dot vinschen dot de> <925263616 dot 20150213005102 at yandex dot ru> <20150213092339 dot GB17624 at calimero dot vinschen dot de> <1083078655 dot 20150213130932 at yandex dot ru>
On Fri, Feb 13, 2015 at 01:09:32PM +0300, Andrey Repin wrote:
> Greetings, Corinna Vinschen!
>
> >> And my mail client actively flashing "paste" buttons, when the script is
> >> working in background. May be that's it.
> >>
> >> This is more visible:
> >> $ while true; do { i=$(( $i+1 )); echo > /dev/clipboard; for n in {1..10}; do echo $n; done > /dev/clipboard; grep -q 10 /dev/clipboard || { grep 10 /dev/clipboard && echo $i;};}; done;
>
> > Nope, no way. I'm running this latter test for 45 minutes now, with
> > no output.
>
> Then I presume this is environmental issue.
> I can think of at least 3 programs that hook clipboard events on my side, and
> I can't easily get rid of any of them. Because of "resident" nature of each.
Yes. I suspect this may be somewhat of a smoking gun:
> >> And my mail client actively flashing "paste" buttons, when the script is
> >> working in background. May be that's it.
I'm running a bunch of Microsoft Office applications which I know do
"helpful" things to the Windows clipboard. It hadn't occured to me that
they may be causing BLODA-like problems in the way they interact with
it.
On that basis, my current hypothesis is that the problematic commands are
making multiple writes to /dev/clipboard very rapidly, which triggers a race
condition with the non-Cygwin clipboard-manipulating tools. Adding a cat into
the pipeline adds cat's buffering behaviour, meaning there's only a single
write and thus no race condition.
In which case, I wonder if it's worth adding something to the FAQ/BLODA
about this? I guess not, at least until someone independently encounters
this behaviour so it warrants the "F" as well as the "AQ".
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple