zsh-workers
 help / color / Atom feed
* Re: [zsh:code] New commit [e89060] by dana
       [not found] <e02941db80101cde47889c9bf7906fea0b0e85ee.code@zsh.p.sourceforge.net>
@ 2020-02-14 22:34 ` Daniel Shahaf
  2020-02-15  0:34   ` C02 '-N cond' test (was: [zsh:code] New commit [e89060] by dana) dana
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2020-02-14 22:34 UTC (permalink / raw)
  To: zsh-workers

zsh Git repository wrote on Fri, 14 Feb 2020 21:58 -0000:
> ## Branch: master  
> 
> unposted: V01zmodload: Fix failing test from workers/45385
> 
> By dana on 02/14/2020 21:55
> [**View Changes**](https://sourceforge.net/p/zsh/code/ci/e89060a37752da1a8418fa8daa1efb546c8b6e8d/)

Thanks.  It worked on my machine, probably because I link modules
statically.

Cheers,

Daniel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* C02 '-N cond' test (was: [zsh:code] New commit [e89060] by dana)
  2020-02-14 22:34 ` [zsh:code] New commit [e89060] by dana Daniel Shahaf
@ 2020-02-15  0:34   ` dana
  2020-02-18 22:20     ` dana
  0 siblings, 1 reply; 3+ messages in thread
From: dana @ 2020-02-15  0:34 UTC (permalink / raw)
  To: Zsh hackers list

On 14 Feb 2020, at 16:34, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Thanks.  It worked on my machine, probably because I link modules
> statically.

np, sorry i didn't notice it before now.

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.

I found workers/38355, but both the thread and the test itself are a little
hard for me to follow. Could we not do something like this?

  touch $newnewnew
  sleep 2
  if ! zmodload -F zsh/stat b:zstat 2> /dev/null; then
    ZTST_skip='[[ -N file ]] not tested; zsh/stat not available'
  elif ! touch -a $unmodified 2> /dev/null; then
    ZTST_skip='[[ -N file ]] not tested; touch failed'
  elif [[ "$(zstat +atime $unmodified)" == "$(zstat +mtime $unmodified)" ]]; then
    ZTST_skip='[[ -N file ]] not supported on this file system'
  else
    [[ -N $newnewnew && ! -N $unmodified ]]
  fi

PS: I'm not worried about this for 5.8, since i've seen it before; just
mentioning while it's on my mind

dana


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C02 '-N cond' test (was: [zsh:code] New commit [e89060] by dana)
  2020-02-15  0:34   ` C02 '-N cond' test (was: [zsh:code] New commit [e89060] by dana) dana
@ 2020-02-18 22:20     ` dana
  0 siblings, 0 replies; 3+ messages in thread
From: dana @ 2020-02-18 22:20 UTC (permalink / raw)
  To: Zsh hackers list

On 14 Feb 2020, at 18:34, dana <dana@dana.is> 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 — 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 @@
 
 # can't be bothered with -S
 
-  if [[ ${mtab::="$({mount || /sbin/mount || /usr/sbin/mount} 2>/dev/null)"} = *[(]?*[)] ]]; then
-    print -u $ZTST_fd 'This test takes two seconds...'
-  else
-    unmodified_ls="$(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 == "cygwin" ]]; then
     ZTST_skip="[[ -N file ]] not supported on Cygwin"
   elif (( isnfs )); then
     ZTST_skip="[[ -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=0 &&
-         ! until (( SECONDS >= 58 )); do
-             ZTST_hashmark; sleep 2; cat $unmodified
-             [[ $unmodified_ls != "$(ls -lu $unmodified)" ]] && break
-	   done }; then
-    ZTST_skip="[[ -N file ]] not supported with noatime file system"
+  elif ! zmodload -F zsh/stat b:zstat 2> /dev/null; then
+    ZTST_skip='[[ -N file ]] not tested; zsh/stat not available'
+  elif ! { sleep 2; touch -a $unmodified 2> /dev/null }; then
+    ZTST_skip='[[ -N file ]] not tested; touch failed'
+  elif [[ "$(zstat +atime $unmodified)" == "$(zstat +mtime $unmodified)" ]]; then
+    ZTST_skip='[[ -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.
 
   [[ $newnewnew -nt $zlnfs && ! ($unmodified -nt $zlnfs) ]]
 0:-nt cond


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <e02941db80101cde47889c9bf7906fea0b0e85ee.code@zsh.p.sourceforge.net>
2020-02-14 22:34 ` [zsh:code] New commit [e89060] by dana Daniel Shahaf
2020-02-15  0:34   ` C02 '-N cond' test (was: [zsh:code] New commit [e89060] by dana) dana
2020-02-18 22:20     ` dana

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git