From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19920 invoked by alias); 4 Apr 2016 15:16:57 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 19886 invoked by uid 89); 4 Apr 2016 15:16:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-93.9 required=5.0 tests=BAYES_50,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=All, All!, INT, terminals X-HELO: calimero.vinschen.de Received: from ipbcc0d020.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Apr 2016 15:16:46 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id BFB4AA80604; Mon, 4 Apr 2016 17:16:44 +0200 (CEST) Date: Mon, 04 Apr 2016 15:16:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Unreliable flock Message-ID: <20160404151644.GB29337@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <175808986.20160403002257@yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: <175808986.20160403002257@yandex.ru> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-04/txt/msg00063.txt.bz2 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1196 On Apr 3 00:22, Andrey Repin wrote: > Greetings, All! >=20 > The script (let's call it test.sh): >=20 > #!/bin/dash -x > _lock=3D"./console-session.lock" > { > flock -n 9 || { > echo "The $(cat "$_lock") command is running already." > exit 3 > } >&2 >=20 > printf "$1" >&9 >=20 > trap 'rm "$_lock";' EXIT HUP INT ABRT TERM >=20 > sleep 20 >=20 > } 9>> "$_lock" >=20 > Very simple in essence. > The one-liner: >=20 > { flock -n 9 && sleep 10 || echo Fail;} 9>> ./console-session.lock >=20 > Also extremely simple. >=20 > Open two terminals. mintty or native, bash or dash, doesn't matter. > chdir to the directory with the script. >=20 > Start script in one terminal. ./test.sh > Start oneliner in another terminal. Fail. How predictable! I don't know what I'm doing wrong, but this WJFFM with Cygwin 2.4.1 as well as 2.5.0. Additionally I tried to put the oneliner into a script but it still WFM. Apart from that, did you notice the flock restrictions outlined in https://cygwin.com/cygwin-api/std-notes.html ? Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXAoVcAAoJEPU2Bp2uRE+gMYkP/2Y1z89MPsa/xAAWPPDCi1a4 B1z8Ml0YvfW0BzrjrtrngQpiNI9b+3eazxrEq8sq6i6iqeDsEl33PpiZJpuGLnVX oM2qiEtkHvlGmrnXOG/OqcXpPFR0sO43GxvFFYI6t94orEvZSFzb+7yKtum3A1aN R7+4iLLE3J0+3R5gyCpQXqtH9IPk6pdY0wXwLkPoDmurgcRWBRrAzGCtTUflloLA PeoqsZOf1W1J0wEJ2fsUt52dlZeHDuUWXqgmi8myoePlkb/koIBRU+wpgPc1PuDG DKrOeOg+d61JVtGCrUU9tSUH50hMA6SG193hTCpZ8w42xE8pfW5e6UbyNK+3LjHA GQEO+W8W1z6k3r0mxoeLxzE1vZ5r4C4ATsPV2FuyPb1bAd3w0kkgGaw7aZ/Ectkx GeuPHDxQMn2gwQq6vwfO8oT1q2eBfo2kToVdSt6hOY3IS95wINA4hJfSLjgD/MY1 7cVUwN/VuyZ3Odl+zFFta/zrI1tPTwQmLpqBCl/x24jTqWtTBaOOqdrxZZ3KV5WQ 1tHjAdIoixcPkyWYJCuhiaLtKt4AP7S5YQJyq5oEZMgEqmH9h0lSfQvUR0U9RE8t 5k1XDTXeqHqcyJQj2RQC6GJ9rrtiI2UMnF66iBUE/TUbzV4wyB7PaUzSbPoCpNR2 lOeHbpR3KBHs/nYD+iTP =79OU -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn--