1 The first hunk in this file was submitted by Craig Wiegert
2 <wiegert@quintessence.uchicago.edu>. It fixed a problem that causes
3 GNUTAR to issue error messages like the following for sparse files:
5 > /bin/tar: Read error at byte 0, reading 512 bytes, in file ./var/log/lastlog: Bad file number
7 The others fix an estimate problem in GNUTAR on SunOS 4.1.3, HP/UX and
8 other systems whose C libraries do not support "%lld" in printf format
9 strings for printing long long integers.
11 --- tar-1.12/src/create.c Mon Dec 15 17:26:47 1997
12 +++ tar-1.12/src/create.c Mon Dec 15 17:50:48 1997
15 if (save_typeflag == GNUTYPE_SPARSE)
17 - if (finish_sparse_file (f, &sizeleft, current_stat.st_size, p))
18 + if (f < 0 || finish_sparse_file (f, &sizeleft, current_stat.st_size, p))
22 --- tar-1.12/lib/Makefile.am Wed Apr 16 16:30:04 1997
23 +++ tar-1.12/lib/Makefile.am Mon Nov 17 06:45:43 1997
25 libtar_a_LIBADD = @ALLOCA@ @LIBOBJS@
26 libtar_a_DEPENDENCIES = $(libtar_a_LIBADD)
31 # Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
32 $(srcdir)/getdate.c: getdate.y
33 @echo Expect 13 shift/reduce conflicts...
34 --- tar-1.12/src/arith.h Wed Apr 16 18:02:57 1997
35 +++ tar-1.12/src/arith.h Mon Nov 17 05:47:33 1997
38 #if BITS_PER_BYTE * SIZEOF_UNSIGNED_LONG >= BITS_PER_TARLONG
40 -# define TARLONG_FORMAT "%uld"
41 +# define TARLONG_FORMAT "%lu"
42 typedef unsigned long tarlong;
44 -# if BITS_PER_BYTE * SIZEOF_LONG_LONG >= BITS_PER_TARLONG + 1
45 +# if PRINTF_LONG_LONG_WORKS && BITS_PER_BYTE * SIZEOF_LONG_LONG >= BITS_PER_TARLONG + 1
47 # define TARLONG_FORMAT "%lld"
48 typedef long long tarlong;
50 # if BITS_PER_BYTE * SIZEOF_UNSIGNED_LONG >= 64
51 # define SUPERDIGIT 1000000000L
52 # define BITS_PER_SUPERDIGIT 29
53 -# define TARLONG_FORMAT "%09uld"
54 +# define TARLONG_FORMAT "%09lu"
56 # if BITS_PER_BYTE * SIZEOF_UNSIGNED_LONG >= 32
57 # define SUPERDIGIT 10000L
58 # define BITS_PER_SUPERDIGIT 14
59 -# define TARLONG_FORMAT "%04uld"
60 +# define TARLONG_FORMAT "%04lu"
64 --- tar-1.12/src/arith.c Wed Apr 23 23:25:57 1997
65 +++ tar-1.12/src/arith.c Mon Nov 17 08:11:11 1997
68 add_to_tarlong_helper (unsigned long *accumulator, int value)
71 + int counter, newvalue;
74 for (counter = 0; counter < LONGS_PER_TARLONG; counter++)
76 accumulator[counter] += value;
79 - accumulator[counter] += value + SUPERDIGIT;
81 + newvalue = - ((-value-1) / SUPERDIGIT) -1;
82 + value = - ((-value) % SUPERDIGIT);
83 + accumulator[counter] += SUPERDIGIT + value;
84 + if (accumulator[counter] >= SUPERDIGIT)
86 + accumulator[counter] -= SUPERDIGIT;
92 for (counter = 0; counter < LONGS_PER_TARLONG; counter++)
94 accumulator[counter] += value;
97 - accumulator[counter] += value - SUPERDIGIT;
99 + newvalue = value / SUPERDIGIT;
100 + value = value % SUPERDIGIT;
101 + accumulator[counter] += value;
102 + if (accumulator[counter] >= SUPERDIGIT)
104 + accumulator[counter] -= SUPERDIGIT;
109 FATAL_ERROR ((0, 0, _("Arithmetic overflow")));
112 while (counter > 0 && accumulator[counter] == 0)
115 - fprintf (file, "%uld", accumulator[counter]);
116 + fprintf (file, "%lu", accumulator[counter]);
118 fprintf (file, TARLONG_FORMAT, accumulator[--counter]);
120 --- tar-1.12/configure.in Fri Apr 25 17:02:46 1997
121 +++ tar-1.12/configure.in Mon Nov 17 06:17:49 1997
123 AC_CHECK_SIZEOF(unsigned long, 4)
124 AC_CHECK_SIZEOF(long long, 0)
126 +# SunOS 4.1.3's printf treats %lld as %ld
127 +AC_CACHE_CHECK([whether printf understands %lld],
128 + tar_cv_printf_long_long_works,
132 + long long foo = -1;
136 + sprintf(buf, "%lld", foo);
137 + sscanf(buf, "%lld", &bar);
145 + tar_cv_printf_long_long_works=yes,
146 + tar_cv_printf_long_long_works=no,
147 + if test x"$tar_cv_printf_long_long_works" = x; then
148 + tar_cv_printf_long_long_works=cross
151 +if test x"$tar_cv_printf_long_long_works" = x"yes"; then
152 + AC_DEFINE(PRINTF_LONG_LONG_WORKS)
155 AC_CHECK_HEADERS(fcntl.h limits.h linux/fd.h memory.h net/errno.h poll.h \
156 sgtty.h string.h stropts.h \
157 sys/buf.h sys/device.h sys/gentape.h sys/inet.h sys/io/trioctl.h sys/ioccom.h \
158 --- tar-1.12/acconfig.h Thu Apr 10 11:37:02 1997
159 +++ tar-1.12/acconfig.h Mon Nov 17 05:53:38 1997
162 /* Define to 1 if GNU regex should be used instead of GNU rx. */
165 +/* Define to 1 if printf() supports "%lld" */
166 +#undef PRINTF_LONG_LONG_WORKS
167 --- tar-1.12/configure
168 +++ tar-1.12/configure
171 +echo You must run autoheader and autoconf after installing this patch