From unknown Sat Jun 14 05:06:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48036: [PATCH] copy: do not refuse to copy a swap file Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 26 Apr 2021 15:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48036 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 48036@debbugs.gnu.org Cc: Zorro Lang X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161945073723049 (code B ref -1); Mon, 26 Apr 2021 15:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Apr 2021 15:25:37 +0000 Received: from localhost ([127.0.0.1]:46812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb37A-0005zh-QH for submit@debbugs.gnu.org; Mon, 26 Apr 2021 11:25:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:47876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb373-0005zU-Dz for submit@debbugs.gnu.org; Mon, 26 Apr 2021 11:25:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb373-000818-6s for bug-coreutils@gnu.org; Mon, 26 Apr 2021 11:25:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb370-0001wE-U2 for bug-coreutils@gnu.org; Mon, 26 Apr 2021 11:25:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619450725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SwK/dyDh7HWd8UNeGo57oYLc6JF8gILPXw/FOJAqf4A=; b=GeOEsVcLLvNmKXTYEjl4RPYWuB7WwZ5PbrCN20b70JWoOiSOzsCO1qWtIf3+kXh1oqJha0 z3tEOjI4ohMWFD3+PlmPEdswb+JNRalkLjPV88q+A2wwbIOOZZaQLIUOOvp5k8X3uuP36m az+e5sl0cIRvqxMI+tDMhmY9px7C+1w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-WP8UFm5PPIunnK2mqoXYMQ-1; Mon, 26 Apr 2021 11:25:23 -0400 X-MC-Unique: WP8UFm5PPIunnK2mqoXYMQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1648B881286 for ; Mon, 26 Apr 2021 15:25:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id C92CD5D9CD; Mon, 26 Apr 2021 15:25:19 +0000 (UTC) From: Kamil Dudka Date: Mon, 26 Apr 2021 17:25:18 +0200 Message-Id: <20210426152518.304084-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.219, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) From: Zorro Lang * 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 From unknown Sat Jun 14 05:06:29 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kamil Dudka Subject: bug#48036: closed (Re: bug#48036: [PATCH] copy: do not refuse to copy a swap file) Message-ID: References: <043f0983-c92c-43b3-c9b6-50e86d1d9c32@cs.ucla.edu> <20210426152518.304084-1-kdudka@redhat.com> X-Gnu-PR-Message: they-closed 48036 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 48036@debbugs.gnu.org Date: Tue, 27 Apr 2021 01:04:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1619485442-14401-1" This is a multi-part message in MIME format... ------------=_1619485442-14401-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 48036@debbugs.gnu.org. --=20 48036: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D48036 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1619485442-14401-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 48036-done) by debbugs.gnu.org; 27 Apr 2021 01:03:29 +0000 Received: from localhost ([127.0.0.1]:47576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbC8P-0003jZ-GO for submit@debbugs.gnu.org; Mon, 26 Apr 2021 21:03:29 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbC8M-0003jK-RX for 48036-done@debbugs.gnu.org; Mon, 26 Apr 2021 21:03:28 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 88BE816015B; Mon, 26 Apr 2021 18:03:20 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id CcwUUoVjlWPR; Mon, 26 Apr 2021 18:03:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EA44C160193; Mon, 26 Apr 2021 18:03:19 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9gvDEneoqe1S; Mon, 26 Apr 2021 18:03:19 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C4C0616015B; Mon, 26 Apr 2021 18:03:19 -0700 (PDT) Subject: Re: bug#48036: [PATCH] copy: do not refuse to copy a swap file To: Kamil Dudka References: <20210426152518.304084-1-kdudka@redhat.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <043f0983-c92c-43b3-c9b6-50e86d1d9c32@cs.ucla.edu> Date: Mon, 26 Apr 2021 18:03:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210426152518.304084-1-kdudka@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 48036-done Cc: Zorro Lang , 48036-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thanks, I installed that into Savannah master coreutils. ------------=_1619485442-14401-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Apr 2021 15:25:37 +0000 Received: from localhost ([127.0.0.1]:46812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb37A-0005zh-QH for submit@debbugs.gnu.org; Mon, 26 Apr 2021 11:25:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:47876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb373-0005zU-Dz for submit@debbugs.gnu.org; Mon, 26 Apr 2021 11:25:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb373-000818-6s for bug-coreutils@gnu.org; Mon, 26 Apr 2021 11:25:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb370-0001wE-U2 for bug-coreutils@gnu.org; Mon, 26 Apr 2021 11:25:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619450725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SwK/dyDh7HWd8UNeGo57oYLc6JF8gILPXw/FOJAqf4A=; b=GeOEsVcLLvNmKXTYEjl4RPYWuB7WwZ5PbrCN20b70JWoOiSOzsCO1qWtIf3+kXh1oqJha0 z3tEOjI4ohMWFD3+PlmPEdswb+JNRalkLjPV88q+A2wwbIOOZZaQLIUOOvp5k8X3uuP36m az+e5sl0cIRvqxMI+tDMhmY9px7C+1w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-WP8UFm5PPIunnK2mqoXYMQ-1; Mon, 26 Apr 2021 11:25:23 -0400 X-MC-Unique: WP8UFm5PPIunnK2mqoXYMQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1648B881286 for ; Mon, 26 Apr 2021 15:25:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id C92CD5D9CD; Mon, 26 Apr 2021 15:25:19 +0000 (UTC) From: Kamil Dudka To: bug-coreutils@gnu.org Subject: [PATCH] copy: do not refuse to copy a swap file Date: Mon, 26 Apr 2021 17:25:18 +0200 Message-Id: <20210426152518.304084-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.219, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Zorro Lang X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) From: Zorro Lang * 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 ------------=_1619485442-14401-1--