2 # Demonstrate a bug in `tail -cN' when operating on files of size 4G and larger
3 # Fixed in coreutils-4.5.2.
7 if test "$VERBOSE" = yes; then
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
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 16K.
25 echo abcdefgh |
tr -d '\n' > big || framework_failure
=1
26 echo 87654321 |
tr -d '\n' > tmp || framework_failure
=1
28 dd bs
=1 seek
=4294967288 if=tmp of
=big
2> err || dd_failed
=1
29 if test "$dd_failed" = 1; then
31 echo "$0: cannot create a file large enough for this test," 1>&2
32 echo "$0: possibly because this system doesn't support large files;" 1>&2
33 echo "$0: Consider rerunning this test on a different file system." 1>&2
37 if test $framework_failure = 1; then
38 echo "$0: failure in testing framework" 1>&2
44 tail -c1 big
> out || fail
=1
52 test $fail = 1 && diff out exp
2> /dev
/null
54 (exit $fail); exit $fail