rebase: latest upstream release v1.30

Per upstream release notes:
http://lists.gnu.org/archive/html/info-gnu/2019-01/msg00001.html

Version: 1.31-1
This commit is contained in:
Pavel Raiskup 2019-01-10 09:09:28 +01:00
parent c0f09b684b
commit 3b055ef9f2
6 changed files with 10 additions and 246 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
/tar-1.30.tar.xz
/tar-1.30.tar.xz.sig
/tar-*.tar.xz
/tar-*.tar.xz.sig

View File

@ -1,2 +1,2 @@
SHA512 (tar-1.30.tar.xz) = 9c8b2cacf8f6ca1b19f788d4ec0410127c4d71e54b9c9cac99ee5af6c002189ccc521302955510bb22a54a069ffd00fc2de12ac776985cbbeb3f1ecf38a4f8d9
SHA512 (tar-1.30.tar.xz.sig) = 149bfb112aae05e1f40a26ab2570fef71cf736eac62bf3a1bc8df905270c745500fc82764867323e440c67b1dd7116f5b0e1fd1977be7f10b333d481da3355e8
SHA512 (tar-1.31.tar.xz) = 2185fbbe53d4fe3eb688ebc8c2fa800db2599a282c07007358d0a011394aafcf27a80600d044bb4fc299a172d3d95f953106be651db33eb6e5555bd24cad02aa
SHA512 (tar-1.31.tar.xz.sig) = bdf5e6280c07aceb3277b6f57e20a7de01124de5de24e9457738dd70f8702ac7487fb6161f9383db151c1bddb4e5fca8b016e72631ce7bced6b38cf5ca56b990

View File

@ -1,129 +0,0 @@
From b451bfd224da44e93cf842f23455d755e48421dd Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Mon, 28 Jul 2014 08:17:55 +0200
Subject: [PATCH 8/9] Fix for infinite loops during sparse file handling
Upstream bugreport (still downstream):
http://www.mail-archive.com/bug-tar@gnu.org/msg04432.html
Resolves: #1082608
---
THANKS | 1 +
src/sparse.c | 48 ++++++++++++++++++++++++++++++++----------------
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/THANKS b/THANKS
index b4c5427..e74f71c 100644
--- a/THANKS
+++ b/THANKS
@@ -175,6 +175,7 @@ Fabio d'Alessi cars@civ.bio.unipd.it
Frank Heckenbach frank@g-n-u.de
Frank Koenen koenfr@lidp.com
Franz-Werner Gergen gergen@edvulx.mpi-stuttgart.mpg.de
+François Ouellet fouell@gmail.com
François Pinard pinard@iro.umontreal.ca
Fritz Elfert fritz@fsun.triltsch.de
George Chyu gschyu@ccgate.dp.beckman.com
diff --git a/src/sparse.c b/src/sparse.c
index 6a97676..53c1868 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -301,6 +301,7 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i)
{
union block *blk;
off_t bytes_left = file->stat_info->sparse_map[i].numbytes;
+ const char *file_name = file->stat_info->orig_file_name;
if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
@@ -314,13 +315,23 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i)
bytes_read = safe_read (file->fd, blk->buffer, bufsize);
if (bytes_read == SAFE_READ_ERROR)
{
- read_diag_details (file->stat_info->orig_file_name,
+ read_diag_details (file_name,
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- bytes_left),
bufsize);
return false;
}
+ if (bytes_read == 0)
+ {
+ char buf[UINTMAX_STRSIZE_BOUND];
+ FATAL_ERROR ((0, 0,
+ ngettext ("%s: File shrank by %s byte",
+ "%s: File shrank by %s bytes",
+ bytes_left),
+ quotearg_colon (file_name),
+ offtostr (bytes_left, buf)));
+ }
memset (blk->buffer + bytes_read, 0, BLOCKSIZE - bytes_read);
bytes_left -= bytes_read;
@@ -475,33 +486,37 @@ sparse_skip_file (struct tar_stat_info *st)
static bool
check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end)
{
- if (!lseek_or_error (file, beg))
+ off_t offset = beg;
+
+ if (!lseek_or_error (file, offset))
return false;
- while (beg < end)
+ while (offset < end)
{
size_t bytes_read;
- size_t rdsize = BLOCKSIZE < end - beg ? BLOCKSIZE : end - beg;
+ size_t rdsize = BLOCKSIZE < end - offset ? BLOCKSIZE : end - offset;
char diff_buffer[BLOCKSIZE];
bytes_read = safe_read (file->fd, diff_buffer, rdsize);
if (bytes_read == SAFE_READ_ERROR)
{
read_diag_details (file->stat_info->orig_file_name,
- beg,
- rdsize);
- return false;
- }
- if (!zero_block_p (diff_buffer, bytes_read))
- {
- char begbuf[INT_BUFSIZE_BOUND (off_t)];
- report_difference (file->stat_info,
- _("File fragment at %s is not a hole"),
- offtostr (beg, begbuf));
+ offset, rdsize);
return false;
}
- beg += bytes_read;
+ if (bytes_read == 0
+ || !zero_block_p (diff_buffer, bytes_read))
+ {
+ char begbuf[INT_BUFSIZE_BOUND (off_t)];
+ const char *msg = bytes_read ? _("File fragment at %s is not a hole")
+ : _("Hole starting at %s is truncated");
+
+ report_difference (file->stat_info, msg, offtostr (beg, begbuf));
+ return false;
+ }
+
+ offset += bytes_read;
}
return true;
}
@@ -542,7 +557,8 @@ check_data_region (struct tar_sparse_file *file, size_t i)
file->dumped_size += bytes_read;
size_left -= bytes_read;
mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
- if (memcmp (blk->buffer, diff_buffer, rdsize))
+ if (bytes_read == 0
+ || memcmp (blk->buffer, diff_buffer, bytes_read))
{
report_difference (file->stat_info, _("Contents differ"));
return false;
--
1.9.3

View File

@ -1,15 +0,0 @@
Per https://www.mail-archive.com/bug-tar@gnu.org/msg05440.html
diff --git a/tests/difflink.at b/tests/difflink.at
index eadfb08..4e01176 100644
--- a/tests/difflink.at
+++ b/tests/difflink.at
@@ -21,7 +21,7 @@ mkdir a
genfile -f a/x
ln -s x a/y
ln a/y a/z
-tar cf a.tar a
+tar cf a.tar a/x a/y a/z
rm a/z
ln -s x a/z
tar df a.tar

View File

@ -1,93 +0,0 @@
From 298cfc4743b9cca6cc0c685b9fce5b34827bec1b Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Thu, 4 Jan 2018 18:21:27 +0100
Subject: [PATCH] tests: fix race in dirrem01 and dirrem02
Proposal:
https://www.mail-archive.com/bug-tar@gnu.org/msg05451.html
Previously the '--checkpoint-action=echo' was triggered after
'--checkpoint-action=sleep=1' - so the order of events *usually*
was (for --format='gnu'):
...
1. checkpoint handler before write of 'dir/sub' member
2. one-second delay
3. stderr write: 'tar: Write checkpoint 3'
4. write the member 'dir/sub' into the archive
5. check that the member's ctime has not been changed
6. genfile's detecting 'Write checkpoint', doing unlink
...
But sometimes, the genfile was fast enough to win the race and
unlinked the directory before the member was written into the
archive (IOW, the order was 1-2-3-6-4-5). This led to the
occasional warning 'tar: dir/sub: file changed as we read it'.
Swap the order of 'sleep=1' and 'echo' actions so the genfile
utility has (hopefully) enough time to do the unlink before
writing the file into the archive (enforce 1-2-3-6-4-5 order).
* tests/dirrem01.at: Swap 'sleep=1' and 'echo' actions.
* tests/dirrem02.at: Likewise.
---
tests/dirrem01.at | 5 +++--
tests/dirrem02.at | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/dirrem01.at b/tests/dirrem01.at
index 40344dc..dabc206 100644
--- a/tests/dirrem01.at
+++ b/tests/dirrem01.at
@@ -47,14 +47,15 @@ gnu) CPT=3;;
esac
genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
- tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
- --checkpoint-action='echo' -c -f archive.tar \
+ tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
+ --checkpoint-action='sleep=1' -c -f archive.tar \
--listed-incremental db -v dir >/dev/null
],
[1],
[ignore],
[tar: dir: Directory is new
tar: dir/sub: Directory is new
+tar: dir/sub: file changed as we read it
tar: dir/sub: File removed before we read it
],[],[],[gnu,posix])
diff --git a/tests/dirrem02.at b/tests/dirrem02.at
index e1cf9ef..924454f 100644
--- a/tests/dirrem02.at
+++ b/tests/dirrem02.at
@@ -20,7 +20,7 @@
# Description:
#
-# When an explicitley named directory disappears during creation
+# When an explicitly named directory disappears during creation
# of incremental dump, tar should still exit with TAREXIT_FAILURE (2).
#
# For further details see dirrem01.at
@@ -44,14 +44,15 @@ gnu) CPT=3;;
esac
genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
- tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
- --checkpoint-action='echo' -c -f archive.tar \
+ tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
+ --checkpoint-action='sleep=1' -c -f archive.tar \
--listed-incremental db -v dir dir/sub >/dev/null
],
[2],
[ignore],
[tar: dir: Directory is new
tar: dir/sub: Directory is new
+tar: dir/sub: file changed as we read it
tar: dir/sub: Cannot open: No such file or directory
tar: Exiting with failure status due to previous errors
],[],[],[gnu,posix])
--
2.14.3

View File

@ -4,8 +4,8 @@
Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.30
Release: 6%{?dist}
Version: 1.31
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@ -19,9 +19,6 @@ Patch2: tar-1.28-vfatTruncate.patch
Patch3: tar-1.29-wildcards.patch
Patch4: tar-1.28-atime-rofs.patch
Patch9: tar-1.28-document-exclude-mistakes.patch
Patch11: tar-1.28-sparse-inf-loops.patch
Patch12: tar-1.30-tests-difflink.patch
Patch13: tar-1.30-tests-dirrem.patch
BuildRequires: gcc
BuildRequires: autoconf automake texinfo gettext libacl-devel
@ -114,6 +111,10 @@ make check || (
%changelog
* Thu Jan 10 2019 Pavel Raiskup <praiskup@redhat.com> - 1.31-1
- the latest upstream release, per release notes
http://lists.gnu.org/archive/html/info-gnu/2019-01/msg00001.html
* Tue Aug 07 2018 Pavel Raiskup <praiskup@redhat.com> - 1.30-6
- use %%bcond_* for selinux, use %%make_* macros