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.
13 --- tar-1.12/src/create.c Mon Dec 15 17:26:47 1997
14 +++ tar-1.12/src/create.c Mon Dec 15 17:50:48 1997
17 if (save_typeflag == GNUTYPE_SPARSE)
19 - if (finish_sparse_file (f, &sizeleft, current_stat.st_size, p))
20 + if (f < 0 || finish_sparse_file (f, &sizeleft, current_stat.st_size, p))
24 --- tar-1.12/lib/Makefile.am Wed Apr 16 16:30:04 1997
25 +++ tar-1.12/lib/Makefile.am Mon Nov 17 06:45:43 1997
27 libtar_a_LIBADD = @ALLOCA@ @LIBOBJS@
28 libtar_a_DEPENDENCIES = $(libtar_a_LIBADD)
33 # Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
34 $(srcdir)/getdate.c: getdate.y
35 @echo Expect 13 shift/reduce conflicts...
36 --- tar-1.12/src/arith.h Wed Apr 16 18:02:57 1997
37 +++ tar-1.12/src/arith.h Mon Nov 17 05:47:33 1997
40 #if BITS_PER_BYTE * SIZEOF_UNSIGNED_LONG >= BITS_PER_TARLONG
42 -# define TARLONG_FORMAT "%uld"
43 +# define TARLONG_FORMAT "%lu"
44 typedef unsigned long tarlong;
46 -# if BITS_PER_BYTE * SIZEOF_LONG_LONG >= BITS_PER_TARLONG + 1
47 +# if PRINTF_LONG_LONG_WORKS && BITS_PER_BYTE * SIZEOF_LONG_LONG >= BITS_PER_TARLONG + 1
49 # define TARLONG_FORMAT "%lld"
50 typedef long long tarlong;
52 # if BITS_PER_BYTE * SIZEOF_UNSIGNED_LONG >= 64
53 # define SUPERDIGIT 1000000000L
54 # define BITS_PER_SUPERDIGIT 29
55 -# define TARLONG_FORMAT "%09uld"
56 +# define TARLONG_FORMAT "%09lu"
58 # if BITS_PER_BYTE * SIZEOF_UNSIGNED_LONG >= 32
59 # define SUPERDIGIT 10000L
60 # define BITS_PER_SUPERDIGIT 14
61 -# define TARLONG_FORMAT "%04uld"
62 +# define TARLONG_FORMAT "%04lu"
66 --- tar-1.12/src/arith.c Wed Apr 23 23:25:57 1997
67 +++ tar-1.12/src/arith.c Mon Nov 17 08:11:11 1997
70 add_to_tarlong_helper (unsigned long *accumulator, int value)
73 + int counter, newvalue;
76 for (counter = 0; counter < LONGS_PER_TARLONG; counter++)
78 accumulator[counter] += value;
81 - accumulator[counter] += value + SUPERDIGIT;
83 + newvalue = - ((-value-1) / SUPERDIGIT) -1;
84 + value = - ((-value) % SUPERDIGIT);
85 + accumulator[counter] += SUPERDIGIT + value;
86 + if (accumulator[counter] >= SUPERDIGIT)
88 + accumulator[counter] -= SUPERDIGIT;
94 for (counter = 0; counter < LONGS_PER_TARLONG; counter++)
96 accumulator[counter] += value;
99 - accumulator[counter] += value - SUPERDIGIT;
101 + newvalue = value / SUPERDIGIT;
102 + value = value % SUPERDIGIT;
103 + accumulator[counter] += value;
104 + if (accumulator[counter] >= SUPERDIGIT)
106 + accumulator[counter] -= SUPERDIGIT;
111 FATAL_ERROR ((0, 0, _("Arithmetic overflow")));
114 while (counter > 0 && accumulator[counter] == 0)
117 - fprintf (file, "%uld", accumulator[counter]);
118 + fprintf (file, "%lu", accumulator[counter]);
120 fprintf (file, TARLONG_FORMAT, accumulator[--counter]);
122 --- tar-1.12/configure.in Fri Apr 25 17:02:46 1997
123 +++ tar-1.12/configure.in Mon Nov 17 06:17:49 1997
125 AC_CHECK_SIZEOF(unsigned long, 4)
126 AC_CHECK_SIZEOF(long long, 0)
128 +# SunOS 4.1.3's printf treats %lld as %ld
129 +AC_CACHE_CHECK([whether printf understands %lld],
130 + tar_cv_printf_long_long_works,
134 + long long foo = -1;
138 + sprintf(buf, "%lld", foo);
139 + sscanf(buf, "%lld", &bar);
147 + tar_cv_printf_long_long_works=yes,
148 + tar_cv_printf_long_long_works=no,
149 + if test x"$tar_cv_printf_long_long_works" = x; then
150 + tar_cv_printf_long_long_works=cross
153 +if test x"$tar_cv_printf_long_long_works" = x"yes"; then
154 + AC_DEFINE(PRINTF_LONG_LONG_WORKS)
157 AC_CHECK_HEADERS(fcntl.h limits.h linux/fd.h memory.h net/errno.h poll.h \
158 sgtty.h string.h stropts.h \
159 sys/buf.h sys/device.h sys/gentape.h sys/inet.h sys/io/trioctl.h sys/ioccom.h \
160 --- tar-1.12/acconfig.h Thu Apr 10 11:37:02 1997
161 +++ tar-1.12/acconfig.h Mon Nov 17 05:53:38 1997
164 /* Define to 1 if GNU regex should be used instead of GNU rx. */
167 +/* Define to 1 if printf() supports "%lld" */
168 +#undef PRINTF_LONG_LONG_WORKS
169 --- tar-1.12/configure
170 +++ tar-1.12/configure
173 +echo You must run autoheader and autoconf after installing this patch