From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 28 Mar 2011 21:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8370@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils Received: via spool by submit@debbugs.gnu.org id=B.13013463051151 (code B ref -1); Mon, 28 Mar 2011 21:06:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Mar 2011 21:05:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4JcW-0000IW-6O for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:05:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4JcS-0000I2-Cq for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:05:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4JcL-0005Po-MO for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:04:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:33095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4JcL-0005O1-6f for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:04:53 -0400 Received: from [140.186.70.92] (port=48459 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4Jby-0005F1-2h for bug-coreutils@gnu.org; Mon, 28 Mar 2011 17:04:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4JTK-0003vo-Ty for bug-coreutils@gnu.org; Mon, 28 Mar 2011 16:55:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4JTK-0003vU-KK for bug-coreutils@gnu.org; Mon, 28 Mar 2011 16:55:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2SKtXeg003312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Mar 2011 16:55:33 -0400 Received: from [10.3.113.121] (ovpn-113-121.phx2.redhat.com [10.3.113.121]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2SKtWuO019922 for ; Mon, 28 Mar 2011 16:55:33 -0400 Message-ID: <4D90F5C4.2030201@redhat.com> Date: Mon, 28 Mar 2011 14:55:32 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigD47545B19C2820A4FE3CD880" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -7.9 (-------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.9 (-------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD47545B19C2820A4FE3CD880 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable cp --attributes-only is great for preserving all metadata attributes without corrupting contents, but what if I want to preserve only some of the metadata (for example, copying SELinux context but _not_ timestamps or content)? It seems like --attributes-only would be a great synonym for '--preserve=3Dall --no-preserve=3Dcontents', and that by adding the 'contents' category to --preserve (and defaulting it to on unless turned off explicitly), that you expose finer-grained tuning to what metadata gets copied. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigD47545B19C2820A4FE3CD880 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNkPXEAAoJEKeha0olJ0Nq2xIIAIgj7t1MDzvnHehR470+5EDY FLG7vhN8g54BuTzJeHI2CEkm76nRym/3cGVPkKvOaTmpGP0e89rd+eSfRv0YxmfJ 2oksU0jiaNdOyVX4kiEVajA0u4cwtsTj/G5SJfId8OAGz0zdyE1YxwqXgVhK438v qsSe0sjMJGyPcDMmK43TfL6NFYsVqWkMBNllJcu7kSE2iIXmL0UijrMJEnL097uF u2EWoAOFG6CO/EMyabPVsVjfjlTVhCxMyzYC8BR3BU/TBYdTP06UHSzWZgjNwA84 no0AmA96rhUBoHk9rQiShL6vucuQ/hiybKdSnpOlW+JcoL/pUC3hYn/H+mNZAPA= =n+qO -----END PGP SIGNATURE----- --------------enigD47545B19C2820A4FE3CD880-- From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 28 Mar 2011 21:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 8370@debbugs.gnu.org Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.13013494395539 (code B ref 8370); Mon, 28 Mar 2011 21:58:01 +0000 Received: (at 8370) by debbugs.gnu.org; 28 Mar 2011 21:57:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4KR4-0001RI-4I for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:57:18 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Q4KR2-0001R6-4W for 8370@debbugs.gnu.org; Mon, 28 Mar 2011 17:57:16 -0400 Received: (qmail 3282 invoked from network); 28 Mar 2011 21:57:09 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 28 Mar 2011 21:57:09 -0000 Message-ID: <4D910425.5070607@draigBrady.com> Date: Mon, 28 Mar 2011 22:56:53 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 References: <4D90F5C4.2030201@redhat.com> In-Reply-To: <4D90F5C4.2030201@redhat.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 28/03/11 21:55, Eric Blake wrote: > cp --attributes-only is great for preserving all metadata attributes > without corrupting contents, but what if I want to preserve only some of > the metadata (for example, copying SELinux context but _not_ timestamps > or content)? It seems like --attributes-only would be a great synonym > for '--preserve=all --no-preserve=contents', and that by adding the > 'contents' category to --preserve (and defaulting it to on unless turned > off explicitly), that you expose finer-grained tuning to what metadata > gets copied. --attr and --preserve can be combined already. Is that enough? Here are the info docs: `--attributes-only' Preserve the specified attributes of the original files in the copy, but do not copy any data. See the `--preserve' option for controlling which attributes to copy. cheers, Pádraig. From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Apr 2012 00:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 8370@debbugs.gnu.org Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.133419138426856 (code B ref 8370); Thu, 12 Apr 2012 00:44:01 +0000 Received: (at 8370) by debbugs.gnu.org; 12 Apr 2012 00:43:04 +0000 Received: from localhost ([127.0.0.1]:52969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SI87r-0006z6-N3 for submit@debbugs.gnu.org; Wed, 11 Apr 2012 20:43:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65182) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SI87o-0006yh-E1 for 8370@debbugs.gnu.org; Wed, 11 Apr 2012 20:43:02 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3C0fnu5019279 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <8370@debbugs.gnu.org>; Wed, 11 Apr 2012 20:41:49 -0400 Received: from [10.36.116.19] (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3C0fkLF011223 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 11 Apr 2012 20:41:48 -0400 Message-ID: <4F8624CA.8000604@draigBrady.com> Date: Thu, 12 Apr 2012 01:41:46 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> In-Reply-To: <4D910425.5070607@draigBrady.com> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q3C0fnu5019279 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) On 03/28/2011 10:56 PM, P=C3=A1draig Brady wrote: > On 28/03/11 21:55, Eric Blake wrote: >> cp --attributes-only is great for preserving all metadata attributes >> without corrupting contents, but what if I want to preserve only some = of >> the metadata (for example, copying SELinux context but _not_ timestamp= s >> or content)? It seems like --attributes-only would be a great synonym >> for '--preserve=3Dall --no-preserve=3Dcontents', and that by adding t= he >> 'contents' category to --preserve (and defaulting it to on unless turn= ed >> off explicitly), that you expose finer-grained tuning to what metadata >> gets copied. >=20 > --attr and --preserve can be combined already. Is that enough? > Here are the info docs: >=20 > `--attributes-only' > Preserve the specified attributes of the original files in the > copy, but do not copy any data. See the `--preserve' option for > controlling which attributes to copy. Cross referencing a related bug report: https://bugzilla.redhat.com/show_bug.cgi?id=3D811746#c1 cheers, P=C3=A1draig. From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Apr 2012 12:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 8370@debbugs.gnu.org Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.133423549812858 (code B ref 8370); Thu, 12 Apr 2012 12:59:02 +0000 Received: (at 8370) by debbugs.gnu.org; 12 Apr 2012 12:58:18 +0000 Received: from localhost ([127.0.0.1]:53489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIJbO-0003LL-0l for submit@debbugs.gnu.org; Thu, 12 Apr 2012 08:58:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49213) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIJbJ-0003LB-R6 for 8370@debbugs.gnu.org; Thu, 12 Apr 2012 08:58:16 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3CCv0oB009008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <8370@debbugs.gnu.org>; Thu, 12 Apr 2012 08:57:00 -0400 Received: from [10.36.116.76] (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3CCuv2D024662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Apr 2012 08:56:59 -0400 Message-ID: <4F86D119.7070908@draigBrady.com> Date: Thu, 12 Apr 2012 13:56:57 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> <4F8624CA.8000604@draigBrady.com> In-Reply-To: <4F8624CA.8000604@draigBrady.com> X-Enigmail-Version: 1.3.2 Content-Type: multipart/mixed; boundary="------------070102050307060302080404" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is a multi-part message in MIME format. --------------070102050307060302080404 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q3CCv0oB009008 On 04/12/2012 01:41 AM, P=C3=A1draig Brady wrote: > On 03/28/2011 10:56 PM, P=C3=A1draig Brady wrote: >> On 28/03/11 21:55, Eric Blake wrote: >>> cp --attributes-only is great for preserving all metadata attributes >>> without corrupting contents, but what if I want to preserve only some= of >>> the metadata (for example, copying SELinux context but _not_ timestam= ps >>> or content)? It seems like --attributes-only would be a great synony= m >>> for '--preserve=3Dall --no-preserve=3Dcontents', and that by adding = the >>> 'contents' category to --preserve (and defaulting it to on unless tur= ned >>> off explicitly), that you expose finer-grained tuning to what metadat= a >>> gets copied. >> >> --attr and --preserve can be combined already. Is that enough? >> Here are the info docs: >> >> `--attributes-only' >> Preserve the specified attributes of the original files in the >> copy, but do not copy any data. See the `--preserve' option for >> controlling which attributes to copy. >=20 > Cross referencing a related bug report: > https://bugzilla.redhat.com/show_bug.cgi?id=3D811746#c1 So thinking a bit more about this, and given the confusion expressed in the above bug report, perhaps it's best to change --attributes-only to _not_ truncate existing files? I think scripts relying on the truncation behavior of this relative new feature would be very rare, and the non truncating behavior is more generally useful. Patch to implement this change is attached. cheers, P=C3=A1draig. --------------070102050307060302080404 Content-Type: text/plain; name="cp-attr-existing.diff" Content-Disposition: attachment; filename="cp-attr-existing.diff" Content-Transfer-Encoding: base64 RnJvbSBmNDFjYTVkMGNlNTMwNDEzNjYxM2RkYWM5MWFkZjIzY2Q4NGNhZDJkIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/UD1DMz1BMWRyYWlnPTIwQnJhZHk/ PSA8UEBkcmFpZ0JyYWR5LmNvbT4KRGF0ZTogVGh1LCAxMiBBcHIgMjAxMiAxMjo0NzozMCAr MDEwMApTdWJqZWN0OiBbUEFUQ0hdIGNwOiBjaGFuZ2UgLS1hdHRyaWJ1dGVzLW9ubHkgdG8g bm90IHRydW5jYXRlIGV4aXN0aW5nIGZpbGVzCgoqIHNyYy9jb3B5LmMgKGNvcHlfcmVnKTog RG9uJ3QgdHJ1bmNhdGUgYW4gZXhpc3RpbmcgZmlsZSwKdG8gc3VwcG9ydCBjb3B5aW5nIGF0 dHJpYnV0ZXMgYmV0d2VlbiBleGlz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QorIyB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLCBlaXRoZXIgdmVyc2lv biAzIG9mIHRoZSBMaWNlbnNlLCBvcgorIyAoYXQgeW91ciBvcHRpb24pIGFueSBsYXRlciB2 ZXJzaW9uLgorCisjIFRoaXMgcHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aGUgaG9wZSB0 aGF0IGl0IHdpbGwgYmUgdXNlZnVsLAorIyBidXQgV0lUSE9VVCBBTlkgV0FSUkFOVFk7IHdp dGhvdXQgZXZlbiB0aGUgaW1wbGllZCB3YXJyYW50eSBvZgorIyBNRVJDSEFOVEFCSUxJVFkg b3IgRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UuICBTZWUgdGhlCisjIEdOVSBH ZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGZvciBtb3JlIGRldGFpbHMuCisKKyMgWW91IHNob3Vs ZCBoYXZlIHJlY2VpdmVkIGEgY29weSBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vu c2UKKyMgYWxvbmcgd2l0aCB0aGlzIHByb2dyYW0uICBJZiBub3QsIHNlZSA8aHR0cDovL3d3 dy5nbnUub3JnL2xpY2Vuc2VzLz4uCisKKy4gIiR7c3JjZGlyPS59L2luaXQuc2giOyBwYXRo X3ByZXBlbmRfIC4uL3NyYworcHJpbnRfdmVyXyBjcAorCitwcmludGYgJzEnID4gZmlsZTEK K3ByaW50ZiAnMicgPiBmaWxlMgorcHJpbnRmICcyJyA+IGZpbGUyLmV4cAorCitjcCAtLWF0 dHJpYnV0ZXMtb25seSBmaWxlMSBmaWxlMiB8fCBmYWlsPTEKK2NtcCBmaWxlMiBmaWxlMi5l eHAgfHwgZmFpbD0xCisKK0V4aXQgJGZhaWwKLS0gCjEuNy42LjQKCg== --------------070102050307060302080404-- From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Apr 2012 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 8370@debbugs.gnu.org, Eric Blake Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.133423955622763 (code B ref 8370); Thu, 12 Apr 2012 14:06:01 +0000 Received: (at 8370) by debbugs.gnu.org; 12 Apr 2012 14:05:56 +0000 Received: from localhost ([127.0.0.1]:54360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIKep-0005v5-6q for submit@debbugs.gnu.org; Thu, 12 Apr 2012 10:05:55 -0400 Received: from mx.meyering.net ([88.168.87.75]:37187) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIKel-0005ur-4A for 8370@debbugs.gnu.org; Thu, 12 Apr 2012 10:05:54 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 43B6560056; Thu, 12 Apr 2012 16:04:36 +0200 (CEST) From: Jim Meyering In-Reply-To: <4F86D119.7070908@draigBrady.com> ("=?UTF-8?Q?P=C3=A1draig?= Brady"'s message of "Thu, 12 Apr 2012 13:56:57 +0100") References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> <4F8624CA.8000604@draigBrady.com> <4F86D119.7070908@draigBrady.com> Date: Thu, 12 Apr 2012 16:04:36 +0200 Message-ID: <87wr5lf3m3.fsf@rho.meyering.net> Lines: 146 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) P=E1draig Brady wrote: ... > So thinking a bit more about this, > and given the confusion expressed in the above bug report, > perhaps it's best to change --attributes-only to > _not_ truncate existing files? > > I think scripts relying on the truncation behavior > of this relative new feature would be very rare, > and the non truncating behavior is more generally useful. > > Patch to implement this change is attached. Thanks for doing this. I prefer the new non-truncating behavior, too. > Subject: [PATCH] cp: change --attributes-only to not truncate existing fi= les > > * src/copy.c (copy_reg): Don't truncate an existing file, > to support copying attributes between existing files. > The original use case only considered creating new files, > and it would be a very unusual use case to be relying > on the truncating behavior. > * doc/coreutils.texi (cp invocation): Mention the non > truncating behavior. > * tests/cp/attr-existing: A new test to ensure O_TRUNC skipped. > * tests/Makefile.am: Reference the new test. > * NEWS: Mention the change in behavior. > --- > NEWS | 5 +++++ > doc/coreutils.texi | 5 +++-- > src/copy.c | 5 ++++- > tests/Makefile.am | 1 + > tests/cp/attr-existing | 29 +++++++++++++++++++++++++++++ > 5 files changed, 42 insertions(+), 3 deletions(-) > create mode 100755 tests/cp/attr-existing > > diff --git a/NEWS b/NEWS > index c8d2bbc..92a2ec4 100644 > --- a/NEWS > +++ b/NEWS > @@ -2,6 +2,11 @@ GNU coreutils NEWS -*= - outline -*- > > * Noteworthy changes in release ?.? (????-??-??) [?] > > +** Changes in behavior > + > + cp --attributes-only no longer truncates the data in existing files, > + allowing for more general copying of attributes from one file to anoth= er. Perhaps "... no longer truncates any existing destination file, ..." ? > diff --git a/doc/coreutils.texi b/doc/coreutils.texi > index 510abb9..9f1d7b9 100644 > --- a/doc/coreutils.texi > +++ b/doc/coreutils.texi > @@ -7650,8 +7650,9 @@ Equivalent to @option{-dR --preserve=3Dall} with th= e reduced diagnostics. > @itemx --attributes-only > @opindex --attributes-only > Preserve the specified attributes of the original files in the copy, > -but do not copy any data. See the @option{--preserve} option for > -controlling which attributes to copy. > +but do not copy any data. Data in existing destination files is not > +truncated. Similarly here. IMHO, it's the file that is being truncated, not its data. Maybe say something like "the data in a destination file is not modified"? > See the @option{--preserve} option for controlling which > +attributes to copy. > > @item -b > @itemx @w{@kbd{--backup}[=3D@var{method}]} > diff --git a/src/copy.c b/src/copy.c > index f63a726..03d68db 100644 > --- a/src/copy.c > +++ b/src/copy.c > @@ -826,7 +826,10 @@ copy_reg (char const *src_name, char const *dst_name, > by the specs for both cp and mv. */ > if (! *new_dst) > { > - dest_desc =3D open (dst_name, O_WRONLY | O_TRUNC | O_BINARY); > + /* We don't truncate with --attributes-only to support > + copying attributes to an existing file. */ > + dest_desc =3D open (dst_name, O_WRONLY | O_BINARY > + | (x->data_copy_required ? O_TRUNC : 0)); What do you think about separating the flag definition and open separate? /* We don't truncate with --attributes-only to support copying attributes to an existing file. */ int flags =3D (O_WRONLY | O_BINARY | (x->data_copy_required ? O_TRUNC : 0)); dest_desc =3D open (dst_name, flags); > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 011051a..4d73a92 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -320,6 +320,7 @@ TESTS =3D \ > chown/separator \ > cp/abuse \ > cp/acl \ > + cp/attr-existing \ > cp/backup-1 \ > cp/backup-dir \ > cp/backup-is-src \ > diff --git a/tests/cp/attr-existing b/tests/cp/attr-existing > new file mode 100755 > index 0000000..9cf0ffc > --- /dev/null > +++ b/tests/cp/attr-existing > @@ -0,0 +1,29 @@ > +#!/bin/sh > +# Make sure cp --attributes-only doesn't truncate existing data > + > +# Copyright 2012 Free Software Foundation, Inc. > + > +# This program is free software: you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation, either version 3 of the License, or > +# (at your option) any later version. > + > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > + > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +. "${srcdir=3D.}/init.sh"; path_prepend_ ../src > +print_ver_ cp > + > +printf '1' > file1 > +printf '2' > file2 > +printf '2' > file2.exp > + > +cp --attributes-only file1 file2 || fail=3D1 > +cmp file2 file2.exp || fail=3D1 > + > +Exit $fail From unknown Sun Jun 22 07:34:27 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Eric Blake Subject: bug#8370: closed (Re: bug#8370: RFC: cp --no-preserve=contents) Message-ID: References: <4F86E923.3050409@redhat.com> <4D90F5C4.2030201@redhat.com> X-Gnu-PR-Message: they-closed 8370 X-Gnu-PR-Package: coreutils Reply-To: 8370@debbugs.gnu.org Date: Thu, 12 Apr 2012 14:42:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1334241723-26185-1" This is a multi-part message in MIME format... ------------=_1334241723-26185-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8370: RFC: cp --no-preserve=3Dcontents 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 8370@debbugs.gnu.org. --=20 8370: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8370 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1334241723-26185-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8370-done) by debbugs.gnu.org; 12 Apr 2012 14:41:07 +0000 Received: from localhost ([127.0.0.1]:54394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILCs-0006mx-E5 for submit@debbugs.gnu.org; Thu, 12 Apr 2012 10:41:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65052) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILCn-0006mV-Vs for 8370-done@debbugs.gnu.org; Thu, 12 Apr 2012 10:41:03 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3CEdk33023667 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Apr 2012 10:39:47 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3CEdknf029855; Thu, 12 Apr 2012 10:39:46 -0400 Message-ID: <4F86E923.3050409@redhat.com> Date: Thu, 12 Apr 2012 08:39:31 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: =?ISO-8859-1?Q?P=E1draig_Brady?= Subject: Re: bug#8370: RFC: cp --no-preserve=contents References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> <4F8624CA.8000604@draigBrady.com> <4F86D119.7070908@draigBrady.com> <87wr5lf3m3.fsf@rho.meyering.net> <4F86E4AE.5080009@draigBrady.com> In-Reply-To: <4F86E4AE.5080009@draigBrady.com> X-Enigmail-Version: 1.4 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig43F0D29B01E4C85F59050590" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 8370-done Cc: 8370-done@debbugs.gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig43F0D29B01E4C85F59050590 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 04/12/2012 08:20 AM, P=E1draig Brady wrote: > On 04/12/2012 03:04 PM, Jim Meyering wrote: >> P=E1draig Brady wrote: >> ... >>> So thinking a bit more about this, >>> and given the confusion expressed in the above bug report, >>> perhaps it's best to change --attributes-only to >>> _not_ truncate existing files? >>> >>> I think scripts relying on the truncation behavior >>> of this relatively new feature would be very rare, >>> and the non truncating behavior is more generally useful. >>> >>> Patch to implement this change is attached. >> >> Thanks for doing this. >> I prefer the new non-truncating behavior, too. >=20 > Cool. >=20 > I'll push with your clean-ups later on. > Eric is it OK to close this bug, > or are there cases not handled yet? > (I didn't fully understand your suggestion TBH). Yes, I closed the bug now. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig43F0D29B01E4C85F59050590 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPhukjAAoJEKeha0olJ0NqhrgH/3h39yhxYQ7p0R1/0Skctb2N ruM20tspYGfj/hkrdTnoF++jAksGw/aLmDo8PVPg5BLwejsOWT757Y6EJqsQijfe 1KsVymbS13ksCaNfR269DHs2MtnsUDO9Eg9YOhuUDM1w/WyjT5t29df9uc5ZR6+r ycrnbinocxiYAxh7fLozwEcCFZZ8kO1ZHTytj4BsOazYguF8dwgIF6zosYna8/or biLDKcf4FpFQQAcNwaL8RdhjW2PAWiNpRM7trFaRK/jXg0dTgQfEjLDnxQ3yNXi4 wtIZIDssejlOXBhApCGziFnY4Lc1zWwsKzpDFZtkU8kU4TmdstGWhpJ+FqG3OnQ= =3QIG -----END PGP SIGNATURE----- --------------enig43F0D29B01E4C85F59050590-- ------------=_1334241723-26185-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Mar 2011 21:05:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4JcW-0000IW-6O for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:05:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4JcS-0000I2-Cq for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:05:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4JcL-0005Po-MO for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:04:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:33095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4JcL-0005O1-6f for submit@debbugs.gnu.org; Mon, 28 Mar 2011 17:04:53 -0400 Received: from [140.186.70.92] (port=48459 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4Jby-0005F1-2h for bug-coreutils@gnu.org; Mon, 28 Mar 2011 17:04:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4JTK-0003vo-Ty for bug-coreutils@gnu.org; Mon, 28 Mar 2011 16:55:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4JTK-0003vU-KK for bug-coreutils@gnu.org; Mon, 28 Mar 2011 16:55:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2SKtXeg003312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Mar 2011 16:55:33 -0400 Received: from [10.3.113.121] (ovpn-113-121.phx2.redhat.com [10.3.113.121]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2SKtWuO019922 for ; Mon, 28 Mar 2011 16:55:33 -0400 Message-ID: <4D90F5C4.2030201@redhat.com> Date: Mon, 28 Mar 2011 14:55:32 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 MIME-Version: 1.0 To: bug-coreutils Subject: RFC: cp --no-preserve=contents X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigD47545B19C2820A4FE3CD880" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -7.9 (-------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.9 (-------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD47545B19C2820A4FE3CD880 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable cp --attributes-only is great for preserving all metadata attributes without corrupting contents, but what if I want to preserve only some of the metadata (for example, copying SELinux context but _not_ timestamps or content)? It seems like --attributes-only would be a great synonym for '--preserve=3Dall --no-preserve=3Dcontents', and that by adding the 'contents' category to --preserve (and defaulting it to on unless turned off explicitly), that you expose finer-grained tuning to what metadata gets copied. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigD47545B19C2820A4FE3CD880 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNkPXEAAoJEKeha0olJ0Nq2xIIAIgj7t1MDzvnHehR470+5EDY FLG7vhN8g54BuTzJeHI2CEkm76nRym/3cGVPkKvOaTmpGP0e89rd+eSfRv0YxmfJ 2oksU0jiaNdOyVX4kiEVajA0u4cwtsTj/G5SJfId8OAGz0zdyE1YxwqXgVhK438v qsSe0sjMJGyPcDMmK43TfL6NFYsVqWkMBNllJcu7kSE2iIXmL0UijrMJEnL097uF u2EWoAOFG6CO/EMyabPVsVjfjlTVhCxMyzYC8BR3BU/TBYdTP06UHSzWZgjNwA84 no0AmA96rhUBoHk9rQiShL6vucuQ/hiybKdSnpOlW+JcoL/pUC3hYn/H+mNZAPA= =n+qO -----END PGP SIGNATURE----- --------------enigD47545B19C2820A4FE3CD880-- ------------=_1334241723-26185-1-- From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Apr 2012 15:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 8370@debbugs.gnu.org, Eric Blake Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.133424301828236 (code B ref 8370); Thu, 12 Apr 2012 15:04:02 +0000 Received: (at 8370) by debbugs.gnu.org; 12 Apr 2012 15:03:38 +0000 Received: from localhost ([127.0.0.1]:54444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILYf-0007LM-5A for submit@debbugs.gnu.org; Thu, 12 Apr 2012 11:03:37 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:42036) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILYb-0007LE-LP for 8370@debbugs.gnu.org; Thu, 12 Apr 2012 11:03:35 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 82DB8A60008; Thu, 12 Apr 2012 08:02:19 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5nTrDuCrIFYU; Thu, 12 Apr 2012 08:02:18 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id A5347A60006; Thu, 12 Apr 2012 08:02:18 -0700 (PDT) Message-ID: <4F86EE75.3040001@cs.ucla.edu> Date: Thu, 12 Apr 2012 08:02:13 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> <4F8624CA.8000604@draigBrady.com> <4F86D119.7070908@draigBrady.com> In-Reply-To: <4F86D119.7070908@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) I like this idea too. Some comments: > Preserve the specified attributes of the original files in the copy, > -but do not copy any data. See the @option{--preserve} option for > -controlling which attributes to copy. > +but do not copy any data. Data in existing destination files is not > +truncated. See the @option{--preserve} option for controlling which > +attributes to copy. The word "data" is plural. But there is no need to talk about truncation: the point is that the file's contents aren't changed at all. Something like this, maybe? Copy only the specified attributes of the source file to the destination. If the destination already exists, do not alter its contents. See the @option{--preserve} option for controlling which attributes to copy. > - dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY); > + /* We don't truncate with --attributes-only to support > + copying attributes to an existing file. */ > + dest_desc = open (dst_name, O_WRONLY | O_BINARY > + | (x->data_copy_required ? O_TRUNC : 0)); The indentation of the flags expression isn't right, and the comment is unnecessary clutter (the code is clear). Perhaps something like this instead? int open_flags = O_WRONLY | O_BINARY | (x->data_copy_required ? O_TRUNC : 0); dest_desc = open (dst_name, open_flags); From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Apr 2012 15:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Jim Meyering Cc: 8370@debbugs.gnu.org, Eric Blake Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.133424337828747 (code B ref 8370); Thu, 12 Apr 2012 15:10:01 +0000 Received: (at 8370) by debbugs.gnu.org; 12 Apr 2012 15:09:38 +0000 Received: from localhost ([127.0.0.1]:54448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILeQ-0007TX-FK for submit@debbugs.gnu.org; Thu, 12 Apr 2012 11:09:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17826) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILeO-0007TQ-6W for 8370@debbugs.gnu.org; Thu, 12 Apr 2012 11:09:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3CF8H0R019151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Apr 2012 11:08:18 -0400 Received: from [10.36.116.76] (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3CEKULC014917 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 12 Apr 2012 10:20:31 -0400 Message-ID: <4F86E4AE.5080009@draigBrady.com> Date: Thu, 12 Apr 2012 15:20:30 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> <4F8624CA.8000604@draigBrady.com> <4F86D119.7070908@draigBrady.com> <87wr5lf3m3.fsf@rho.meyering.net> In-Reply-To: <87wr5lf3m3.fsf@rho.meyering.net> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=ISO-8859-1 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q3CF8H0R019151 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) On 04/12/2012 03:04 PM, Jim Meyering wrote: > P=E1draig Brady wrote: > ... >> So thinking a bit more about this, >> and given the confusion expressed in the above bug report, >> perhaps it's best to change --attributes-only to >> _not_ truncate existing files? >> >> I think scripts relying on the truncation behavior >> of this relatively new feature would be very rare, >> and the non truncating behavior is more generally useful. >> >> Patch to implement this change is attached. >=20 > Thanks for doing this. > I prefer the new non-truncating behavior, too. Cool. I'll push with your clean-ups later on. Eric is it OK to close this bug, or are there cases not handled yet? (I didn't fully understand your suggestion TBH). thanks for the review, P=E1draig. From unknown Sun Jun 22 07:34:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8370: RFC: cp --no-preserve=contents Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 12 Apr 2012 15:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8370 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: 8370@debbugs.gnu.org, Eric Blake Received: via spool by 8370-submit@debbugs.gnu.org id=B8370.133424371129281 (code B ref 8370); Thu, 12 Apr 2012 15:16:02 +0000 Received: (at 8370) by debbugs.gnu.org; 12 Apr 2012 15:15:11 +0000 Received: from localhost ([127.0.0.1]:54456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILjr-0007cD-3S for submit@debbugs.gnu.org; Thu, 12 Apr 2012 11:15:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51272) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SILjo-0007c4-MA for 8370@debbugs.gnu.org; Thu, 12 Apr 2012 11:15:09 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3CFDkAZ024738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Apr 2012 11:13:46 -0400 Received: from [10.36.116.76] (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3CFDhwO028746 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 12 Apr 2012 11:13:45 -0400 Message-ID: <4F86F127.3000905@draigBrady.com> Date: Thu, 12 Apr 2012 16:13:43 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 References: <4D90F5C4.2030201@redhat.com> <4D910425.5070607@draigBrady.com> <4F8624CA.8000604@draigBrady.com> <4F86D119.7070908@draigBrady.com> <4F86EE75.3040001@cs.ucla.edu> In-Reply-To: <4F86EE75.3040001@cs.ucla.edu> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q3CFDkAZ024738 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) On 04/12/2012 04:02 PM, Paul Eggert wrote: > I like this idea too. Some comments: >=20 >> Preserve the specified attributes of the original files in the copy, >> -but do not copy any data. See the @option{--preserve} option for >> -controlling which attributes to copy. >> +but do not copy any data. Data in existing destination files is not >> +truncated. See the @option{--preserve} option for controlling which >> +attributes to copy. >=20 > The word "data" is plural. But there is no need to talk about > truncation: the point is that the file's contents aren't changed at > all. Something like this, maybe? >=20 > Copy only the specified attributes of the source file to the destinat= ion. > If the destination already exists, do not alter its contents. > See the @option{--preserve} option for controlling which attributes t= o copy. >=20 >=20 >> - dest_desc =3D open (dst_name, O_WRONLY | O_TRUNC | O_BINARY); >> + /* We don't truncate with --attributes-only to support >> + copying attributes to an existing file. */ >> + dest_desc =3D open (dst_name, O_WRONLY | O_BINARY >> + | (x->data_copy_required ? O_TRUNC : 0)); >=20 > The indentation of the flags expression isn't right, and the > comment is unnecessary clutter (the code is clear). Perhaps something > like this instead? >=20 > int open_flags =3D > O_WRONLY | O_BINARY | (x->data_copy_required ? O_TRUNC : 0); > dest_desc =3D open (dst_name, open_flags); >=20 Cool. thanks for the review, P=C3=A1draig.