diff options
author | LOLi <[email protected]> | 2018-05-07 05:42:29 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-05-06 20:42:29 -0700 |
commit | fb0da71fd96c37ff86c4d55e53b5a56e050bcfc9 (patch) | |
tree | 90e7b16edc97b2bdc3f1240d0cf3aaf7b4aa01d1 /tests | |
parent | 64c1dcefe38a62d304177475a2ef77111cec612a (diff) |
ZTS: Fix zfs_diff_timestamp
When using mawk instead of gawk zfs_diff_timestamp fails consistently:
this is due to a subtle difference in how mawk handles substr().
From awk(1):
---
Finally, here is how mawk handles exceptional cases not discussed in
the AWK book or the Posix draft. It is unsafe to assume consistency
across awks and safe to skip to the next section.
substr(s, i, n) returns the characters of s in the intersection of
the closed interval [1, length(s)] and the half-open interval [i, i+n).
When this intersection is empty, the empty string is returned; so
substr("ABC", 1, 0) = "" and substr("ABC", -4, 6) = "A".
---
To support running zfs_diff_timestamp with both gawk and mawk change
the second parameter passed to substr().
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #7503
Closes #7510
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh index 513d14c8d..55dd8b66f 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh @@ -75,7 +75,7 @@ log_must zfs snapshot "$TESTSNAP2" # 3. Verify 'zfs diff -t' correctly display timestamps typeset -i count=0 log_must eval "zfs diff -t $TESTSNAP1 $TESTSNAP2 > $FILEDIFF" -awk '{print substr($1,0,index($1,".")-1)" "$NF}' < "$FILEDIFF" | while read line +awk '{print substr($1,1,index($1,".")-1)" "$NF}' < "$FILEDIFF" | while read line do read ctime file <<< "$line" |