This commit is contained in:
Peter Vrabec 2006-04-24 20:53:15 +00:00
parent 4892f79503
commit 704bb5b132
12 changed files with 13 additions and 807 deletions

View File

@ -1 +1 @@
tar-1.15.1.tar.gz
tar-1.15.90.tar.gz

View File

@ -1,2 +1,2 @@
d87021366fe6488e9dc398fcdcb6ed7d tar-1.15.1.tar.gz
f7009caa98f15ed4efa2b2f7c4d702e0 tar-1.15.90.tar.gz
ecf87e839c91a75ea9a84307455c0255 tar.1

View File

@ -1,16 +0,0 @@
Patch by Robert Scheck <redhat@linuxnetz.de> for tar >= 1.15.1, which makes tar
rebuildable using gcc 4.
--- tar-1.15.1/tests/genfile.c 2004-09-08 13:50:20.000000000 +0200
+++ tar-1.15.1/tests/genfile.c.gcc4 2005-03-13 16:25:15.000000000 +0100
@@ -60,8 +60,8 @@
/* Block buffer for sparse file */
char *buffer;
-static const char *argp_program_version = "genfile (" PACKAGE ") " VERSION;
-static const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
+const char *argp_program_version = "genfile (" PACKAGE ") " VERSION;
+const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
static char doc[] = N_("genfile generates data files for GNU paxutils test suite");
static struct argp_option options[] = {

View File

@ -1,121 +0,0 @@
--- src/xheader.c.orig 2004-09-06 06:31:14.000000000 -0500
+++ src/xheader.c 2006-02-08 16:59:46.000000000 -0500
@@ -783,6 +783,32 @@ code_num (uintmax_t value, char const *k
xheader_print (xhdr, keyword, sbuf);
}
+static bool
+decode_num (uintmax_t *num, char const *arg, uintmax_t maxval,
+ char const *keyword)
+{
+ uintmax_t u;
+ char *arg_lim;
+
+ if (! (ISDIGIT (*arg)
+ && (errno = 0, u = strtoumax (arg, &arg_lim, 10), !*arg_lim)))
+ {
+ ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
+ keyword, arg));
+ return false;
+ }
+
+ if (! (u <= maxval && errno != ERANGE))
+ {
+ ERROR ((0, 0, _("Extended header %s=%s is out of range"),
+ keyword, arg));
+ return false;
+ }
+
+ *num = u;
+ return true;
+}
+
static void
dummy_coder (struct tar_stat_info const *st __attribute__ ((unused)),
char const *keyword __attribute__ ((unused)),
@@ -821,7 +847,7 @@ static void
gid_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, TYPE_MAXIMUM (gid_t), "gid"))
st->stat.st_gid = u;
}
@@ -903,7 +929,7 @@ static void
size_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), "size"))
st->archive_file_size = st->stat.st_size = u;
}
@@ -918,7 +944,7 @@ static void
uid_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, TYPE_MAXIMUM (uid_t), "uid"))
st->stat.st_uid = u;
}
@@ -946,7 +972,7 @@ static void
sparse_size_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), "GNU.sparse.size"))
st->stat.st_size = u;
}
@@ -962,10 +988,10 @@ static void
sparse_numblocks_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, SIZE_MAX, "GNU.sparse.numblocks"))
{
st->sparse_map_size = u;
- st->sparse_map = calloc(st->sparse_map_size, sizeof(st->sparse_map[0]));
+ st->sparse_map = xcalloc (u, sizeof st->sparse_map[0]);
st->sparse_map_avail = 0;
}
}
@@ -982,8 +1008,14 @@ static void
sparse_offset_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), "GNU.sparse.offset"))
+ {
+ if (st->sparse_map_avail < st->sparse_map_size)
st->sparse_map[st->sparse_map_avail].offset = u;
+ else
+ ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
+ "GNU.sparse.offset", arg));
+ }
}
static void
@@ -998,15 +1030,13 @@ static void
sparse_numbytes_decoder (struct tar_stat_info *st, char const *arg)
{
uintmax_t u;
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
+ if (decode_num (&u, arg, SIZE_MAX, "GNU.sparse.numbytes"))
{
if (st->sparse_map_avail == st->sparse_map_size)
- {
- st->sparse_map_size *= 2;
- st->sparse_map = xrealloc (st->sparse_map,
- st->sparse_map_size
- * sizeof st->sparse_map[0]);
- }
+ st->sparse_map = x2nrealloc (st->sparse_map,
+ &st->sparse_map_size,
+ sizeof st->sparse_map[0]);
+
st->sparse_map[st->sparse_map_avail++].numbytes = u;
}
}

View File

@ -1,351 +0,0 @@
--- tar-1.15.1/src/sparse.c.hugeSparse 2006-04-13 15:29:19.000000000 +0200
+++ tar-1.15.1/src/sparse.c 2006-04-13 15:32:29.000000000 +0200
@@ -47,9 +47,9 @@
{
int fd; /* File descriptor */
bool seekable; /* Is fd seekable? */
- size_t offset; /* Current offset in fd if seekable==false.
+ off_t offset; /* Current offset in fd if seekable==false.
Otherwise unused */
- size_t dumped_size; /* Number of bytes actually written
+ off_t dumped_size; /* Number of bytes actually written
to the archive */
struct tar_stat_info *stat_info; /* Information about the file */
struct tar_sparse_optab *optab;
@@ -59,35 +59,34 @@
/* Dump zeros to file->fd until offset is reached. It is used instead of
lseek if the output file is not seekable */
-static long
+static bool
dump_zeros (struct tar_sparse_file *file, off_t offset)
{
- char buf[BLOCKSIZE];
-
- if (offset - file->offset < 0)
+ static char const zero_buf[BLOCKSIZE];
+
+ if (offset < file->offset)
{
errno = EINVAL;
- return -1;
+ return false;
}
- memset (buf, 0, sizeof buf);
while (file->offset < offset)
{
- size_t size = offset - file->offset;
- size_t wrbytes;
-
- if (size > sizeof buf)
- size = sizeof buf;
- wrbytes = write (file->fd, buf, size);
+ size_t size = (BLOCKSIZE < offset - file->offset
+ ? BLOCKSIZE
+ : offset - file->offset);
+ ssize_t wrbytes;
+
+ wrbytes = write (file->fd, zero_buf, size);
if (wrbytes <= 0)
{
if (wrbytes == 0)
errno = EINVAL;
- return -1;
+ return false;
}
file->offset += wrbytes;
}
- return file->offset;
+ return true;
}
static bool
@@ -168,14 +167,9 @@
static bool
lseek_or_error (struct tar_sparse_file *file, off_t offset)
{
- off_t off;
-
- if (file->seekable)
- off = lseek (file->fd, offset, SEEK_SET);
- else
- off = dump_zeros (file, offset);
-
- if (off < 0)
+ if (file->seekable
+ ? lseek (file->fd, offset, SEEK_SET) < 0
+ : ! dump_zeros (file, offset))
{
seek_diag_details (file->stat_info->orig_file_name, offset);
return false;
@@ -187,7 +181,7 @@
it's made *entirely* of zeros, returning a 0 the instant it finds
something that is a nonzero, i.e., useful data. */
static bool
-zero_block_p (char *buffer, size_t size)
+zero_block_p (char const *buffer, size_t size)
{
while (size--)
if (*buffer++)
@@ -195,50 +189,36 @@
return true;
}
-#define clear_block(p) memset (p, 0, BLOCKSIZE);
-
-#define SPARSES_INIT_COUNT SPARSES_IN_SPARSE_HEADER
-
static void
-sparse_add_map (struct tar_sparse_file *file, struct sp_array *sp)
+sparse_add_map (struct tar_stat_info *st, struct sp_array const *sp)
{
- if (file->stat_info->sparse_map == NULL)
- {
- file->stat_info->sparse_map =
- xmalloc (SPARSES_INIT_COUNT * sizeof file->stat_info->sparse_map[0]);
- file->stat_info->sparse_map_size = SPARSES_INIT_COUNT;
- }
- else if (file->stat_info->sparse_map_avail == file->stat_info->sparse_map_size)
- {
- file->stat_info->sparse_map_size *= 2;
- file->stat_info->sparse_map =
- xrealloc (file->stat_info->sparse_map,
- file->stat_info->sparse_map_size
- * sizeof file->stat_info->sparse_map[0]);
- }
- file->stat_info->sparse_map[file->stat_info->sparse_map_avail++] = *sp;
+ struct sp_array *sparse_map = st->sparse_map;
+ size_t avail = st->sparse_map_avail;
+ if (avail == st->sparse_map_size)
+ st->sparse_map = sparse_map =
+ x2nrealloc (sparse_map, &st->sparse_map_size, sizeof *sparse_map);
+ sparse_map[avail] = *sp;
+ st->sparse_map_avail = avail + 1;
}
/* Scan the sparse file and create its map */
static bool
sparse_scan_file (struct tar_sparse_file *file)
{
- static char buffer[BLOCKSIZE];
+ struct tar_stat_info *st = file->stat_info;
+ int fd = file->fd;
+ char buffer[BLOCKSIZE];
size_t count;
off_t offset = 0;
struct sp_array sp = {0, 0};
if (!lseek_or_error (file, 0))
return false;
- clear_block (buffer);
-
- file->stat_info->sparse_map_avail = 0;
- file->stat_info->archive_file_size = 0;
if (!tar_sparse_scan (file, scan_begin, NULL))
return false;
- while ((count = safe_read (file->fd, buffer, sizeof buffer)) != 0
+ while ((count = safe_read (fd, buffer, sizeof buffer)) != 0
&& count != SAFE_READ_ERROR)
{
/* Analize the block */
@@ -246,7 +226,7 @@
{
if (sp.numbytes)
{
- sparse_add_map (file, &sp);
+ sparse_add_map (st, &sp);
sp.numbytes = 0;
if (!tar_sparse_scan (file, scan_block, NULL))
return false;
@@ -257,26 +237,25 @@
if (sp.numbytes == 0)
sp.offset = offset;
sp.numbytes += count;
- file->stat_info->archive_file_size += count;
+ st->archive_file_size += count;
if (!tar_sparse_scan (file, scan_block, buffer))
return false;
}
offset += count;
- clear_block (buffer);
}
if (sp.numbytes == 0)
sp.offset = offset;
- sparse_add_map (file, &sp);
- file->stat_info->archive_file_size += count;
+ sparse_add_map (st, &sp);
+ st->archive_file_size += count;
return tar_sparse_scan (file, scan_end, NULL);
}
-static struct tar_sparse_optab oldgnu_optab;
-static struct tar_sparse_optab star_optab;
-static struct tar_sparse_optab pax_optab;
+static struct tar_sparse_optab const oldgnu_optab;
+static struct tar_sparse_optab const star_optab;
+static struct tar_sparse_optab const pax_optab;
static bool
sparse_select_optab (struct tar_sparse_file *file)
@@ -321,18 +300,18 @@
size_t bytes_read;
blk = find_next_block ();
- memset (blk->buffer, 0, BLOCKSIZE);
bytes_read = safe_read (file->fd, blk->buffer, bufsize);
if (bytes_read == SAFE_READ_ERROR)
{
read_diag_details (file->stat_info->orig_file_name,
- file->stat_info->sparse_map[i].offset
- + file->stat_info->sparse_map[i].numbytes
- - bytes_left,
- bufsize);
+ (file->stat_info->sparse_map[i].offset
+ + file->stat_info->sparse_map[i].numbytes
+ - bytes_left),
+ bufsize);
return false;
}
+ memset (blk->buffer + bytes_read, 0, BLOCKSIZE - bytes_read);
bytes_left -= bytes_read;
file->dumped_size += bytes_read;
set_next_block_after (blk);
@@ -389,12 +368,11 @@
sparse_dump_file (int fd, struct tar_stat_info *st)
{
bool rc;
- struct tar_sparse_file file;
+ struct tar_sparse_file file = { 0, };
file.stat_info = st;
file.fd = fd;
file.seekable = true; /* File *must* be seekable for dump to work */
- file.offset = 0;
if (!sparse_select_optab (&file)
|| !tar_sparse_init (&file))
@@ -456,15 +434,15 @@
struct tar_sparse_file file;
size_t i;
+ if (!sparse_select_optab (&file)
+ || !tar_sparse_init (&file))
+ return dump_status_not_implemented;
+
file.stat_info = st;
file.fd = fd;
file.seekable = lseek (fd, 0, SEEK_SET) == 0;
file.offset = 0;
- if (!sparse_select_optab (&file)
- || !tar_sparse_init (&file))
- return dump_status_not_implemented;
-
rc = tar_sparse_decode_header (&file);
for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++)
rc = tar_sparse_extract_region (&file, i);
@@ -491,8 +469,6 @@
}
-static char diff_buffer[BLOCKSIZE];
-
static bool
check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end)
{
@@ -502,11 +478,9 @@
while (beg < end)
{
size_t bytes_read;
- size_t rdsize = end - beg;
+ size_t rdsize = BLOCKSIZE < end - beg ? BLOCKSIZE : end - beg;
+ char diff_buffer[BLOCKSIZE];
- if (rdsize > BLOCKSIZE)
- rdsize = BLOCKSIZE;
- clear_block (diff_buffer);
bytes_read = safe_read (file->fd, diff_buffer, rdsize);
if (bytes_read == SAFE_READ_ERROR)
{
@@ -539,6 +513,7 @@
{
size_t bytes_read;
size_t rdsize = (size_left > BLOCKSIZE) ? BLOCKSIZE : size_left;
+ char diff_buffer[BLOCKSIZE];
union block *blk = find_next_block ();
if (!blk)
@@ -551,9 +526,9 @@
if (bytes_read == SAFE_READ_ERROR)
{
read_diag_details (file->stat_info->orig_file_name,
- file->stat_info->sparse_map[i].offset
- + file->stat_info->sparse_map[i].numbytes
- - size_left,
+ (file->stat_info->sparse_map[i].offset
+ + file->stat_info->sparse_map[i].numbytes
+ - size_left),
rdsize);
return false;
}
@@ -647,7 +622,7 @@
|| file->stat_info->archive_file_size < 0)
return add_fail;
- sparse_add_map (file, &sp);
+ sparse_add_map (file->stat_info, &sp);
return add_ok;
}
@@ -669,7 +644,7 @@
size_t i;
union block *h = current_header;
int ext_p;
- static enum oldgnu_add_status rc;
+ enum oldgnu_add_status rc;
file->stat_info->sparse_map_avail = 0;
for (i = 0; i < SPARSES_IN_OLDGNU_HEADER; i++)
@@ -756,7 +731,7 @@
return true;
}
-static struct tar_sparse_optab oldgnu_optab = {
+static struct tar_sparse_optab const oldgnu_optab = {
NULL, /* No init function */
NULL, /* No done function */
oldgnu_sparse_member_p,
@@ -795,7 +770,7 @@
size_t i;
union block *h = current_header;
int ext_p;
- static enum oldgnu_add_status rc;
+ enum oldgnu_add_status rc;
file->stat_info->sparse_map_avail = 0;
@@ -837,7 +812,7 @@
}
-static struct tar_sparse_optab star_optab = {
+static struct tar_sparse_optab const star_optab = {
NULL, /* No init function */
NULL, /* No done function */
star_sparse_member_p,
@@ -890,7 +865,7 @@
return true;
}
-static struct tar_sparse_optab pax_optab = {
+static struct tar_sparse_optab const pax_optab = {
NULL, /* No init function */
NULL, /* No done function */
pax_sparse_member_p,

View File

@ -1,162 +0,0 @@
--- tar-1.15.1/src/sparse.c.lseek 2004-09-06 13:30:57.000000000 +0200
+++ tar-1.15.1/src/sparse.c 2005-04-15 10:33:17.990735744 +0200
@@ -46,6 +46,9 @@
struct tar_sparse_file
{
int fd; /* File descriptor */
+ bool seekable; /* Is fd seekable? */
+ size_t offset; /* Current offset in fd if seekable==false.
+ Otherwise unused */
size_t dumped_size; /* Number of bytes actually written
to the archive */
struct tar_stat_info *stat_info; /* Information about the file */
@@ -54,6 +57,39 @@
reqiure */
};
+/* Dump zeros to file->fd until offset is reached. It is used instead of
+ lseek if the output file is not seekable */
+static long
+dump_zeros (struct tar_sparse_file *file, off_t offset)
+{
+ char buf[BLOCKSIZE];
+
+ if (offset - file->offset < 0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset (buf, 0, sizeof buf);
+ while (file->offset < offset)
+ {
+ size_t size = offset - file->offset;
+ size_t wrbytes;
+
+ if (size > sizeof buf)
+ size = sizeof buf;
+ wrbytes = write (file->fd, buf, size);
+ if (wrbytes <= 0)
+ {
+ if (wrbytes == 0)
+ errno = EINVAL;
+ return -1;
+ }
+ file->offset += wrbytes;
+ }
+ return file->offset;
+}
+
static bool
tar_sparse_member_p (struct tar_sparse_file *file)
{
@@ -130,9 +166,16 @@
static bool
-lseek_or_error (struct tar_sparse_file *file, off_t offset, int whence)
+lseek_or_error (struct tar_sparse_file *file, off_t offset)
{
- if (lseek (file->fd, offset, whence) < 0)
+ off_t off;
+
+ if (file->seekable)
+ off = lseek (file->fd, offset, SEEK_SET);
+ else
+ off = dump_zeros (file, offset);
+
+ if (off < 0)
{
seek_diag_details (file->stat_info->orig_file_name, offset);
return false;
@@ -182,10 +225,10 @@
{
static char buffer[BLOCKSIZE];
size_t count;
- size_t offset = 0;
+ off_t offset = 0;
struct sp_array sp = {0, 0};
- if (!lseek_or_error (file, 0, SEEK_SET))
+ if (!lseek_or_error (file, 0))
return false;
clear_block (buffer);
@@ -269,8 +312,7 @@
union block *blk;
off_t bytes_left = file->stat_info->sparse_map[i].numbytes;
- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset,
- SEEK_SET))
+ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
while (bytes_left > 0)
@@ -304,8 +346,7 @@
{
size_t write_size;
- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset,
- SEEK_SET))
+ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
write_size = file->stat_info->sparse_map[i].numbytes;
@@ -313,7 +354,7 @@
if (write_size == 0)
{
/* Last block of the file is a hole */
- if (sys_truncate (file->fd))
+ if (file->seekable && sys_truncate (file->fd))
truncate_warn (file->stat_info->orig_file_name);
}
else while (write_size > 0)
@@ -330,6 +371,7 @@
count = full_write (file->fd, blk->buffer, wrbytes);
write_size -= count;
file->dumped_size += count;
+ file->offset += count;
if (count != wrbytes)
{
write_error_details (file->stat_info->orig_file_name,
@@ -351,7 +393,9 @@
file.stat_info = st;
file.fd = fd;
-
+ file.seekable = true; /* File *must* be seekable for dump to work */
+ file.offset = 0;
+
if (!sparse_select_optab (&file)
|| !tar_sparse_init (&file))
return dump_status_not_implemented;
@@ -414,7 +458,9 @@
file.stat_info = st;
file.fd = fd;
-
+ file.seekable = lseek (fd, 0, SEEK_SET) == 0;
+ file.offset = 0;
+
if (!sparse_select_optab (&file)
|| !tar_sparse_init (&file))
return dump_status_not_implemented;
@@ -450,7 +496,7 @@
static bool
check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end)
{
- if (!lseek_or_error (file, beg, SEEK_SET))
+ if (!lseek_or_error (file, beg))
return false;
while (beg < end)
@@ -486,8 +532,7 @@
{
size_t size_left;
- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset,
- SEEK_SET))
+ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
size_left = file->stat_info->sparse_map[i].numbytes;
while (size_left > 0)

View File

@ -1,46 +0,0 @@
--- tar-1.15.1/tests/testsuite.at.makeCheck 2004-12-21 13:41:40.000000000 +0100
+++ tar-1.15.1/tests/testsuite.at 2005-07-26 14:56:10.000000000 +0200
@@ -64,7 +64,7 @@
m4_include([options.at])
-m4_include([append.at])
+#m4_include([append.at])
m4_include([delete01.at])
m4_include([delete02.at])
@@ -87,7 +87,7 @@
m4_include([link01.at])
m4_include([listed01.at])
-m4_include([listed02.at])
+#m4_include([listed02.at])
m4_include([longv7.at])
--- tar-1.15.1/tests/pipe.at.makeCheck 2004-12-21 13:51:40.000000000 +0100
+++ tar-1.15.1/tests/pipe.at 2005-07-26 14:54:33.000000000 +0200
@@ -34,7 +34,7 @@
mkdir directory
genfile --length 10240 --pattern zeros > directory/file1
genfile --length 13 > directory/file2
-tar cf archive directory
+tar cf archive directory/file1 directory/file2
mv directory orig
cat archive | tar xfv -
echo "separator"
@@ -42,11 +42,10 @@
echo "separator"
cmp orig/file2 directory/file2],
[0],
-[directory/
-directory/file1
+[directory/file1
directory/file2
separator
separator
])
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP

View File

@ -1,11 +0,0 @@
--- tar-1.15.1/src/create.c.newerOption 2005-08-15 15:53:27.000000000 +0000
+++ tar-1.15.1/src/create.c 2005-08-15 15:53:51.000000000 +0000
@@ -1387,7 +1387,7 @@
&& OLDER_STAT_TIME (st->stat, m)
&& (!after_date_option || OLDER_STAT_TIME (st->stat, c)))
{
- if (!incremental_option)
+ if (!incremental_option && verbose_option)
WARN ((0, 0, _("%s: file is unchanged; not dumped"),
quotearg_colon (p)));
return;

View File

@ -1,14 +0,0 @@
--- tar-1.15.1/src/tar.c.optionsOrder 2006-04-24 15:25:55.000000000 +0200
+++ tar-1.15.1/src/tar.c 2006-04-24 15:27:01.000000000 +0200
@@ -617,9 +617,9 @@
switch (key)
{
- case 1:
+ case ARGP_KEY_ARG:
/* File name or non-parsed option, because of ARGP_IN_ORDER */
- name_add (optarg);
+ name_add (arg);
args->input_files++;
break;

View File

@ -1,22 +0,0 @@
--- tar-1.15.1/src/create.c.padCorrectly 2005-11-04 10:18:08.000000000 -0500
+++ tar-1.15.1/src/create.c 2005-11-04 10:21:05.000000000 -0500
@@ -877,8 +877,8 @@
return dump_status_short;
}
size_left -= count;
-
- set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
+ if (count)
+ set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
if (count != bufsize)
{
@@ -892,7 +892,7 @@
STRINGIFY_BIGINT (size_left, buf)));
if (! ignore_failed_read_option)
exit_status = TAREXIT_FAILURE;
- pad_archive (size_left);
+ pad_archive (size_left - (bufsize-count));
return dump_status_short;
}
}

View File

@ -1,36 +0,0 @@
--- tar-1.15.1/src/create.c.sparseTotals 2005-07-27 11:10:38.000000000 +0200
+++ tar-1.15.1/src/create.c 2005-07-27 11:10:50.000000000 +0200
@@ -332,16 +332,20 @@
}
-/* A file is not dumpable if
+/* A file is considered dumpable if it is sparse and both --sparse and --totals
+ are specified.
+ Otherwise, it is dumpable unless any of the following conditions occur:
+
a) it is empty *and* world-readable, or
b) current archive is /dev/null */
bool
file_dumpable_p (struct tar_stat_info *st)
{
- return !(dev_null_output
- || (st->archive_file_size == 0
- && (st->stat.st_mode & MODE_R) == MODE_R));
+ if (dev_null_output)
+ return totals_option && sparse_option && sparse_file_p (st);
+ return !(st->archive_file_size == 0
+ && (st->stat.st_mode & MODE_R) == MODE_R);
}
@@ -1437,7 +1441,7 @@
else
fd = -1;
- if (sparse_option && sparse_file_p (st))
+ if (fd != -1 && sparse_option && sparse_file_p (st))
{
status = sparse_dump_file (fd, st);
if (status == dump_status_not_implemented)

View File

@ -1,25 +1,16 @@
Summary: A GNU file archiving program.
Name: tar
Version: 1.15.1
Release: 16
Version: 1.15.90
Release: 1
License: GPL
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
Source0: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.gz
Source1: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.gz.sig
Source2: tar.1
Patch6: tar-1.14-nolibrt.patch
Patch8: tar-1.14-loneZeroWarning.patch
Patch9: tar-1.15.1-makeCheck.patch
Patch10: tar-1.15.1-gcc4.patch
Patch11: tar-1.15.1-lseek.patch
Patch12: tar-1.15.1-sparseTotals.patch
Patch13: tar-1.15.1-newerOption.patch
Patch14: tar-1.15.1-padCorrectly.patch
Patch15: tar-1.15.1-vfatTruncate.patch
Patch16: tar-1.15.1-heapOverflow.patch
Patch17: tar-1.15.1-hugeSparse.patch
Patch18: tar-1.15.1-optionsOrder.patch
Patch1: tar-1.14-nolibrt.patch
Patch2: tar-1.14-loneZeroWarning.patch
Patch3: tar-1.15.1-vfatTruncate.patch
Prereq: info
BuildRequires: autoconf automake gzip
@ -39,18 +30,9 @@ the rmt package.
%prep
%setup -q
%patch6 -p1 -b .nolibrt
%patch8 -p1 -b .loneZeroWarning
%patch9 -p1 -b .makeCheck
%patch10 -p1 -b .gcc4
%patch11 -p1 -b .lseek
%patch12 -p1 -b .sparseTotals
%patch13 -p1 -b .newerOption
%patch14 -p1 -b .padCorrectly
%patch15 -p1 -b .vfatTruncate
%patch16 -p0 -b .heapOverflow
%patch17 -p1 -b .hugeSparse
%patch18 -p1 -b .optionsOrder
#%patch1 -p1 -b .nolibrt
%patch2 -p1 -b .loneZeroWarning
%patch3 -p1 -b .vfatTruncate
%build
@ -121,6 +103,9 @@ fi
%{_infodir}/tar.info*
%changelog
* Tue Apr 25 2006 Peter Vrabec <pvrabec@redhat.com> 1.15.90-1
- upgrade
* Mon Apr 24 2006 Peter Vrabec <pvrabec@redhat.com> 1.15.1-16
- fix problem when options at the end of command line were
not recognized (#188707)