(check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
[coreutils.git] / tests / tail-2 / big-4gb
blob61f1720cf33f6462442f16402aebe6cbb77a974d
1 #!/bin/sh
2 # Demonstrate a bug in `tail -cN' when operating on files of size 4G and larger
3 # Fixed in coreutils-4.5.2.
5 . $srcdir/../expensive
7 if test "$VERBOSE" = yes; then
8 set -x
9 tail --version
12 pwd=`pwd`
13 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
14 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
15 trap '(exit $?); exit $?' 1 2 13 15
17 framework_failure=0
18 mkdir -p $tmp || framework_failure=1
19 cd $tmp || framework_failure=1
21 # Create a file of size exactly 4GB (2^32) with 8 bytes
22 # at the beginning and another set of 8 bytes at the end.
23 # The rest will be NUL bytes. On most modern systems, the following
24 # creates a file that takes up only a few KB. Here, du -sh says 16KB.
25 echo abcdefgh | tr -d '\n' > big || framework_failure=1
26 echo 87654321 | tr -d '\n' > tmp || framework_failure=1
27 # Seek 4GB - 8
28 dd bs=1 seek=4294967288 if=tmp of=big 2> err || dd_failed=1
29 if test "$dd_failed" = 1; then
30 cat err 1>&2
31 framework_failure=1
34 if test $framework_failure = 1; then
35 echo "$0: failure in testing framework" 1>&2
36 (exit 1); exit 1
39 fail=0
41 tail -c1 big > out || fail=1
42 # Append a newline.
43 echo >> out
44 cat <<\EOF > exp
46 EOF
48 cmp out exp || fail=1
49 test $fail = 1 && diff out exp 2> /dev/null
51 (exit $fail); exit $fail