2 Commits

Author SHA256 Message Date
19f0ab9a68 Immutable and deletion fixes
- Add tar-fix-deletion-from-archive.patch
  * Fixes tar creating invalid tarballs when used with --delete (bsc#1246607)
  * Add makeinfo build requirement, needed after the addition of the patch
- Rename gnurmt to rmt, since we now conflict with other rmt providers
  (complementary change for bsc#1240101)
- Move tar-tests files to %_libdir/tar to avoid files outside snapshot
  (jsc#PED-14742)
- Remove update-alternatives %post scripts for SLES 16.x future releases
  (jsc#PED-15657, bsc#1245919)
2026-03-04 15:53:53 -03:00
c533c778bc Accepting request 1281220 from home:mschreiner:branches:Base:System
- Migrate away from update-alternatives (bsc#1240101).
  tar-rmt now conflicts with other providers of /usr/bin/rmt.
- Upon installation of the newer packages, the tar-rmt alternatives
  are purged from the system.

OBS-URL: https://build.opensuse.org/request/show/1281220
OBS-URL: https://build.opensuse.org/package/show/Base:System/tar?expand=0&rev=135
2026-03-04 15:48:00 -03:00
3 changed files with 117 additions and 26 deletions

View File

@@ -0,0 +1,72 @@
From d437ecf75de2d6fdeb2aed6f45c4b3b16373389b Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Fri, 11 Aug 2023 21:35:30 +0300
Subject: Revert "Fix savannah bug #63567"
Commit e89c7a45eb broke deletion from archives. The reported number
of bytes read is rounded to the nearest record anyway, revert the
commit and document the fact.
Reported by Ed Santiago. See
https://bugzilla.redhat.com/show_bug.cgi?id=2230127
* doc/tar.texi: Document the fact that --totals rounds up the
number of bytes reads to the nearest record.
* src/buffer.c: Revert changes.
* tests/delete06.at: Fix expected status code and stderr.
---
doc/tar.texi | 5 +++++
src/buffer.c | 3 +--
tests/delete06.at | 7 +++++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/doc/tar.texi b/doc/tar.texi
index d43b39e4..ee631137 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -4215,6 +4215,11 @@ Total bytes read: 7924664320 (7.4GiB, 95MiB/s)
@end group
@end smallexample
+Notice, that since @command{tar} operates on @dfn{records}, the number
+of bytes reported can be rounded up to the nearest full record. This
+can happen, in particular, when the last record in the archive is
+partial. @xref{Blocking}.
+
Finally, when deleting from an archive, the @option{--totals} option
displays both numbers plus number of bytes removed from the archive:
diff --git a/src/buffer.c b/src/buffer.c
index 12a0579f..8a575f9a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -987,8 +987,7 @@ short_read (size_t status)
}
record_end = record_start + (record_size - left) / BLOCKSIZE;
- if (left == 0)
- records_read++;
+ records_read++;
}
/* Flush the current buffer to/from the archive. */
diff --git a/tests/delete06.at b/tests/delete06.at
index 9668a28c..c84ba20e 100644
--- a/tests/delete06.at
+++ b/tests/delete06.at
@@ -36,7 +36,10 @@ esac
dd if=archive.tar of=trunc.tar bs=$size count=1 2>/dev/null
tar --delete 'b/' -f trunc.tar
],
-[0],
-[],[],[],[],[gnu, pax])
+[2],
+[],
+[tar: lseek: trunc.tar: Value too large for defined data type
+tar: Exiting with failure status due to previous errors
+],[],[],[gnu, pax])
AT_CLEANUP
--
cgit v1.2.3

View File

@@ -1,3 +1,28 @@
-------------------------------------------------------------------
Wed Mar 4 18:26:48 UTC 2026 - Antonio Teixeira <antonio.teixeira@suse.com>
- Add tar-fix-deletion-from-archive.patch
* Fixes tar creating invalid tarballs when used with --delete (bsc#1246607)
* Add makeinfo build requirement, needed after the addition of the patch
-------------------------------------------------------------------
Tue Feb 10 23:12:22 UTC 2026 - Antonio Teixeira <antonio.teixeira@suse.com>
- Rename gnurmt to rmt, since we now conflict with other rmt providers
(complementary change for bsc#1240101)
- Move tar-tests files to %_libdir/tar to avoid files outside snapshot
(jsc#PED-14742)
- Remove update-alternatives %post scripts for SLES 16.x future releases
(jsc#PED-15657, bsc#1245919)
-------------------------------------------------------------------
Thu May 29 19:52:40 UTC 2025 - Martin Schreiner <martin.schreiner@suse.com>
- Migrate away from update-alternatives (bsc#1240101).
tar-rmt now conflicts with other providers of /usr/bin/rmt.
- Upon installation of the newer packages, the tar-rmt alternatives
are purged from the system.
-------------------------------------------------------------------
Wed Jul 10 20:09:28 UTC 2024 - Antonio Teixeira <antonio.teixeira@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package tar
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,6 +18,8 @@
# For correct subpackages docs installation into tar doc directory
%global _docdir_fmt %{name}
# tar-tests directory
%define testsdir %{_libdir}/%{name}
Name: tar
Version: 1.35
Release: 0
@@ -50,9 +52,11 @@ Patch13: bsc1202436.patch
# uninitialized memory for a conditional jump
Patch16: fix-CVE-2022-48303.patch
Patch17: add_forgotten-tests.patch
Patch18: tar-fix-deletion-from-archive.patch
BuildRequires: automake >= 1.15
BuildRequires: libacl-devel
BuildRequires: libselinux-devel
BuildRequires: makeinfo
Recommends: %{name}-rmt = %{version}
Recommends: mt
Recommends: xz
@@ -87,9 +91,11 @@ Upstream testsuite for the package
%package rmt
Summary: Remote tape drive control server by GNU
Group: Productivity/Archiving/Backup
%if %{suse_version} <= 1600 || %{suse_version} >= 1699
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
Provides: rmt
Conflicts: rmt
%description rmt
Provides remote access to files and devices for tar, cpio
@@ -125,8 +131,7 @@ autoreconf -fi
%configure \
gl_cv_func_linkat_follow="yes" \
--enable-backup-scripts \
--disable-silent-rules \
--program-transform-name='s/^rmt$/gnurmt/'
--disable-silent-rules
%make_build LDFLAGS="-pie"
cd tests
%make_build genfile
@@ -140,37 +145,30 @@ cd -
%install
%make_install DESTDIR=%{buildroot}
mkdir %{buildroot}/bin
mv %{buildroot}%{_mandir}/man8/gnurmt.8 %{buildroot}%{_mandir}/man1/gnurmt.1
mv %{buildroot}%{_mandir}/man8/rmt.8 %{buildroot}%{_mandir}/man1/rmt.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}
install -d -m 755 %{buildroot}%{testsdir}
cp -r tests %{buildroot}%{testsdir}
rm %{buildroot}%{testsdir}/tests/*.{c,h,o}
rm %{buildroot}%{testsdir}/tests/package.m4
rm %{buildroot}%{testsdir}/tests/{atconfig,atlocal,Makefile}*
%if 0%{?suse_version} < 1550
mkdir -p %{buildroot}/bin
ln -s %{_bindir}/%{name} %{buildroot}/bin
%endif
%find_lang %{name}
%if %{suse_version} <= 1600 || %{suse_version} >= 1699
%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}
%postun rmt
if [ ! -f %{_bindir}/gnurmt ] ; then
"%{_sbindir}/update-alternatives" --remove rmt %{_bindir}/gnurmt
fi
%endif
%files backup-scripts
%{_sbindir}/backup
@@ -183,16 +181,12 @@ fi
%files lang -f %{name}.lang
%files tests
%{_localstatedir}/lib/tests
%{testsdir}
%{_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}
%{_bindir}/rmt
%{_mandir}/man1/rmt.1%{?ext_man}
%files doc
%dir %{_docdir}/%{name}