Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package tar.16631 for 
openSUSE:Leap:15.2:Update checked in at 2021-07-04 12:06:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2:Update/tar.16631 (Old)
 and      /work/SRC/openSUSE:Leap:15.2:Update/.tar.16631.new.2625 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "tar.16631"

Sun Jul  4 12:06:25 2021 rev:1 rq:903354 version:1.30

Changes:
--------
New Changes file:

--- /dev/null   2021-06-17 12:39:55.005330521 +0200
+++ /work/SRC/openSUSE:Leap:15.2:Update/.tar.16631.new.2625/tar.changes 
2021-07-04 12:06:26.102357280 +0200
@@ -0,0 +1,821 @@
+-------------------------------------------------------------------
+Wed Jun  9 12:19:07 UTC 2021 - Wolfgang Frisch <wolfgang.fri...@suse.com>
+
+- Link /var/lib/tests/tar/bin/genfile as Position-Independent Executable
+  (bsc#1184124).
+  + tar-PIE.patch 
+
+-------------------------------------------------------------------
+Mon Mar 15 12:59:59 UTC 2021 - pgaj...@suse.com
+
+- security update
+- added patches
+  fix CVE-2021-20193 [bsc#1181131], Memory leak in read_header() in list.c
+  + tar-CVE-2021-20193.patch
+
+-------------------------------------------------------------------
+Mon Mar 25 16:17:59 UTC 2019 - Krist??na Streitov?? <kstreit...@suse.com>
+
+- add tar-1.30-CVE-2018-20482.patch to fix a security issue where
+  tar when "--sparse" option is used, mishandles file shrinkage
+  during read access, which allows local users to cause a denial
+  of service (infinite read loop in sparse_dump_region in sparse.c)
+  by modifying a file that is supposed to be archived by a different
+  user's process [bsc#1120610] [CVE-2018-20482]
+- add tar-1.30-CVE-2019-9923.patch to fix a security issue where
+  pax_decode_header in sparse.c in tar had a NULL pointer
+  dereference when parsing certain archives that have malformed
+  extended headers [bsc#1130496] [CVE-2019-9923]
+
+-------------------------------------------------------------------
+Fri May 11 10:41:40 UTC 2018 - kstreit...@suse.com
+
+- add tar-1.30-tests_dirrem_race.patch to fix race in dirrem01 and
+  dirrem02 tests that were passing/failing randomly because of that
+- run spec-cleaner
+- renumber patches
+
+-------------------------------------------------------------------
+Tue Apr  3 14:58:19 CEST 2018 - ku...@suse.de
+
+- Use %license instead of %doc [bsc#1082318]
+
+-------------------------------------------------------------------
+Thu Jan  4 13:24:20 UTC 2018 - kstreit...@suse.com
+
+- add tar-1.30-tests-difflink.patch to fix difflink.at test
+  (https://www.mail-archive.com/bug-tar@gnu.org/msg05440.html) 
+
+-------------------------------------------------------------------
+Mon Dec 18 03:45:51 UTC 2017 - avin...@opensuse.org
+
+- GNU tar 1.30:
+  * Member names containing '..' components are now skipped when
+    extracting.
+  * Report erroneous use of position-sensitive options.
+  * --numeric-owner now affects private headers too.
+  * Fixed the --delay-directory-restore option
+  * The --warnings=failed-read option
+  * The --warnings=none option now suppresses all warnings
+  * Fix reporting of hardlink mismatches during compare
+- cleanup with spec-cleaner
+- switch all urls to https
+- drop upstreamed patches
+  * add-return-values-to-backup-scripts.patch
+  * tar-1.29-extract_pathname_bypass.patch
+- rebase add_readme-tests.patch
+
+-------------------------------------------------------------------
+Thu Apr 20 13:58:56 UTC 2017 - kstreit...@suse.com
+
+- remove tar-1.26-remove_O_NONBLOCK.patch as this issue was fixed
+  in tar 1.27 (commit 03858cf583ce299b836d8a848967ce290a6bf303)
+
+-------------------------------------------------------------------
+Mon Apr  3 11:08:23 UTC 2017 - sv...@svalx.net
+
+- Use update-alternatives according to current documentation
+
+-------------------------------------------------------------------
+Thu Mar 27 21:04:03 UTC 2017 - sv...@svalx.net
+
+- Disable tar-1.26-remove_O_NONBLOCK.patch - this issue has been
+  fixed in tar-1.27
+- backup-scripts subpackage change to noarch
+- Change rpm group of tar-tests to Development/Tools/Other 
+- Enable rmt building, change package description
+- Switch rmt to alternatives system
+- Separate rmt subpackage - it can be used by different archiving
+  tools as a dedicated program
+- Change rmt path to /usr/bin folder - it can be used by non privileged
+  users for backup purposes. Security is controlled by access rights to
+  the targets and remote shell.
+- Separate doc subpackage
+- Remove conditions for old SUSE builds and lang subpackage
+- Rename restore script to restore.sh for avoiding file conflicts
+  with dump/restore
+
+-------------------------------------------------------------------
+Thu Mar 23 13:52:13 UTC 2017 - kstreit...@suse.com
+
+- move binaries from /bin to /usr/bin [bsc#1029977]
+  * refresh tar-backup-spec-fix-paths.patch to change path of the
+    tar binary from TAR=/bin/tar to TAR=/usr/bin/tar
+- use spec-cleaner 
+
+-------------------------------------------------------------------
+Thu Dec 15 17:05:04 UTC 2016 - vci...@suse.com
+
+- update tar-1.29-extract_pathname_bypass.patch to the upstream
+  one that fixes POINTYFEATHER issue but it doesn't limit append or
+  create operations as the initial patch did [bsc#1012633]
+  [CVE-2016-6321]
+
+-------------------------------------------------------------------
+Tue Nov  8 17:50:44 UTC 2016 - kstreit...@suse.com
+
+- add tar-1.29-extract_pathname_bypass.patch to fix POINTYFEATHER
+  vulnerability - GNU tar archiver can be tricked into extracting 
+  files and directories in the given destination, regardless of the 
+  path name(s) specified on the command line [bsc#1007188] 
+  [CVE-2016-6321] 
+
+-------------------------------------------------------------------
+Sat May 28 19:06:33 UTC 2016 - astie...@suse.com
+
+- GNU tar 1.29:
+  * New options: --verbatim-files-from, --no-verbatim-files-from
+  * --null option reads file names verbatim
+  * New options: --owner-map=FILE and --group-map=FILE
+  * New option --clamp-mtime
+  * Deprecated --preserve option removed
+  * Sparse file detection - now uses SEEK_DATA/SEEK_HOLE on
+    systems that support it. This allows for considerable speed-up
+    in sparse-file detection. New option --hole-detection for
+    algorithm selection.
+
+-------------------------------------------------------------------
+Wed Mar 23 09:37:44 UTC 2016 - sv...@svalx.net
+
+- Add add-return-values-to-backup-scripts.patch
+
+-------------------------------------------------------------------
+Mon Apr 13 10:37:40 UTC 2015 - vci...@suse.com
+
+- Revert tar-recursive--files-from.patch because it causes regression
+  (bnc#918487, bnc#919233)
+
+-------------------------------------------------------------------
+Mon Feb  9 14:00:15 UTC 2015 - vci...@suse.com
+
+- extract files recursively with --files-from (bnc#913058)
+  * added tar-recursive--files-from.patch
+- call autoreconf in %prep
+
+-------------------------------------------------------------------
+Sun Dec 21 12:33:22 UTC 2014 - meiss...@suse.com
+
+- build with PIE
+
+-------------------------------------------------------------------
+Thu Nov 20 19:13:19 UTC 2014 - andreas.stie...@gmx.de
+
+- compile in ACLs, Xattr and selinux support [boo#906413]
+
+-------------------------------------------------------------------
+Fri Aug 29 19:36:40 UTC 2014 - jeng...@inai.de
+
+- Improve on RPM group classification
+
+-------------------------------------------------------------------
+Sat Aug  2 23:32:30 UTC 2014 - andreas.stie...@gmx.de
+
+- GNU tar 1.28:
+  * New --checkpoint-action=totals
+  * Extended checkpoint format specification
+  * New option --one-top-level
+  * New option --sort
+  * New exclusion options:
+    --exclude-ignore=FILE
+    --exclude-ignore-recursive=FILE
+    --exclude-vcs-ignores
+  * refuses to read input from and write output to a tty
+- packaging changes:
+  * adjust patch for context change: add_readme-tests.patch
+  * remove patch applied upstream:
+    tar-fix_eternal_loop_in_handle_option.patch
+
+-------------------------------------------------------------------
+Mon Jul 28 20:01:53 UTC 2014 - vci...@suse.com
+
+- don't print lone zero blocks warning (bnc#881863)
+  * there are many tar implementations around that create invalid
+    archives with a zero block in the middle
+  * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=235820
+  * added tar-ignore_lone_zero_blocks.patch from Fedora
+
+-------------------------------------------------------------------
++++ 624 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:Leap:15.2:Update/.tar.16631.new.2625/tar.changes

New:
----
  add_readme-tests.patch
  paxutils-rtapelib_mtget.patch
  tar-1.30-CVE-2018-20482.patch
  tar-1.30-CVE-2019-9923.patch
  tar-1.30-tests-difflink.patch
  tar-1.30-tests_dirrem_race.patch
  tar-1.30.tar.bz2
  tar-1.30.tar.bz2.sig
  tar-CVE-2021-20193.patch
  tar-PIE.patch
  tar-backup-spec-fix-paths.patch
  tar-ignore_lone_zero_blocks.patch
  tar-recursive--files-from.patch
  tar-wildcards.patch
  tar.changes
  tar.keyring
  tar.spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ tar.spec ++++++
#
# spec file for package tar
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# For correct subpackages docs installation into tar doc directory
%global _docdir_fmt %{name}
Name:           tar
Version:        1.30
Release:        0
Summary:        GNU implementation of ((t)ape (ar)chiver)
License:        GPL-3.0-or-later
Group:          Productivity/Archiving/Backup
Url:            https://www.gnu.org/software/tar/
Source0:        https://ftp.gnu.org/gnu/tar/%{name}-%{version}.tar.bz2
Source1:        https://ftp.gnu.org/gnu/tar/%{name}-%{version}.tar.bz2.sig
# http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0x3602B07F55D0C732
Source2:        %{name}.keyring
Patch0:         %{name}-wildcards.patch
Patch1:         %{name}-backup-spec-fix-paths.patch
Patch2:         paxutils-rtapelib_mtget.patch
# don't print warning about zero blocks
# the patch is used in Fedora and Debian
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=235820
Patch3:         %{name}-ignore_lone_zero_blocks.patch
# The next patch is disabled because it causes a regression:
#https://bugzilla.opensuse.org/show_bug.cgi?id=918487
Patch4:         %{name}-recursive--files-from.patch
Patch5:         add_readme-tests.patch
# PATCH-FIX-UPSTREAM kstreit...@suse.com -- fix difflink.at test
Patch6:         tar-1.30-tests-difflink.patch
# PATCH-FIX-UPSTREAM kstreit...@suse.com -- fix race in dirrem01 and dirrem02 
tests
Patch7:         tar-1.30-tests_dirrem_race.patch
# PATCH-FIX-UPSTREAM kstreit...@suse.com --  "--sparse" mishandles file 
shrinkage during read access
Patch8:         tar-1.30-CVE-2018-20482.patch
# PATCH-FIX-UPSTREAM kstreit...@suse.com -- null-pointer dereference in 
pax_decode_header in sparse.c
Patch9:         tar-1.30-CVE-2019-9923.patch
# CVE-2021-20193 [bsc#1181131], Memory leak in read_header() in list.c
Patch10:         tar-CVE-2021-20193.patch
# [bsc#1184124], link all executables as PIE
Patch11:        tar-PIE.patch
BuildRequires:  automake
BuildRequires:  libacl-devel
BuildRequires:  libattr-devel
BuildRequires:  libselinux-devel
Requires(pre):  info
Recommends:     %{name}-lang = %{version}
Recommends:     %{name}-rmt = %{version}
Recommends:     mt
Recommends:     xz
Provides:       base:/bin/tar

%description
GNU Tar is an archiver program. It is used to create and manipulate files
that are actually collections of many other files; the program provides
users with an organized and systematic method of controlling a large amount
of data. Despite its name, that is an acronym of "tape archiver", GNU Tar
is able to direct its output to any available devices, files or other programs,
it may as well access remote devices or files.

%package backup-scripts
Summary:        Backup scripts
Group:          Productivity/Archiving/Backup
Requires:       %{name} = %{version}
BuildArch:      noarch

%description backup-scripts
Shell scripts for system backup/restore

%package tests
Summary:        Tests for the package
Group:          Development/Tools/Other
Requires:       %{name} = %{version}

%description tests
Upstream testsuite for the package

%package rmt
Summary:        Remote tape drive control server by GNU
Group:          Productivity/Archiving/Backup
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       rmt

%description rmt
Provides remote access to files and devices for tar, cpio
and similar backup utilities

%package doc
Summary:        Documentation files for GNU tar
Group:          Documentation/Man
Requires:       %{name} = %{version}
Requires(post): %{install_info_prereq}
Requires(preun): %{install_info_prereq}
BuildArch:      noarch

%description doc
GNU Tar is an archiver program. It is used to create and manipulate files
that are actually collections of many other files; the program provides
users with an organized and systematic method of controlling a large amount
of data. Despite its name, that is an acronym of "tape archiver", GNU Tar
is able to direct its output to any available devices, files or other programs,
it may as well access remote devices or files.

%lang_package

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
#%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1

%build
%define my_cflags -W -Wall -Wpointer-arith -Wstrict-prototypes 
-Wformat-security -Wno-unused-parameter -fPIE
export CFLAGS="%{optflags} %{my_cflags}"
export RSH=%{_bindir}/ssh
export DEFAULT_ARCHIVE_FORMAT="POSIX"
export DEFAULT_RMT_DIR=%{_bindir}
autoreconf -fi
%configure \
        gl_cv_func_linkat_follow="yes" \
        --enable-backup-scripts \
        --disable-silent-rules \
        --program-transform-name='s/^rmt$/gnurmt/'
make %{?_smp_mflags} LDFLAGS="-pie"
cd tests
make %{?_smp_mflags} genfile
mkdir bin
mv genfile bin
cd -

%check
%if !0%{?qemu_user_space_build:1}
# Checks disabled in qemu because of races happening when we emulate
# multi-threaded programs
make %{?_smp_mflags} check
%endif

%install
%make_install DESTDIR=%{buildroot}
mkdir %{buildroot}/bin
mv %{buildroot}%{_mandir}/man8/gnurmt.8 %{buildroot}%{_mandir}/man1/gnurmt.1
install -D -m 644 scripts/backup-specs 
%{buildroot}%{_sysconfdir}/backup/backup-specs
# For avoiding file conflicts with dump/restore
mv %{buildroot}%{_sbindir}/restore %{buildroot}%{_sbindir}/restore.sh
rm -f %{buildroot}%{_infodir}/dir
install -D -m 644 -t %{buildroot}%{_docdir}/%{name} README* ABOUT-NLS AUTHORS 
NEWS THANKS \
                                                        ChangeLog TODO
install -d -m 755 %{buildroot}%{_localstatedir}/lib/tests
cp -r tests %{buildroot}%{_localstatedir}/lib/tests/tar
rm %{buildroot}%{_localstatedir}/lib/tests/tar/*.{c,h,o}
rm %{buildroot}%{_localstatedir}/lib/tests/tar/package.m4
rm %{buildroot}%{_localstatedir}/lib/tests/tar/{atconfig,atlocal,Makefile}*
# Alternatives system
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -sf %{_sysconfdir}/alternatives/rmt %{buildroot}%{_bindir}/rmt
ln -sf %{_sysconfdir}/alternatives/rmt.1%{ext_man} 
%{buildroot}%{_mandir}/man1/rmt.1%{ext_man}
#UsrMerge
mkdir -p %{buildroot}/bin
ln -s %{_bindir}/%{name} %{buildroot}/bin
#EndUsrMerge
%find_lang %{name}

%post doc
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}

%post rmt
%{_sbindir}/update-alternatives --force \
    --install %{_bindir}/rmt rmt %{_bindir}/gnurmt 10 \
    --slave %{_mandir}/man1/rmt.1%{ext_man} rmt.1%{ext_man} 
%{_mandir}/man1/gnurmt.1%{ext_man}

%preun doc
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}

%postun rmt
if [ ! -f %{_bindir}/gnurmt ] ; then
   "%{_sbindir}/update-alternatives" --remove rmt %{_bindir}/gnurmt
fi

%files backup-scripts
%{_sbindir}/backup
%{_sbindir}/restore.sh
%{_libexecdir}/backup.sh
%{_libexecdir}/dump-remind
%dir %{_sysconfdir}/backup
%config(noreplace) %{_sysconfdir}/backup/backup-specs

%files lang -f %{name}.lang

%files tests
%{_localstatedir}/lib/tests
%{_docdir}/%{name}/README-tests

%files rmt
%ghost %{_bindir}/rmt
%{_bindir}/gnurmt
%ghost %{_mandir}/man1/rmt.1%{ext_man}
%{_mandir}/man1/gnurmt.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/rmt
%ghost %{_sysconfdir}/alternatives/rmt.1%{ext_man}

%files doc
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/NEWS
%{_docdir}/%{name}/README
%{_docdir}/%{name}/ABOUT-NLS
%{_docdir}/%{name}/AUTHORS
%{_docdir}/%{name}/THANKS
%{_docdir}/%{name}/ChangeLog
%{_docdir}/%{name}/TODO
%{_infodir}/%{name}.info*

%files
%license COPYING
#UsrMerge
/bin/%{name}
#EndUsrMerge
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}

%changelog
++++++ add_readme-tests.patch ++++++
diff -ruN a/Makefile.in b/Makefile.in
--- a/Makefile.in       2017-12-22 20:14:53.900579664 -0500
+++ b/Makefile.in       2017-12-22 20:21:21.363943130 -0500
@@ -122,7 +122,7 @@
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-DIST_COMMON = $(srcdir)/Make.rules INSTALL NEWS README AUTHORS \
+DIST_COMMON = $(srcdir)/Make.rules INSTALL NEWS README README-tests AUTHORS \
        ChangeLog THANKS $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
        $(top_srcdir)/configure $(am__configure_deps) \
        $(srcdir)/config.h.in ABOUT-NLS COPYING TODO build-aux/ar-lib \
diff -ruN a/README-tests b/README-tests
--- a/README-tests      1969-12-31 19:00:00.000000000 -0500
+++ b/README-tests      2017-12-22 20:21:59.706691355 -0500
@@ -0,0 +1,22 @@
+Subpackage tar-tests
+====================
+
+The tar-tests package contains the testsuite which is included in tar sources.
+The testsuite is normally run during make phase (make check) and is also
+automatically run when the tar rpm is being build (in %check section of spec
+file).
+
+Normally, there is no reason to need the tar-tests package. It can however be
+used to verify, that tar functions properly in an installed system (e.g. to
+find issues in tar's dependencies, problems with incompatible libraries, etc.).
+
+Testsuite is installed into /var/lib/tests/tar
+
+To run the testsuite:
+
+cd /var/lib/tests/tar
+./testsuite --help # show options
+
+# needed for genfile binary used in tests
+./testsuite AUTOTEST_PATH=/var/lib/tests/tar/bin [other options]
+
++++++ paxutils-rtapelib_mtget.patch ++++++
Index: cpio-2.11/lib/rtapelib.c
===================================================================
--- cpio-2.11.orig/lib/rtapelib.c       2013-07-23 13:18:27.119431054 +0200
+++ cpio-2.11/lib/rtapelib.c    2013-07-23 13:19:35.728188104 +0200
@@ -710,7 +710,7 @@ rmt_ioctl__ (int handle, int operation,
            || (status = get_status (handle), status == -1))
          return -1;
 
-       if (status > sizeof (struct mtop))
+       if (status > sizeof (struct mtget))
          {
            errno = EOVERFLOW;
            return -1;
++++++ tar-1.30-CVE-2018-20482.patch ++++++
>From c15c42ccd1e2377945fd0414eca1a49294bff454 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <g...@gnu.org>
Date: Thu, 27 Dec 2018 17:48:57 +0200
Subject: Fix CVE-2018-20482

* NEWS: Update.
* src/sparse.c (sparse_dump_region): Handle short read condition.
(sparse_extract_region,check_data_region): Fix dumped_size calculation.
Handle short read condition.
(pax_decode_header): Fix dumped_size calculation.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.

* tests/sptrcreat.at: New file.
* tests/sptrdiff00.at: New file.
* tests/sptrdiff01.at: New file.
---
 src/sparse.c        | 50 ++++++++++++++++++++++++++++++++++++------
 tests/Makefile.am   |  5 ++++-
 tests/sptrcreat.at  | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/sptrdiff00.at | 55 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/sptrdiff01.at | 55 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/testsuite.at  |  5 ++++-
 7 files changed, 231 insertions(+), 9 deletions(-)
 create mode 100644 tests/sptrcreat.at
 create mode 100644 tests/sptrdiff00.at
 create mode 100644 tests/sptrdiff01.at

diff --git a/src/sparse.c b/src/sparse.c
index d41c0ea..f611200 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -1,6 +1,6 @@
 /* Functions for dealing with sparse files
 
-   Copyright 2003-2007, 2010, 2013-2017 Free Software Foundation, Inc.
+   Copyright 2003-2007, 2010, 2013-2018 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -427,6 +427,30 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i)
                             bufsize);
          return false;
        }
+      else if (bytes_read == 0)
+       {
+         char buf[UINTMAX_STRSIZE_BOUND];
+         struct stat st;
+         size_t n;
+         if (fstat (file->fd, &st) == 0)
+           n = file->stat_info->stat.st_size - st.st_size;
+         else
+           n = file->stat_info->stat.st_size
+             - (file->stat_info->sparse_map[i].offset
+                + file->stat_info->sparse_map[i].numbytes
+                - bytes_left);
+         
+         WARNOPT (WARN_FILE_SHRANK,
+                  (0, 0,
+                   ngettext ("%s: File shrank by %s byte; padding with zeros",
+                             "%s: File shrank by %s bytes; padding with zeros",
+                             n),
+                   quotearg_colon (file->stat_info->orig_file_name),
+                   STRINGIFY_BIGINT (n, buf)));
+         if (! ignore_failed_read_option)
+           set_exit_status (TAREXIT_DIFFERS);
+         return false;
+       }
 
       memset (blk->buffer + bytes_read, 0, BLOCKSIZE - bytes_read);
       bytes_left -= bytes_read;
@@ -464,9 +488,9 @@ sparse_extract_region (struct tar_sparse_file *file, size_t 
i)
          return false;
        }
       set_next_block_after (blk);
+      file->dumped_size += BLOCKSIZE;
       count = blocking_write (file->fd, blk->buffer, wrbytes);
       write_size -= count;
-      file->dumped_size += count;
       mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
       file->offset += count;
       if (count != wrbytes)
@@ -598,6 +622,12 @@ check_sparse_region (struct tar_sparse_file *file, off_t 
beg, off_t end)
                             rdsize);
          return false;
        }
+      else if (bytes_read == 0)
+       {
+         report_difference (file->stat_info, _("Size differs"));
+         return false;
+       }
+      
       if (!zero_block_p (diff_buffer, bytes_read))
        {
          char begbuf[INT_BUFSIZE_BOUND (off_t)];
@@ -609,6 +639,7 @@ check_sparse_region (struct tar_sparse_file *file, off_t 
beg, off_t end)
 
       beg += bytes_read;
     }
+
   return true;
 }
 
@@ -635,6 +666,7 @@ check_data_region (struct tar_sparse_file *file, size_t i)
          return false;
        }
       set_next_block_after (blk);
+      file->dumped_size += BLOCKSIZE;      
       bytes_read = safe_read (file->fd, diff_buffer, rdsize);
       if (bytes_read == SAFE_READ_ERROR)
        {
@@ -645,7 +677,11 @@ check_data_region (struct tar_sparse_file *file, size_t i)
                             rdsize);
          return false;
        }
-      file->dumped_size += bytes_read;
+      else if (bytes_read == 0)
+       {
+         report_difference (&current_stat_info, _("Size differs"));
+         return false;
+       }
       size_left -= bytes_read;
       mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
       if (memcmp (blk->buffer, diff_buffer, rdsize))
@@ -1213,7 +1249,8 @@ pax_decode_header (struct tar_sparse_file *file)
       union block *blk;
       char *p;
       size_t i;
-
+      off_t start;
+      
 #define COPY_BUF(b,buf,src) do                                     \
  {                                                                 \
    char *endp = b->buffer + BLOCKSIZE;                             \
@@ -1229,7 +1266,6 @@ pax_decode_header (struct tar_sparse_file *file)
        if (src == endp)                                            \
         {                                                         \
           set_next_block_after (b);                               \
-           file->dumped_size += BLOCKSIZE;                         \
            b = find_next_block ();                                 \
            src = b->buffer;                                        \
           endp = b->buffer + BLOCKSIZE;                           \
@@ -1240,8 +1276,8 @@ pax_decode_header (struct tar_sparse_file *file)
    dst[-1] = 0;                                                    \
  } while (0)
 
+      start = current_block_ordinal ();
       set_next_block_after (current_header);
-      file->dumped_size += BLOCKSIZE;
       blk = find_next_block ();
       p = blk->buffer;
       COPY_BUF (blk,nbuf,p);
@@ -1278,6 +1314,8 @@ pax_decode_header (struct tar_sparse_file *file)
          sparse_add_map (file->stat_info, &sp);
        }
       set_next_block_after (blk);
+
+      file->dumped_size += BLOCKSIZE * (current_block_ordinal () - start);
     }
 
   return true;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fb46325..7f9294f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
 # Makefile for GNU tar regression tests.
 
-# Copyright 1996-1997, 1999-2001, 2003-2007, 2009, 2012-2015 Free Software
+# Copyright 1996-1997, 1999-2001, 2003-2007, 2009, 2012-2018 Free Software
 
 # This file is part of GNU tar.
 
@@ -238,6 +238,9 @@ TESTSUITE_AT = \
  spmvp00.at\
  spmvp01.at\
  spmvp10.at\
+ sptrcreat.at\
+ sptrdiff00.at\
+ sptrdiff01.at\
  time01.at\
  time02.at\
  truncate.at\
diff --git a/tests/sptrcreat.at b/tests/sptrcreat.at
new file mode 100644
index 0000000..8e28f0e
--- /dev/null
+++ b/tests/sptrcreat.at
@@ -0,0 +1,62 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU tar.
+# Copyright 2018 Free Software Foundation, Inc.
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Tar up to 1.30 would loop endlessly if a sparse file had been truncated
+# while being archived (with --sparse flag).
+#
+# The bug has been assigned id CVE-2018-20482 (on the grounds that it is a
+# denial of service possibility).
+# 
+# Reported by: Chris Siebenmann <cks.gnutar...@cs.toronto.edu>
+# References: <20181226223948.781eb320...@apps1.cs.toronto.edu>,
+#   <http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00023.html>
+#   <https://utcc.utoronto.ca/~cks/space/blog/sysadmin/TarFindingTruncateBug>
+#   <https://nvd.nist.gov/vuln/detail/CVE-2018-20482>
+
+AT_SETUP([sparse file truncated while archiving])
+AT_KEYWORDS([truncate filechange sparse sptr sptrcreat])
+
+AT_TAR_CHECK([
+genfile --sparse --block-size=1024 --file foo \
+  0 ABCDEFGHIJ 1M ABCDEFGHIJ 10M ABCDEFGHIJ 200M ABCDEFGHIJ
+genfile --file baz
+genfile --run --checkpoint 3 --length 200m --truncate foo -- \
+ tar --checkpoint=1 \
+     --checkpoint-action=echo \
+     --checkpoint-action=sleep=1 \
+     --sparse -vcf bar foo baz
+echo Exit status: $?
+echo separator
+genfile --file foo --seek 200m --length 11575296 --pattern=zeros
+tar dvf bar],
+[1],
+[foo
+baz
+Exit status: 1
+separator
+foo
+foo: Mod time differs
+baz
+],
+[tar: foo: File shrank by 11575296 bytes; padding with zeros
+],
+[],[],[posix, gnu, oldgnu])
+
+AT_CLEANUP
diff --git a/tests/sptrdiff00.at b/tests/sptrdiff00.at
new file mode 100644
index 0000000..c410561
--- /dev/null
+++ b/tests/sptrdiff00.at
@@ -0,0 +1,55 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2018 Free Software Foundation, Inc.
+#
+# This file is part of GNU tar.
+#
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# While fixing CVE-2018-20482 (see sptrcreat.at) it has been discovered
+# that similar bug exists in file checking code (tar d). 
+# This test case checks if tar correctly handles a short read condition
+# appearing in check_sparse_region.
+
+AT_SETUP([file truncated in sparse region while comparing])
+AT_KEYWORDS([truncate filechange sparse sptr sptrdiff diff])
+
+# This triggers short read in check_sparse_region.
+AT_TAR_CHECK([
+genfile --sparse --block-size=1024 --file foo \
+  0 ABCDEFGHIJ 1M ABCDEFGHIJ 10M ABCDEFGHIJ 200M ABCDEFGHIJ
+genfile --file baz
+echo creating
+tar --sparse -vcf bar foo baz
+echo comparing
+genfile --run --checkpoint 3 --length 200m --truncate foo -- \
+ tar --checkpoint=1 \
+     --checkpoint-action=echo='Write checkpoint %u' \
+     --checkpoint-action=sleep=1 \
+     --sparse -vdf bar 
+],
+[1],
+[creating
+foo
+baz
+comparing
+foo
+foo: Size differs
+baz
+],
+[],
+[],[],[posix, gnu, oldgnu])
+
+AT_CLEANUP
diff --git a/tests/sptrdiff01.at b/tests/sptrdiff01.at
new file mode 100644
index 0000000..2da2267
--- /dev/null
+++ b/tests/sptrdiff01.at
@@ -0,0 +1,55 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2018 Free Software Foundation, Inc.
+#
+# This file is part of GNU tar.
+#
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# While fixing CVE-2018-20482 (see sptrcreat.at) it has been discovered
+# that similar bug exists in file checking code (tar d). 
+# This test case checks if tar correctly handles a short read condition
+# appearing in check_data_region.
+
+AT_SETUP([file truncated in data region while comparing])
+AT_KEYWORDS([truncate filechange sparse sptr sptrdiff diff])
+
+# This triggers short read in check_data_region.
+AT_TAR_CHECK([
+genfile --sparse --block-size=1024 --file foo \
+  0 ABCDEFGHIJ 1M ABCDEFGHIJ 10M ABCDEFGHIJ 200M ABCDEFGHIJ
+genfile --file baz
+echo creating
+tar --sparse -vcf bar foo baz
+echo comparing
+genfile --run --checkpoint 5 --length 221278210 --truncate foo -- \
+ tar --checkpoint=1 \
+     --checkpoint-action=echo='Write checkpoint %u' \
+     --checkpoint-action=sleep=1 \
+     --sparse -vdf bar 
+],
+[1],
+[creating
+foo
+baz
+comparing
+foo
+foo: Size differs
+baz
+],
+[],
+[],[],[posix, gnu, oldgnu])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index dcccc7b..0f5cca3 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,7 +1,7 @@
 # Process this file with autom4te to create testsuite. -*- Autotest -*-
 
 # Test suite for GNU tar.
-# Copyright 2004-2008, 2010-2017 Free Software Foundation, Inc.
+# Copyright 2004-2008, 2010-2018 Free Software Foundation, Inc.
 
 # This file is part of GNU tar.
 
@@ -416,6 +416,9 @@ m4_include([sparsemv.at])
 m4_include([spmvp00.at])
 m4_include([spmvp01.at])
 m4_include([spmvp10.at])
+m4_include([sptrcreat.at])
+m4_include([sptrdiff00.at])
+m4_include([sptrdiff01.at])
 
 AT_BANNER([Updates])
 m4_include([update.at])
-- 
cgit v1.0-41-gc330

++++++ tar-1.30-CVE-2019-9923.patch ++++++
>From cb07844454d8cc9fb21f53ace75975f91185a120 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <g...@gnu.org>
Date: Mon, 14 Jan 2019 15:22:09 +0200
Subject: Fix possible NULL dereference (savannah bug #55369)

* src/sparse.c (pax_decode_header): Check return from find_next_block.
---
 src/sparse.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/sparse.c b/src/sparse.c
index 127364e..d642a46 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -1267,6 +1267,8 @@ pax_decode_header (struct tar_sparse_file *file)
         {                                                         \
           set_next_block_after (b);                               \
            b = find_next_block ();                                 \
+           if (!b)                                                 \
+             FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); \
            src = b->buffer;                                        \
           endp = b->buffer + BLOCKSIZE;                           \
         }                                                         \
@@ -1279,6 +1281,8 @@ pax_decode_header (struct tar_sparse_file *file)
       start = current_block_ordinal ();
       set_next_block_after (current_header);
       blk = find_next_block ();
+      if (!blk)
+        FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
       p = blk->buffer;
       COPY_BUF (blk,nbuf,p);
       if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
-- 
cgit v1.0-41-gc330

++++++ tar-1.30-tests-difflink.patch ++++++
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
++++++ tar-1.30-tests_dirrem_race.patch ++++++
>From 64b43fdf70d82c39eb2ca900cd4f8e49b86c2020 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <prais...@redhat.com>
Date: Thu, 4 Jan 2018 18:55:12 +0100
Subject: tests: fix race in dirrem01 and dirrem02

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])
-- 
cgit v1.0-41-gc330

++++++ tar-CVE-2021-20193.patch ++++++
>From d9d4435692150fa8ff68e1b1a473d187cc3fd777 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <g...@gnu.org>
Date: Sun, 17 Jan 2021 20:41:11 +0200
Subject: Fix memory leak in read_header

Bug reported in https://savannah.gnu.org/bugs/?59897

* src/list.c (read_header): Don't return directly from the loop.
Instead set the status and break.  Return the status.  Free
next_long_name and next_long_link before returning.
---
 src/list.c | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

Index: tar-1.30/src/list.c
===================================================================
--- tar-1.30.orig/src/list.c    2021-03-15 13:45:16.136886071 +0100
+++ tar-1.30/src/list.c 2021-03-15 13:45:16.180886321 +0100
@@ -420,26 +420,27 @@ read_header (union block **return_block,
             enum read_header_mode mode)
 {
   union block *header;
-  union block *header_copy;
   char *bp;
   union block *data_block;
   size_t size, written;
-  union block *next_long_name = 0;
-  union block *next_long_link = 0;
+  union block *next_long_name = NULL;
+  union block *next_long_link = NULL;
   size_t next_long_name_blocks = 0;
   size_t next_long_link_blocks = 0;
-
+  enum read_header status = HEADER_SUCCESS;
+
   while (1)
     {
-      enum read_header status;
-
       header = find_next_block ();
       *return_block = header;
       if (!header)
-       return HEADER_END_OF_FILE;
+       {
+         status = HEADER_END_OF_FILE;
+         break;
+       }
 
       if ((status = tar_checksum (header, false)) != HEADER_SUCCESS)
-       return status;
+       break;
 
       /* Good block.  Decode file size and return.  */
 
@@ -449,7 +450,10 @@ read_header (union block **return_block,
        {
          info->stat.st_size = OFF_FROM_HEADER (header->header.size);
          if (info->stat.st_size < 0)
-           return HEADER_FAILURE;
+           {
+             status = HEADER_FAILURE;
+             break;
+           }
        }
 
       if (header->header.typeflag == GNUTYPE_LONGNAME
@@ -459,10 +463,14 @@ read_header (union block **return_block,
          || header->header.typeflag == SOLARIS_XHDTYPE)
        {
          if (mode == read_header_x_raw)
-           return HEADER_SUCCESS_EXTENDED;
+           {
+             status = HEADER_SUCCESS_EXTENDED;
+             break;
+           }
          else if (header->header.typeflag == GNUTYPE_LONGNAME
                   || header->header.typeflag == GNUTYPE_LONGLINK)
            {
+             union block *header_copy;
              size_t name_size = info->stat.st_size;
              size_t n = name_size % BLOCKSIZE;
              size = name_size + BLOCKSIZE;
@@ -529,7 +537,10 @@ read_header (union block **return_block,
              xheader_decode_global (&xhdr);
              xheader_destroy (&xhdr);
              if (mode == read_header_x_global)
-               return HEADER_SUCCESS_EXTENDED;
+               {
+                 status = HEADER_SUCCESS_EXTENDED;
+                 break;
+               }
            }
 
          /* Loop!  */
@@ -548,6 +559,7 @@ read_header (union block **return_block,
              name = next_long_name->buffer + BLOCKSIZE;
              recent_long_name = next_long_name;
              recent_long_name_blocks = next_long_name_blocks;
+             next_long_name = NULL;
            }
          else
            {
@@ -579,6 +591,7 @@ read_header (union block **return_block,
              name = next_long_link->buffer + BLOCKSIZE;
              recent_long_link = next_long_link;
              recent_long_link_blocks = next_long_link_blocks;
+             next_long_link = NULL;
            }
          else
            {
@@ -590,9 +603,12 @@ read_header (union block **return_block,
            }
          assign_string (&info->link_name, name);
 
-         return HEADER_SUCCESS;
+         break;
        }
     }
+  free (next_long_name);
+  free (next_long_link);
+  return status;
 }
 
 #define ISOCTAL(c) ((c)>='0'&&(c)<='7')
++++++ tar-PIE.patch ++++++
Index: tar-1.30/tests/Makefile.am
===================================================================
--- tar-1.30.orig/tests/Makefile.am
+++ tar-1.30/tests/Makefile.am
@@ -303,6 +303,7 @@ installcheck-local: $(check_PROGRAMS)
 check_PROGRAMS = genfile checkseekhole ckmtime
 
 genfile_SOURCES = genfile.c argcv.c argcv.h
+genfile_LDFLAGS = -pie
 checkseekhole_SOURCES = checkseekhole.c
 
 localedir = $(datadir)/locale
++++++ tar-backup-spec-fix-paths.patch ++++++
Index: tar-1.29/scripts/backup-specs
===================================================================
--- tar-1.29.orig/scripts/backup-specs
+++ tar-1.29/scripts/backup-specs
@@ -6,17 +6,17 @@
 ADMINISTRATOR="root@localhost"
 
 # (Optional) Path to tar binary.
-TAR=/bin/tar
+TAR=/usr/bin/tar
 
 # (Optional) Path to rsh binary or its equivalent. You may wish to
 # set it to ssh as shown in the example below, to improve security.
 # In this case you will have to use public key authentication.
-RSH=/usr/local/bin/ssh
+RSH=/usr/bin/ssh
 
 # (Optional) Path to rsh binary on remote mashines. This will be
 # passed via --rsh-command option to the remote invocation of
 # tar
-RSH_COMMAND=/usr/local/bin/ssh
+RSH_COMMAND=/usr/bin/ssh
 
 # Name of temporary file to hold volume numbers.  This needs to be accessible
 # by all the machines which have filesystems to be dumped.
++++++ tar-ignore_lone_zero_blocks.patch ++++++
Index: tar-1.26/src/list.c
===================================================================
--- tar-1.26.orig/src/list.c    2011-02-16 23:12:16.000000000 +0100
+++ tar-1.26/src/list.c 2014-06-11 11:48:38.129824435 +0200
@@ -212,6 +212,14 @@ read_and (void (*do_something) (void))
 
          if (!ignore_zeros_option)
            {
+             /*
+              * According to POSIX tar specs, this is wrong, but on the web
+              * there are some tar specs that can trigger this, and some tar
+              * implementations create tars according to that spec.  For now,
+              * let's not be pedantic about issuing the warning.
+              */
+#if 0
+
              char buf[UINTMAX_STRSIZE_BOUND];
 
              status = read_header (&current_header, &current_stat_info,
@@ -221,6 +229,9 @@ read_and (void (*do_something) (void))
              WARNOPT (WARN_ALONE_ZERO_BLOCK,
                       (0, 0, _("A lone zero block at %s"),
                        STRINGIFY_BIGINT (current_block_ordinal (), buf)));
+#endif
+             status = read_header (&current_header, &current_stat_info,
+                                   read_header_auto);
              break;
            }
          status = prev_status;
++++++ tar-recursive--files-from.patch ++++++
>From http://lists.gnu.org/archive/html/bug-tar/2014-09/msg00009.html

* src/common.h (name_add_file): Change signature.
* src/names.c (name_elt_alloc_matflags): New function.
(name_add_name): Use name_elt_alloc_matflags.
(name_add_file): Take matching flags as third argument.
(read_next_name): Remove trailing slashes.
* src/tar.c (parse_opt): Pass matching_flags to name_add_file.

* tests/T-dir00.at: New file.
* tests/T-dir01.at: New file.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.
---
 src/common.h       |  2 +-
 src/names.c        | 56 ++++++++++++++++++++++++++++++++++--------------------
 src/tar.c          |  2 +-
 tests/Makefile.am  |  2 ++
 tests/T-dir00.at   | 45 +++++++++++++++++++++++++++++++++++++++++++
 tests/T-dir01.at   | 45 +++++++++++++++++++++++++++++++++++++++++++
 tests/testsuite.at |  2 ++
 7 files changed, 131 insertions(+), 23 deletions(-)
 create mode 100644 tests/T-dir00.at
 create mode 100644 tests/T-dir01.at

Index: tar-1.28/src/common.h
===================================================================
--- tar-1.28.orig/src/common.h  2015-02-09 15:05:47.642772569 +0100
+++ tar-1.28/src/common.h       2015-02-09 15:05:50.076794925 +0100
@@ -725,7 +725,7 @@ int uname_to_uid (char const *uname, uid
 void name_init (void);
 void name_add_name (const char *name, int matching_flags);
 void name_add_dir (const char *name);
-void name_add_file (const char *name, int term);
+void name_add_file (const char *name, int term, int matching_flags);
 void name_term (void);
 const char *name_next (int change_dirs);
 void name_gather (void);
Index: tar-1.28/src/names.c
===================================================================
--- tar-1.28.orig/src/names.c   2015-02-09 15:05:47.642772569 +0100
+++ tar-1.28/src/names.c        2015-02-09 15:05:50.076794925 +0100
@@ -258,6 +258,21 @@ name_elt_alloc (void)
   return elt;
 }
 
+static struct name_elt *
+name_elt_alloc_matflags (int matflags)
+{
+  static int prev_flags = 0; /* FIXME: Or EXCLUDE_ANCHORED? */
+  struct name_elt *ep = name_elt_alloc ();
+  if (prev_flags != matflags)
+    {
+      ep->type = NELT_FMASK;
+      ep->v.matching_flags = matflags;
+      prev_flags = matflags;
+      ep = name_elt_alloc ();
+    }
+  return ep;
+}
+
 static void
 name_list_adjust (void)
 {
@@ -276,20 +291,13 @@ name_list_advance (void)
   free (elt);
 }
 
-/* Add to name_array the file NAME with fnmatch options MATCHING_FLAGS */
+
+/* Add to name_array the file NAME with fnmatch options MATFLAGS */
 void
-name_add_name (const char *name, int matching_flags)
+name_add_name (const char *name, int matflags)
 {
-  static int prev_flags = 0; /* FIXME: Or EXCLUDE_ANCHORED? */
-  struct name_elt *ep = name_elt_alloc ();
+  struct name_elt *ep = name_elt_alloc_matflags (matflags);
 
-  if (prev_flags != matching_flags)
-    {
-      ep->type = NELT_FMASK;
-      ep->v.matching_flags = matching_flags;
-      prev_flags = matching_flags;
-      ep = name_elt_alloc ();
-    }
   ep->type = NELT_NAME;
   ep->v.name = name;
   name_count++;
@@ -305,9 +313,10 @@ name_add_dir (const char *name)
 }
 
 void
-name_add_file (const char *name, int term)
+name_add_file (const char *name, int term, int matflags)
 {
-  struct name_elt *ep = name_elt_alloc ();
+  struct name_elt *ep = name_elt_alloc_matflags (matflags);
+
   ep->type = NELT_FILE;
   ep->v.file.name = name;
   ep->v.file.term = term;
@@ -389,6 +398,15 @@ add_file_id (const char *filename)
   file_id_list = p;
   return 0;
 }
+
+/* Chop trailing slashes.  */
+static void
+chopslash (char *str)
+{
+  char *p = str + strlen (str) - 1;
+  while (p > str && ISSLASH (*p))
+    *p-- = '\0';
+}
 
 enum read_file_list_state  /* Result of reading file name from the list file */
   {
@@ -428,7 +446,7 @@ read_name_from_file (struct name_elt *en
   if (counter == name_buffer_length)
     name_buffer = x2realloc (name_buffer, &name_buffer_length);
   name_buffer[counter] = 0;
-
+  chopslash (name_buffer);
   return (counter == 0 && c == EOF) ? file_list_end : file_list_success;
 }
 
@@ -518,7 +536,6 @@ copy_name (struct name_elt *ep)
 {
   const char *source;
   size_t source_len;
-  char *cursor;
 
   source = ep->v.name;
   source_len = strlen (source);
@@ -536,11 +553,7 @@ copy_name (struct name_elt *ep)
       name_buffer = xmalloc(name_buffer_length + 2);
     }
   strcpy (name_buffer, source);
-
-  /* Zap trailing slashes.  */
-  cursor = name_buffer + strlen (name_buffer) - 1;
-  while (cursor > name_buffer && ISSLASH (*cursor))
-    *cursor-- = '\0';
+  chopslash (name_buffer);
 }
 
 
@@ -553,7 +566,8 @@ static int matching_flags; /* exclude_fn
    the request to change to the given directory.
 
    Entries of type NELT_FMASK cause updates of the matching_flags
-   value. */
+   value.
+*/
 static struct name_elt *
 name_next_elt (int change_dirs)
 {
Index: tar-1.28/src/tar.c
===================================================================
--- tar-1.28.orig/src/tar.c     2015-02-09 15:05:47.642772569 +0100
+++ tar-1.28/src/tar.c  2015-02-09 15:05:50.077794935 +0100
@@ -1641,7 +1641,7 @@ parse_opt (int key, char *arg, struct ar
       break;
 
     case 'T':
-      name_add_file (arg, filename_terminator);
+      name_add_file (arg, filename_terminator, MAKE_INCL_OPTIONS (args));
       /* Indicate we've been given -T option. This is for backward
         compatibility only, so that `tar cfT archive /dev/null will
         succeed */
Index: tar-1.28/tests/Makefile.am
===================================================================
--- tar-1.28.orig/tests/Makefile.am     2015-02-09 15:05:47.642772569 +0100
+++ tar-1.28/tests/Makefile.am  2015-02-09 15:05:50.077794935 +0100
@@ -43,6 +43,8 @@ $(srcdir)/package.m4: $(top_srcdir)/conf
 
 TESTSUITE_AT = \
  T-cd.at\
+ T-dir00.at\
+ T-dir01.at\
  T-empty.at\
  T-null.at\
  T-rec.at\
Index: tar-1.28/tests/T-dir00.at
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ tar-1.28/tests/T-dir00.at   2015-02-09 15:05:50.077794935 +0100
@@ -0,0 +1,45 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Tar 1.27 and 1.28 did not extract files under directory memberes listed
+# in the file read by --file-from.
+#
+# Reported-by: Jean-Louis Martineau <address@hidden>
+# References: <address@hidden>,
+#             http://lists.gnu.org/archive/html/bug-tar/2014-09/msg00006.html
+
+AT_SETUP([recursive extraction from --files-from])
+AT_KEYWORDS([files-from extract T-dir T-dir00])
+AT_TAR_CHECK([
+mkdir dir
+genfile -f dir/file1
+genfile -f dir/file2
+tar cf archive dir
+rm -rf dir
+echo dir > list
+tar xfTv archive list | sort
+],
+[0],
+[dir/
+dir/file1
+dir/file2
+])
+AT_CLEANUP
+
Index: tar-1.28/tests/T-dir01.at
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ tar-1.28/tests/T-dir01.at   2015-02-09 15:45:52.309679130 +0100
@@ -0,0 +1,45 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Tar 1.27 and 1.28 did not remove trailing slashes from file names
+# obtained with the --file-from option.
+#
+# Reported-by: Jean-Louis Martineau <address@hidden>
+# References: <address@hidden>,
+#             http://lists.gnu.org/archive/html/bug-tar/2014-09/msg00006.html
+
+AT_SETUP([trailing slash in --files-from])
+AT_KEYWORDS([files-from extract T-dir T-dir01])
+AT_TAR_CHECK([
+mkdir dir
+genfile -f dir/file1
+genfile -f dir/file2
+tar cf archive dir
+rm -rf dir
+echo dir/ > list
+tar xfTv archive list | sort
+],
+[0],
+[dir/
+dir/file1
+dir/file2
+])
+AT_CLEANUP
+
Index: tar-1.28/tests/testsuite.at
===================================================================
--- tar-1.28.orig/tests/testsuite.at    2015-02-09 15:05:47.642772569 +0100
+++ tar-1.28/tests/testsuite.at 2015-02-09 15:05:50.116795293 +0100
@@ -205,6 +205,8 @@ m4_include([T-empty.at])
 m4_include([T-null.at])
 m4_include([T-zfile.at])
 m4_include([T-nonl.at])
+m4_include([T-dir00.at])
+m4_include([T-dir01.at])
 
 AT_BANNER([Various options])
 m4_include([indexfile.at])
++++++ tar-wildcards.patch ++++++
Index: tar-1.25/src/names.c
===================================================================
--- tar-1.25.orig/src/names.c
+++ tar-1.25/src/names.c
@@ -970,10 +970,6 @@ collect_and_sort_names (void)
 
       if (name->found_count || name->directory)
        continue;
-      if (name->matching_flags & EXCLUDE_WILDCARDS)
-       /* NOTE: EXCLUDE_ANCHORED is not relevant here */
-       /* FIXME: just skip regexps for now */
-       continue;
       chdir_do (name->change_dir);
 
       if (name->name[0] == 0)

Reply via email to