From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 14588 invoked from network); 12 Mar 2020 18:47:08 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 12 Mar 2020 18:47:08 -0000 Received: (qmail 29767 invoked by alias); 12 Mar 2020 18:46:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45544 Received: (qmail 8506 invoked by uid 1010); 12 Mar 2020 18:46:58 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk1-f195.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25744. spamassassin: 3.4.2. Clear:RC:0(209.85.222.195):SA:0(-1.9/5.0):. Processed in 7.310677 secs); 12 Mar 2020 18:46:58 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.222.195 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hD3dUOVbTYT0bnhFFef80RKCam8R+5SBDJK8avvY67U=; b=l6ShMxNBf6+XXp6+9vtX0DXL/Z3Rp5IibIs+aYty139+jWo9hV+Lg2ofow2T25p2tT DQu54mDEeC3KpQ0SP0eBrVdqpZswJboY3UuV4BeMWC2zmMfdzB/Za1oBDz8NNIk/QiS9 Qrfsxl3koq9pTZhQJB4hvBxLyaAh2lBXXUQB4BJRARc997SMfUQeZdPtVQzzCXFv9ci3 b51MnFhQc2cl/euKEdBxDBQCaNFVLFYCiZ+3lsE/fAiZkE5xE/I+C8n+JJuqUqzjCi35 XfG5mFnLMzld1sjn6ls/oxGTq3sZ015bZ4F/1AniyTby9F9t8/uK+ShRuEfFwggoPPlC Y7Tw== X-Gm-Message-State: ANhLgQ3MQxseGB1rG4mMn79F9CUzqLTV1WHa0Js056KN9rurgkxDoJ0W Nq8/aOIXB+UjMNnVU4e/kmB3BA== X-Google-Smtp-Source: ADFU+vurnQgT3yG619cTDw/nlmUo0txp35Az6QhVsqivuk32pzuPwMcp/GPy0LRcmBqVNLykWeRA7Q== X-Received: by 2002:a37:c50:: with SMTP id 77mr9272722qkm.217.1584038777177; Thu, 12 Mar 2020 11:46:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] Enable sub-second timeout in zsystem flock From: dana In-Reply-To: <20200308183907.mxnhqrr2uflwooax@phare.normalesup.org> Date: Thu, 12 Mar 2020 13:46:15 -0500 Cc: "zsh-workers@zsh.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190729203521.upp5ku3bsr3hsnxq@phare.normalesup.org> <20200104184734.ienw42rwq2xu6aap@phare.normalesup.org> <43775C64-0254-45AB-81AB-B04AE80C4416@dana.is> <20200106173030.eb2pg4rhhgysh35r@phare.normalesup.org> <20200111154143.fjtwgfnztqfmkyda@phare.normalesup.org> <20200308183907.mxnhqrr2uflwooax@phare.normalesup.org> To: Cedric Ware X-Mailer: Apple Mail (2.3445.104.11) Sorry for the delay. On 8 Mar 2020, at 13:39, Cedric Ware = wrote: > One thing about the tests: I've used the (...)& syntax to launch a > sub-shell in the background for concurrency checks. But does the test > script wait for sub-processes to finish between tests? It does not, no. Some more comments: > + ( > + : > $tst_dir/file > + zsystem flock -t 0.1 -i 0.000001 $tst_dir/file > + ) If this file is meant to be used by the other tests, it seems like it = might make more sense to create it in %prep. Like it'll be fine this way, but = unless there's a specific reason to do it like that... > + ( > + typeset -F SECONDS > + start=3D$SECONDS > + (zsystem flock $tst_dir/file && zselect -t 50) & > + zselect -t 1 > + if zsystem flock $tst_dir/file; then > + elapsed=3D$[ $SECONDS - $start ] > + if [[ $elapsed -ge 0.3 && $elapsed -le 0.7 ]]; then > + echo "elapsed time seems OK" 1>&2 > + else > + echo "elapsed time $elapsed should be ~ 0.5 second" 1>&2 > + fi > + else > + false > + fi > + ) 1. All of the `else false`es in these tests seem redundant. If the = condition doesn't pass it'll return >0 automatically, and the test will fail if = it doesn't get the right output anyway 2. This particular test doesn't seem reliable on my machine. Within the = test harness, it normally takes about 0.078 seconds. Probably the fork = over-head (which is pretty high on macOS) is greater than the amount of time = you're giving it wait? If i change `zselect -t 1` to `zselect -t 10` it = seems to work better... but it still feels very brittle. Very much dependent = on the hardware, the OS, and the current resource utilisation dana