Add forgotten patches from RHEL 9

Renumber patches

Resolves: RHEL-134817
This commit is contained in:
Pavel Cahyna 2026-01-12 12:39:30 +01:00
parent 7166a666f9
commit 499736e848
3 changed files with 232 additions and 3 deletions

View File

@ -0,0 +1,51 @@
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Tue, 13 Apr 2021 11:47:32 +0200
Subject: [PATCH] do not report read disk error as file shrank
diff --git a/src/create.c b/src/create.c
index 181f7d9..7be10a9 100644
--- a/src/create.c
+++ b/src/create.c
@@ -1097,7 +1097,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
size_left -= count;
set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
- if (count != bufsize)
+ if (count == 0)
{
char buf[UINTMAX_STRSIZE_BOUND];
memset (blk->buffer + count, 0, bufsize - count);
diff -rup tar-1.34/tests/Makefile.am.old tar-1.34/tests/Makefile.am
--- tar-1.34/tests/Makefile.am.old 2022-06-27 09:21:40.881574517 +0000
+++ tar-1.34/tests/Makefile.am 2022-06-27 09:23:31.444574517 +0000
@@ -247,7 +247,6 @@ TESTSUITE_AT = \
sptrdiff01.at\
time01.at\
time02.at\
- truncate.at\
update.at\
update01.at\
update02.at\
diff -rup tar-1.34/tests/Makefile.in.old tar-1.34/tests/Makefile.in
--- tar-1.34/tests/Makefile.in.old 2022-06-27 09:21:48.626574517 +0000
+++ tar-1.34/tests/Makefile.in 2022-06-27 09:22:03.127574517 +0000
@@ -1622,7 +1622,6 @@ TESTSUITE_AT = \
sptrdiff01.at\
time01.at\
time02.at\
- truncate.at\
update.at\
update01.at\
update02.at\
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 2a83757..52f73a6 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -424,7 +424,6 @@ m4_include([comprec.at])
m4_include([shortfile.at])
m4_include([shortupd.at])
-m4_include([truncate.at])
m4_include([grow.at])
m4_include([sigpipe.at])
m4_include([comperr.at])

View File

@ -0,0 +1,176 @@
diff -x '*~' -x autom4te.cache -x gnulib -x paxutils -x build-aux -x gnulib.modules -x gnulib-cache.m4 -x .git -x .gitmodules -x '*.in' --unidirectional-new-file -ur tar-1.35-rhel-10.1/lib/paxerror.c tar-1.35-rhel-10.2-clean/lib/paxerror.c
--- a/lib/paxerror.c 2025-12-03 13:59:35.940296110 +0100
+++ b/lib/paxerror.c 2026-01-09 15:00:00.865341402 +0100
@@ -174,27 +174,41 @@
}
void
-read_error_details (char const *name, off_t offset, size_t size)
+read_error_details (char const *name, off_t offset, size_t size, bool padding)
{
intmax_t off = offset;
int e = errno;
- ERROR ((0, e,
- ngettext ("%s: Read error at byte %jd, while reading %zu byte",
- "%s: Read error at byte %jd, while reading %zu bytes",
- size),
- quotearg_colon (name), off, size));
+ if (padding)
+ ERROR ((0, e,
+ ngettext ("%s: Read error at byte %jd, while reading %zu byte; padding with zeros",
+ "%s: Read error at byte %jd, while reading %zu bytes; padding with zeros",
+ size),
+ quotearg_colon (name), off, size));
+ else
+ ERROR ((0, e,
+ ngettext ("%s: Read error at byte %jd, while reading %zu byte",
+ "%s: Read error at byte %jd, while reading %zu bytes",
+ size),
+ quotearg_colon (name), off, size));
}
void
-read_warn_details (char const *name, off_t offset, size_t size)
+read_warn_details (char const *name, off_t offset, size_t size, bool padding)
{
intmax_t off = offset;
int e = errno;
- WARN ((0, e,
- ngettext ("%s: Warning: Read error at byte %jd, while reading %zu byte",
- "%s: Warning: Read error at byte %jd, while reading %zu bytes",
- size),
- quotearg_colon (name), off, size));
+ if (padding)
+ WARN ((0, e,
+ ngettext ("%s: Warning: Read error at byte %jd, while reading %zu byte; padding with zeros",
+ "%s: Warning: Read error at byte %jd, while reading %zu bytes; padding with zeros",
+ size),
+ quotearg_colon (name), off, size));
+ else
+ WARN ((0, e,
+ ngettext ("%s: Warning: Read error at byte %jd, while reading %zu byte",
+ "%s: Warning: Read error at byte %jd, while reading %zu bytes",
+ size),
+ quotearg_colon (name), off, size));
}
void
diff -x '*~' -x autom4te.cache -x gnulib -x paxutils -x build-aux -x gnulib.modules -x gnulib-cache.m4 -x .git -x .gitmodules -x '*.in' --unidirectional-new-file -ur tar-1.35-rhel-10.1/lib/paxlib.h tar-1.35-rhel-10.2-clean/lib/paxlib.h
--- a/lib/paxlib.h 2025-12-03 13:59:35.940296110 +0100
+++ b/lib/paxlib.h 2026-01-09 15:00:00.869341504 +0100
@@ -92,10 +92,10 @@
_Noreturn void open_fatal (char const *);
void open_warn (char const *);
void read_error (char const *);
-void read_error_details (char const *, off_t, size_t);
+void read_error_details (char const *, off_t, size_t, bool);
_Noreturn void read_fatal (char const *);
_Noreturn void read_fatal_details (char const *, off_t, size_t);
-void read_warn_details (char const *, off_t, size_t);
+void read_warn_details (char const *, off_t, size_t, bool);
void readlink_error (char const *);
void readlink_warn (char const *);
void rmdir_error (char const *);
diff -x '*~' -x autom4te.cache -x gnulib -x paxutils -x build-aux -x gnulib.modules -x gnulib-cache.m4 -x .git -x .gitmodules -x '*.in' --unidirectional-new-file -ur tar-1.35-rhel-10.1/src/common.h tar-1.35-rhel-10.2-clean/src/common.h
--- a/src/common.h 2025-12-03 13:55:36.040944472 +0100
+++ b/src/common.h 2026-01-12 10:53:18.296266888 +0100
@@ -730,7 +730,7 @@
void close_diag (char const *name);
void open_diag (char const *name);
-void read_diag_details (char const *name, off_t offset, size_t size);
+void read_diag_details (char const *name, off_t offset, size_t size, bool padding);
void readlink_diag (char const *name);
void savedir_diag (char const *name);
void seek_diag_details (char const *name, off_t offset);
diff -x '*~' -x autom4te.cache -x gnulib -x paxutils -x build-aux -x gnulib.modules -x gnulib-cache.m4 -x .git -x .gitmodules -x '*.in' --unidirectional-new-file -ur tar-1.35-rhel-10.1/src/create.c tar-1.35-rhel-10.2-clean/src/create.c
--- a/src/create.c 2025-12-03 13:55:36.040944472 +0100
+++ b/src/create.c 2026-01-12 10:53:18.296266888 +0100
@@ -1079,7 +1079,7 @@
if (count == SAFE_READ_ERROR)
{
read_diag_details (st->orig_file_name,
- st->stat.st_size - size_left, bufsize);
+ st->stat.st_size - size_left, bufsize, true);
pad_archive (size_left);
return dump_status_short;
}
diff -x '*~' -x autom4te.cache -x gnulib -x paxutils -x build-aux -x gnulib.modules -x gnulib-cache.m4 -x .git -x .gitmodules -x '*.in' --unidirectional-new-file -ur tar-1.35-rhel-10.1/src/misc.c tar-1.35-rhel-10.2-clean/src/misc.c
--- a/src/misc.c 2025-12-03 13:55:36.040944472 +0100
+++ b/src/misc.c 2026-01-12 10:53:18.296266888 +0100
@@ -1117,15 +1117,15 @@
}
void
-read_diag_details (char const *name, off_t offset, size_t size)
+read_diag_details (char const *name, off_t offset, size_t size, bool padding)
{
if (ignore_failed_read_option)
{
if (WARNING_ENABLED(WARN_FAILED_READ))
- read_warn_details (name, offset, size);
+ read_warn_details (name, offset, size, padding);
}
else
- read_error_details (name, offset, size);
+ read_error_details (name, offset, size, padding);
}
void
diff -x '*~' -x autom4te.cache -x gnulib -x paxutils -x build-aux -x gnulib.modules -x gnulib-cache.m4 -x .git -x .gitmodules -x '*.in' --unidirectional-new-file -ur tar-1.35-rhel-10.1/src/sparse.c tar-1.35-rhel-10.2-clean/src/sparse.c
--- a/src/sparse.c 2025-12-03 13:55:36.044944594 +0100
+++ b/src/sparse.c 2026-01-12 10:53:18.300266996 +0100
@@ -422,7 +422,7 @@
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- bytes_left),
- bufsize);
+ bufsize, false);
return false;
}
else if (bytes_read == 0)
@@ -433,7 +433,7 @@
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- bytes_left),
- bufsize);
+ bufsize, false);
return false;
}
else
@@ -632,7 +632,7 @@
{
read_diag_details (file->stat_info->orig_file_name,
beg,
- rdsize);
+ rdsize, false);
return false;
}
else if (bytes_read == 0)
@@ -640,7 +640,7 @@
if (errno != 0)
read_diag_details (file->stat_info->orig_file_name,
beg,
- rdsize);
+ rdsize, false);
else
report_difference (file->stat_info, _("Size differs"));
return false;
@@ -692,7 +692,7 @@
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- size_left),
- rdsize);
+ rdsize, false);
return false;
}
else if (bytes_read == 0)
@@ -702,7 +702,7 @@
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- size_left),
- rdsize);
+ rdsize, false);
else
report_difference (&current_stat_info, _("Size differs"));
return false;

View File

@ -24,9 +24,11 @@ Patch3: tar-1.29-wildcards.patch
Patch4: tar-1.28-atime-rofs.patch
Patch9: tar-1.28-document-exclude-mistakes.patch
Patch10: tar-1.33-fix-capabilities-test.patch
Patch11: tar-1.35-add-forgotten-tests-from-upstream.patch
Patch12: tar-1.35-revert-fix-savannah-bug-633567.patch
Patch11: tar-1.35-padding-zeros.patch
Patch12: tar-1.30-disk-read-error.patch
Patch13: tar-1.35-fix-spurious-diagnostic-during-extraction-of-.-with-keep-newer-files.patch
Patch14: tar-1.35-add-forgotten-tests-from-upstream.patch
Patch15: tar-1.35-revert-fix-savannah-bug-633567.patch
#tar commits from upstream
# 56fb4a96ca43c247261b8c04dd65592f990f98ac
# 7c241126f14975c7f5df4268b434f276fc7f8842
@ -51,7 +53,7 @@ Patch13: tar-1.35-fix-spurious-diagnostic-during-extraction-of-.-with-keep-newer
# 20074698382b7e4f049f52bbdeaf6a39508a8601
# d1aeb7388926e045bdec0f7934c5522c4745f02c
# 45b6e6898d1f931bfca41d961289bd6ac33238e5
Patch14: tar-1.35-CVE-2025-45582.patch
Patch23: tar-1.35-CVE-2025-45582.patch
BuildRequires: autoconf
BuildRequires: automake