1 Star 0 Fork 16

SEmmmer/zsh_1

forked from src-openEuler/zsh 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Simplify-N-cond-test.patch 2.88 KB
一键复制 编辑 原始数据 按行查看 历史
邹林 提交于 2021-01-28 14:24 . update version to 5.8
From 80ddc46e54f6116235e68d3fc039ef775e72d1c5 Mon Sep 17 00:00:00 2001
From: dana <[email protected]>
Date: Wed, 11 Mar 2020 21:17:12 -0500
Subject: [PATCH] 45470: C02cond: Simplify '-N cond' test
This fixes an (intermittent?) issue with the test on macOS+APFS, and hopefully
makes it simpler and faster in general
---
Test/C02cond.ztst | 36 ++++++++++++------------------------
1 files changed, 12 insertions(+), 24 deletions(-)
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/emmmer/zsh_1.git
[email protected]:emmmer/zsh_1.git
emmmer
zsh_1
zsh_1
master

搜索帮助