From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 952fe44a for ; Tue, 18 Feb 2020 22:20:48 +0000 (UTC) Received: (qmail 8871 invoked by alias); 18 Feb 2020 22:20:41 -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: 45470 Received: (qmail 18055 invoked by uid 1010); 18 Feb 2020 22:20:41 -0000 X-Qmail-Scanner-Diagnostics: from mail-yw1-f66.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25725. spamassassin: 3.4.2. Clear:RC:0(209.85.161.66):SA:0(-1.9/5.0):. Processed in 2.554427 secs); 18 Feb 2020 22:20:41 -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.161.66 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:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=oZYgSIZMW7k+Dx82ChtpCAoOiHwqJjP7pGlxDngGHd8=; b=NTApOU2dmzjHt17I89p0A0aE/Vm+uY6PtJZV+WXzSLf9fp5oehFvU83H/a+cu6PGnR xcPfh72IuVeo3cnuuxvvdwzUvd+wEde+VPVfi3Dz/XnG0CcSzHsTX2GhDkQcYhIxsaUl eAPoF7ye1WbEXrQWyno/xpWKLZpoSGgdChsMAsS2wVbDszQuwnFQiI8+c1Nedrnze8p4 1q2PQSxbsprH5Skvif1/j99YMLKu5fUAhvMKe9ZoLMizDgcSfHABj6ZNrAW7b8FUocDT wVxbeVpABEo/v717aVfQPraZzDrNDYKpytn/6dmxBueri9yhBVvbkO+lBqH4aGAxgo8x VOpA== X-Gm-Message-State: APjAAAWaYs36UH4IM5V62xWeXPmLkEcBZK3CTFYyqqhfh8KgE8KxGH9G 6ok5AGerT2A3LSEOWDGdbNYwbi/0uAFJTg== X-Google-Smtp-Source: APXvYqwIbHPUk6PLYa5BV3rFHUonc2ot+EqlNfEjjSlkJw6F3Jd+3UL+K3C3o0cvSm6MdskS/nnNog== X-Received: by 2002:a81:9a09:: with SMTP id r9mr17719352ywg.244.1582064405670; Tue, 18 Feb 2020 14:20:05 -0800 (PST) From: dana Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: C02 '-N cond' test (was: [zsh:code] New commit [e89060] by dana) Date: Tue, 18 Feb 2020 16:20:02 -0600 References: <20200214223449.656ee1a3@tarpaulin.shahaf.local2> <7C1CC946-C125-46F0-BBA5-E6377851DD0C@dana.is> To: Zsh hackers list In-Reply-To: <7C1CC946-C125-46F0-BBA5-E6377851DD0C@dana.is> Message-Id: X-Mailer: Apple Mail (2.3445.104.11) On 14 Feb 2020, at 18:34, dana wrote: > Semi-related: I can't remember if this always happens or it's = intermittent, > but the '-N cond' test in C02 fails for me as well, apparently because = APFS > defaults to (the equivalent of) noatime. Not exactly right. I was confused about the consistency because it fails = for me on Catalina, but not Mojave. Comparing mount(8) between the two, = Catalina's adds this: strictatime Always update the file access time when reading from a file. Without this option the filesystem may default to a less strict update mode, where some access time updates are skipped for performance reasons. This option could be ignored if it is not supported by the filesystem. It doesn't elaborate on what 'some access time updates are skipped for performance reasons' means exactly. Maybe it's just like relatime, or = maybe it depends on some external variable like disk activity.... Anyway, with the patch below, the test passes for me in the following configurations: * macOS Mojave, APFS, default settings (no noatime) * macOS Catalina, APFS, default settings (no noatime, no strictatime) * Ubuntu 18.04, ext4, relatime * Ubuntu 18.04, ext4, noatime * Ubuntu 18.04, tmpfs, relatime * Ubuntu 18.04, tmpfs, noatime (None of them are skipped, since explicit atime updates like the ones = touch does are still effective even with noatime.) Like i said before, i had a hard time understanding why this test worked = the way it did =E2=80=94 let me know if i've overlooked anything obvious dana diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst index 4b1ec02f0..5b105b2a0 100644 --- a/Test/C02cond.ztst +++ b/Test/C02cond.ztst @@ -146,39 +146,27 @@ =20 # can't be bothered with -S =20 - if [[ ${mtab::=3D"$({mount || /sbin/mount || /usr/sbin/mount} = 2>/dev/null)"} =3D *[(]?*[)] ]]; then - print -u $ZTST_fd 'This test takes two seconds...' - else - unmodified_ls=3D"$(ls -lu $unmodified)" - print -u $ZTST_fd 'This test takes up to 60 seconds...' - fi - sleep 2 + print -ru $ZTST_fd 'This test may take two seconds...' touch $newnewnew if [[ $OSTYPE =3D=3D "cygwin" ]]; then ZTST_skip=3D"[[ -N file ]] not supported on Cygwin" elif (( isnfs )); then ZTST_skip=3D"[[ -N file ]] not supported with NFS" - elif { (( ! $+unmodified_ls )) && - cat $unmodified && - { df -k -- ${$(print -r -- "$mtab" | - awk '/noatime/ {print $1,$3}'):-""} | tr -s ' ' = | - fgrep -- "$(df -k . | tail -1 | tr -s ' ')" } >&/dev/null } = || - { (( $+unmodified_ls )) && SECONDS=3D0 && - ! until (( SECONDS >=3D 58 )); do - ZTST_hashmark; sleep 2; cat $unmodified - [[ $unmodified_ls !=3D "$(ls -lu $unmodified)" ]] && break - done }; then - ZTST_skip=3D"[[ -N file ]] not supported with noatime file system" + elif ! zmodload -F zsh/stat b:zstat 2> /dev/null; then + ZTST_skip=3D'[[ -N file ]] not tested; zsh/stat not available' + elif ! { sleep 2; touch -a $unmodified 2> /dev/null }; then + ZTST_skip=3D'[[ -N file ]] not tested; touch failed' + elif [[ "$(zstat +atime $unmodified)" =3D=3D "$(zstat +mtime = $unmodified)" ]]; then + ZTST_skip=3D'[[ -N file ]] not supported on this file system' else [[ -N $newnewnew && ! -N $unmodified ]] fi 0:-N cond -F:This test can fail on NFS-mounted filesystems as the access and -F:modification times are not updated separately. The test will fail -F:on HFS+ (Apple Mac OS X default) filesystems because access times -F:are not recorded. Also, Linux ext3 filesystems may be mounted -F:with the noatime option which does not update access times. -F:Failures in these cases do not indicate a problem in the shell. +F:This test relies on the file system supporting atime updates. It +F:should automatically detect whether this is the case, and skip +F:without failing if it isn't, but it's possible that some +F:configurations may elude this detection. Please report this +F:scenario if you encounter it. =20 [[ $newnewnew -nt $zlnfs && ! ($unmodified -nt $zlnfs) ]] 0:-nt cond