From 253ea1189f921b443e8ad1d264ffdbb920763c80 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 27 Apr 2021 10:35:48 +0200 Subject: [PATCH] Resolves: #1953669 - copy: do not refuse to copy a swap file --- coreutils-8.32-copy-swap.patch | 32 ++++++++++++++++++++++++++++++++ coreutils.spec | 8 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 coreutils-8.32-copy-swap.patch diff --git a/coreutils-8.32-copy-swap.patch b/coreutils-8.32-copy-swap.patch new file mode 100644 index 0000000..acbcf1b --- /dev/null +++ b/coreutils-8.32-copy-swap.patch @@ -0,0 +1,32 @@ +From f9936f7d2db6edd423b9d6327e2b284d86b6a1f5 Mon Sep 17 00:00:00 2001 +From: Zorro Lang +Date: Mon, 26 Apr 2021 17:25:18 +0200 +Subject: [PATCH] copy: do not refuse to copy a swap file + +* src/copy.c (sparse_copy): Fallback to read() if copy_file_range() +fails with ETXTBSY. Otherwise it would be impossible to copy files +that are being used as swap. This used to work before introducing +the support for copy_file_range() in coreutils. (Bug#48036) + +Upstream-commit: 785478013b416cde50794be35475c0c4fdbb48b4 +Signed-off-by: Kamil Dudka +--- + src/copy.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/copy.c b/src/copy.c +index 4050f69..1798bb7 100644 +--- a/src/copy.c ++++ b/src/copy.c +@@ -290,7 +290,7 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, + if (n_copied < 0) + { + if (errno == ENOSYS || errno == EINVAL +- || errno == EBADF || errno == EXDEV) ++ || errno == EBADF || errno == EXDEV || errno == ETXTBSY) + break; + if (errno == EINTR) + n_copied = 0; +-- +2.30.2 + diff --git a/coreutils.spec b/coreutils.spec index a3980ea..b481738 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.32 -Release: 23%{?dist} +Release: 24%{?dist} License: GPLv3+ Url: https://www.gnu.org/software/coreutils/ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz @@ -52,6 +52,9 @@ Patch12: coreutils-8.32-mem-leaks.patch # utimens: fix confusing arg type in internal func Patch13: coreutils-8.32-coverity-utimens.patch +# copy: do not refuse to copy a swap file +Patch14: coreutils-8.32-copy-swap.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -308,6 +311,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %license COPYING %changelog +* Tue Apr 27 2021 Kamil Dudka - 8.32-24 +- copy: do not refuse to copy a swap file (#1953669) + * Thu Apr 15 2021 Mohan Boddu - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937