X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=hh9u kR9vNLi3b4VMopXRM1Oj9twF+FisUS08sNV/x7sT/0pZ36fSkcKNeUo1QOgruZHa GIgIGLIVSUDDzrje1nWWkrplLfKB7Dr7IliEgj75eopRb35XWQHcR0Eq4ydXf9f+ sXyq+MLHTnrcd6ytd0OvCRA7eUiRuhoaKfySRP0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=qvNnCeV7Jq whFdK4Vu/Zbu8V3sY=; b=mzWMttUaKK8D7Gu9TuQoJsN7C9TxuJPZiwHLJNIERa VSbjhpaDjzNDTCNPOdp+0ntqXrWHPUf2sv27TNyJySygYVqgDLxJdyvPJAtkyYBf 9ZbniS8Sk347TdbaF8xlGJAiRfZtqR5lrzhakwXzZQKi+mRbKUd9BfUoBZLPVmHn 0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f44.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=IvP5cF8StNFY4r2rb8aNmTJWWMgg3XymwBs3d5Zdi7Q=; b=KbCQjhxymN2A4Vv3MfF0lPROiJVKeQ1pxvqipth2LKi/UBXXV8wJ3SE2uwYgSXP4Kt UJZmYy1MgB3C+LhHYoT/lTv7On4pK7v4H8lgCC3JBQ3TZSdry+sRV9OrXI1l9EjoHZsI f98EKMfNl7f6m6JEDbLTQjcKI6Sn6cMcngq1in7804ZkqwDxwXPlH8UoEL9dsggivGj9 y6QiCGPTvaYov6T2lymSfg3dycuZzwbjsUuvHwSVk4OkfiLj6htBftvbNfQupXSgIcBq oe/SG/x5FoO4FmJpLKDszleVoW5JXrtWhJfdeyohSQIkYDiM7oUTqzPbVgVG3/g0GArE pz9Q== X-Gm-Message-State: ALoCoQnH6DkSX7N6DNTkYDh1yvvqGkQrNgyBVX/h9JwKeGSTESRsJLKBJfCEbVMXEawZBuCpLZ/v X-Received: by 10.194.71.110 with SMTP id t14mr17472676wju.58.1423825159236; Fri, 13 Feb 2015 02:59:19 -0800 (PST) Date: Fri, 13 Feb 2015 10:59:17 +0000 From: Adam Dinwoodie To: cygwin AT cygwin DOT com Subject: Re: Writing to /dev/clipboard from multiple processes in Bash gives inconsistent behaviour Message-ID: <20150213105917.GE20741@dinwoodie.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1083078655.20150213130932@yandex.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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