Resolves: #1953669 - copy: do not refuse to copy a swap file

This commit is contained in:
Kamil Dudka 2021-04-27 10:35:48 +02:00
parent e4decc2688
commit 56555a47f2
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From f9936f7d2db6edd423b9d6327e2b284d86b6a1f5 Mon Sep 17 00:00:00 2001
From: Zorro Lang <zlang@redhat.com>
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 <kdudka@redhat.com>
---
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

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.32
Release: 22%{?dist}
Release: 23%{?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 <kdudka@redhat.com> - 8.32-23
- copy: do not refuse to copy a swap file
* Fri Apr 09 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-22
- weaken the dependency on glibc-doc to reduce minimal installations
- drop the last use of ncurses no longer needed (#1830318)