This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Writing to /dev/clipboard from multiple processes in Bash gives inconsistent behaviour


On Thu, Feb 12, 2015 at 06:03:42PM +0100, Corinna Vinschen wrote:
> On Feb 12 13:45, Adam Dinwoodie wrote:
> > I've spotted some slightly odd behaviour when writing things from
> > multiple processes to /dev/clipboard.
> > 
> > Easiest to show this with an example:
> > 
> >     for n in {1..10}; do echo $n; done >/dev/clipboard; cat /dev/clipboard
> > 
> > I expect this to print out the numbers 1â10 to the terminal.  Sometimes
> > it does, but sometimes it misses out some of the numbers at the end;
> > printing the digits 1â8, say, but no more.  Generally it gets to around
> > 7â9, but I've seen it managing to only get up to 3 on one occasion.
> 
> I can't reproduce this.  First I tried this manually a couple of times,
> but then I created a loop:
> 
>   for i in {1..1000}
>   do
>     echo > /dev/clipboard
>     for n in {1..10}; do echo $n; done > /dev/clipboard
>     grep -q 10 /dev/clipboard || cat /dev/clipboard
>   done
> 
> and it didn't fail once.  I'm not sure what to do if I don't have a
> reproducible testcase...

Huh, I had expected this to be trivially reproducible.  I just ran a
slight variation of your loop with a counter, and didn't get the full
list in 668 of the 1000 iterations, so it's definitely reproducible
here.

I'll do a little more digging locally and see if I can't isolate the
problem further.

--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]