at_fn_group_banner 171 'sparse03.at:21' \
  "storing sparse files > 8G" "                      " 25
at_xfail=no
      test -f $XFAILFILE && at_xfail=yes
(
  printf "%s\n" "171. $at_setup_line: testing $at_desc ..."
  $at_traceon



# Tar 1.15.1 incorrectly computed sparse member size if the extended
# PAX header contained size keyword.
# References: <87vf46nb36.fsf@penguin.cs.ucla.edu>
# http://lists.gnu.org/archive/html/bug-tar/2005-06/msg00040.html



  { set +x
printf "%s\n" "$at_srcdir/sparse03.at:29:
mkdir posix
(cd posix
TEST_TAR_FORMAT=posix
export TEST_TAR_FORMAT
TAR_OPTIONS=\"-H posix\"
export TAR_OPTIONS
rm -rf *

test \"\${TARTEST_SKIP_LARGE_FILES:-0}\" != 0 && exit 77
genfile --length 1000 --file begin
genfile --length 1000 --file end
genfile --sparse --file sparsefile --block-size 512 8G A || exit 77
tar -c -f archive --sparse begin sparsefile end || exit 1
echo separator

tar tfv archive
echo separator
mkdir directory
tar Cxf directory archive
genfile --stat=name,size sparsefile
cmp sparsefile directory/sparsefile
)"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "sparse03.at:29"
( $at_check_trace;
mkdir posix
(cd posix
TEST_TAR_FORMAT=posix
export TEST_TAR_FORMAT
TAR_OPTIONS="-H posix"
export TAR_OPTIONS
rm -rf *

test "${TARTEST_SKIP_LARGE_FILES:-0}" != 0 && exit 77
genfile --length 1000 --file begin
genfile --length 1000 --file end
genfile --sparse --file sparsefile --block-size 512 8G A || exit 77
tar -c -f archive --sparse begin sparsefile end || exit 1
echo separator

tar tfv archive
echo separator
mkdir directory
tar Cxf directory archive
genfile --stat=name,size sparsefile
cmp sparsefile directory/sparsefile
)
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/sparse03.at:29"
$at_failed && at_fn_log_failure
$at_traceon; }





cat >stdout.re <<'_ATEOF'
separator
-rw-r--r-- ^ ^ *  *1000 0-90-90-90-9-0-90-9-0-90-9 0-90-9:0-90-9 begin
-rw-r--r-- ^ ^ *  *8589935104 0-90-90-90-9-0-90-9-0-90-9 0-90-9:0-90-9 sparsefile
-rw-r--r-- ^ ^ *  *1000 0-90-90-90-9-0-90-9-0-90-9 0-90-9:0-90-9 end
separator
sparsefile 8589935104
_ATEOF

awk '{print NR " " $0}' stdout > $$.1
awk '{print NR " " $0}' stdout.re | join - $$.1 |
while read NUM RE LINE
do
  echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
done


  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
