Subject: bug#48036: closed (Re: bug#48036: [PATCH] copy: do not refuse to copy a swap file)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 27 Apr 2021 01:04:02 +0000

Your bug report

#48036: [PATCH] copy: do not refuse to copy a swap file

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
48036: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=48036
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#48036: [PATCH] copy: do not refuse to copy a swap file
From: Paul Eggert <[email-masked]>
To: Kamil Dudka <[email-masked]>
Cc: Zorro Lang <[email-masked]>, [email-masked]
Date: Mon, 26 Apr 2021 18:03:19 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I installed that into Savannah master coreutils.

Subject: [PATCH] copy: do not refuse to copy a swap file
From: Kamil Dudka <[email-masked]>
To: [email-masked]
Cc: Zorro Lang <[email-masked]>
Date: Mon, 26 Apr 2021 17:25:18 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

From: Zorro Lang <[email-masked]>

* 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.
---
 src/copy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/copy.c b/src/copy.c
index 9dbc694ebee..b7ec9747fa8 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