This test script will fail about half the time on Mac OS X, both 10.5.1 and 10.4.11. Note that the second test (the “FAIL2″) never seems to fail.
#!/bin/bashmkdir test
dd if=/dev/random of=test/file1.txt bs=1024 count=5 > /dev/null 2> /dev/null
cp test/file1.txt test/file2.txt
cp test/file1.txt test/file3.txt
cp test/file1.txt test/file4.txt
cp test/file1.txt test/file5.txt
cp test/file1.txt test/file6.txt
cp test/file1.txt test/file7.txt
mkdir test/subdir
cp test/file*txt test/subdirzip -0 -q -r - test > f1
cat f1 | ditto -xk - .1zip -0 -q -r - test | cat > f2
cat f2 | ditto -xk - .2diff -r .1 .2 > /dev/null
if test $? != "0"; then echo "FAIL"; fiditto -xk f2 .3
diff -r .1 .3
if test $? != "0"; then echo "FAIL2"; firm -rf f1 f2 .1 .2 .3 test
I’m not such which sucks worse: the fact that ditto can’t handle what is apparently a perfectly valid zip file, or that zip writes something different to stdout, depending on whether or not it is a pipe or a file.

Loading...
Post a Comment