pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS

Difference between
modified post 33a4be423 by Anonymous on Tue 12th Nov 2024 17:05
original post e75825a by Anonymous on Tue 12th Nov 2024 16:23
Download diff
Show old version | new version | both versions

    
11
#!/bin/bash
22
33
#
44
# wintartest001.bash - /cygdrive/c/Windows/system32/tar filesystem test
55
# which compares files unpacked by /cygdrive/c/Windows/system32/tar
66
# and /usr/bin/tar, and checks whether files have same hashes
77
#
88
# Written by Roland Mainz <roland.mainz@nrubsig.org>
99
#
1010
1111
#
1212
# Notes:
13+
# - Genreate test tar.bz2 files like this:
1315
# - Compare individual files with
1416
# $ diff -u <(od -x -v cygwintar/bin/ksh93.exe) <(od -x -v wintar/bin/ksh93.exe)
1517
#
1618
1719
export PATH='/bin:/usr/bin'
1820
1921
# set umask=0000 to avoid permission madness on SMB
2022
umask 0000
2123
2224
typeset intarfile="$1"
2325
typeset f
2426
typeset -i num_failed_hash_compare=0
2527
2628
if [[ ! -x '/cygdrive/c/Windows/system32/tar' ]] ; then
2729
	printf $"%s: %s not found.\n" \
2830
		"$0" '/cygdrive/c/Windows/system32/tar' 1>&2
2931
	exit 1
3032
fi
3133
3234
if [[ ! -r "$intarfile" ]] ; then
3335
	printf $"%s: Input file %q not readable.\n" \
3436
		"$0" "$intarfile" 1>&2
3537
	exit 1
3638
fi
3739
3840
typeset IFS=$'\n'
3941
4042
set -o xtrace
4143
set -o errexit
4244
4345
intarfile="$(realpath "$intarfile")"
4446
4547
rm -Rf 'wintar_tmp' 'cygwintar_tmp'
4648
mkdir 'wintar_tmp' 'cygwintar_tmp'
4749
4850
cd 'wintar_tmp'
4951
/cygdrive/c/Windows/system32/tar -xvf "$(cygpath -w "$intarfile")"
5052
cd '..'
5153
5254
cd 'cygwintar_tmp'
5355
/usr/bin/tar -xvf "$intarfile"
5456
cd '..'
5557
5658
typeset -a file_list=(
5759
	$(cd 'cygwintar_tmp' && find . -type f)
5860
)
5961
6062
set +o xtrace +o errexit
6163
6264
for f in "${file_list[@]}" ; do
6365
	IFS=' ' read wintar_hash dummy < <(openssl md5 -r "wintar_tmp/$f")
6466
	IFS=' ' read cygwintar_hash dummy < <(openssl md5 -r "cygwintar_tmp/$f")
6567
6668
	if [[ "$wintar_hash" == "$cygwintar_hash" ]] ; then
6769
		printf $"NOTE:\tHashes for file %q OK\n" "$f"
6870
	else
6971
		printf $"ERROR:\tHashes for file %q differ, wintar_hash(%s) != cygwintar_hash(%s)\n" \
7072
			"$f" "$wintar_hash" "$cygwintar_hash"
7173
		(( num_failed_hash_compare++ ))
7274
	fi
7375
done
7476
7577
exit $((num_failed_hash_compare > 0?1:0))
7678

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at