Skip to content

Commit

Permalink
Upstream: alternate recursive_cksum
Browse files Browse the repository at this point in the history
  • Loading branch information
lundman authored and ilovezfs committed Jun 26, 2021
1 parent dd3bc50 commit 2ca430c
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tests/zfs-tests/tests/functional/rsend/rsend.kshlib
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,24 @@ function recursive_cksum
\; | sort | sha256 -q
;;
Darwin)
find $1 -type f -exec sh -c 'sha256sum {}; xattr -lv {} | \
sha256sum' \; | \
sort -k 2 | awk '{ print $1 }' | sha256sum | \
awk '{ print $1 }'
# Posix makes no promise on the order of readdir entries
# so sort the find. Alas, XNU's "xattr" also doesn't sort
# so it becomes a hassle. Neither command can strip the
# full path in filename.
for name in $(find $1 -type f -print0 | sort -V -z | xargs -0)
do
# file's checksum
filsum=$(sha256sum "${name}" | awk '{print $1}')
# echo "${name}:${filsum}"
echo "${filsum}"
# sort xattrs too
for a in $(xattr "${name}" | sort -V)
do
cksum=$(xattr -px "$a" "${name}" | sha256sum | awk '{print $1}')
echo "${a}:${cksum}"
# echo "${cksum}"
done
done | sha256sum | awk '{print $1}'
;;
*)
find $1 -type f -exec sh -c 'sha256sum {}; getfattr \
Expand Down

0 comments on commit 2ca430c

Please sign in to comment.