GNU bug report logs - #15727
doc: cp: expand dirs-vs-files with -f/--remove-dest

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: Linda Walsh <coreutils@HIDDEN>; dated Sun, 27 Oct 2013 03:49:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'doc: cp: expand dirs-vs-files with -f/--remove-dest' from 'cp: "cp -af" breaks if one of files is a dir and other not' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 11 Jan 2019 09:17:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 11 04:17:46 2019
Received: from localhost ([127.0.0.1]:54540 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ghswk-0003eb-0D
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2019 04:17:46 -0500
Received: from mail-it1-f172.google.com ([209.85.166.172]:34829)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1ghswg-0003eG-84; Fri, 11 Jan 2019 04:17:44 -0500
Received: by mail-it1-f172.google.com with SMTP id p197so2105614itp.0;
 Fri, 11 Jan 2019 01:17:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=HZOGH4aaV1O8hFqX2wZgRHblPXAK/6Pci5Co+hX2W5w=;
 b=T+VO5/wYUQNEeV1vXGoIuLb7LrlyM4a2fq4XgnAjkLon1MNSMoDUB+Ke/HieRnFzgb
 LmmOJFvVQYxzn+XpsEVyBT/XzZJm27cVj1fdqfZiBHL7oFTvr7oxp5v/6qmgYuT3Q0Ih
 1x9J/u0Hm7Xxsh9lV2SY3/MCSdZhG4O53K0bHhNj5lO/prEbFiEspvVIZc6SgLIaBhEk
 9zNs0raw0V6erxHkPVGCbhH0IvkNBvlW3XLMNSBU8eB9e5N1e4ZDc5p/Z3oddEq4ezqc
 DlJCj+RliuhciE8jL+ECoCVUaSoJQ5kpYQf0/MIAaNEhLVEVbrLED5jtvW2OJhZEqz9H
 6nyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=HZOGH4aaV1O8hFqX2wZgRHblPXAK/6Pci5Co+hX2W5w=;
 b=bLGWaTgasTtVmhv3l9ueRnWvjs3gFnjba6UAbw9uRfpux68sjqZHiOUpbsinsqtNIP
 eDWSCgwf4gCX5AttxLK7aZp2y0qukGP071h+z7etnRua9d+nmlUf7aYKSk0R+NU2Enh2
 P0Y7a7t4BSTjfJNSXymBCSgDsslt1QkHCDpoyYHTJ5KNhA/zHIQdd2ZAysSd85sjXWTu
 bC0WI9dbpfI5qN8wIqmWNnl5naA9F4906XIIhL1U6DHaUXEA7ECzVMEQp9XlKzgg3rPg
 +GoZXPfE24Ewf4IkMWyeMsP1yVUlKLZIfS9DHhJMByn9P/2ixjtKneB+trVWwK/OPCrZ
 Svvw==
X-Gm-Message-State: AJcUukedO9OpFy4siOBDANcvXVjsqQQ3ObbltpKIQui+FHszbvkQzulj
 Qnn8b7+lA5DknFgwQwtiFAiLeM+a
X-Google-Smtp-Source: ALg8bN60dfnO2CoSuF4K2UiwW7plAAAnzLdXYEprRTHYxDWsvOstU/uD7GeWUH3HQT8O8mpjGexxvg==
X-Received: by 2002:a02:7e5d:: with SMTP id h90mr10081303jac.106.1547198255917; 
 Fri, 11 Jan 2019 01:17:35 -0800 (PST)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 u126sm476031ita.1.2019.01.11.01.17.34
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 11 Jan 2019 01:17:35 -0800 (PST)
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
To: Linda Walsh <coreutils@HIDDEN>,
 Bernhard Voelker <mail@HIDDEN>
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
 <526E0DBB.9050900@HIDDEN> <526ECF6E.2030604@HIDDEN>
 <526EDF9F.30308@HIDDEN>
 <1119684184.168186.1383045899448.open-xchange@HIDDEN>
 <526FFC52.7060003@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <6f3ae774-b1e9-a568-7dbf-5527b3c76761@HIDDEN>
Date: Fri, 11 Jan 2019 02:17:33 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.4.0
MIME-Version: 1.0
In-Reply-To: <526FFC52.7060003@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 15727
Cc: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@HIDDEN>, 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 15727 wishlist
retitle 15727 doc: cp: expand dirs-vs-files with -f/--remove-dest
stop


Hello,

On 2013-10-29 12:20 p.m., Linda Walsh wrote:
[...]
> You need to make the docs much more clear about "cp"s limitations.
> 
> update isn't eally update, and -T is certainly wrong at the very
> least.  If you feel you'd rather document cp's limitations,
> that's fine...
> 
> cp is a great tool, don't get me wrong!  But when it added update
> and -T, --remove-destination, it started inferring or promising
> more than you were willing to deliver.  That should be documented.

Based on the above (as the result of the long discussion),
I'm marking this as a documentation wish-list item:

clarify that "-f" and "--remove-destination" won't replace a file
with a directory (as explained by Pádraig and Bernhard in the thread).

Similarly for related limitations of "-T".

regards,
  - assaf








Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.
Changed bug title to 'cp: "cp -af" breaks if one of files is a dir and other not' from 'Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 29 Oct 2013 18:20:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 29 14:20:14 2013
Received: from localhost ([127.0.0.1]:51466 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VbDtl-0007cM-3Y
	for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 14:20:13 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52931)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>) id 1VbDtj-0007cC-8A
 for 15727 <at> debbugs.gnu.org; Tue, 29 Oct 2013 14:20:12 -0400
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 r9TIK26M071778; Tue, 29 Oct 2013 11:20:04 -0700
Message-ID: <526FFC52.7060003@HIDDEN>
Date: Tue, 29 Oct 2013 11:20:02 -0700
From: Linda Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Bernhard Voelker <mail@HIDDEN>
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
 <526E0DBB.9050900@HIDDEN> <526ECF6E.2030604@HIDDEN>
 <526EDF9F.30308@HIDDEN>
 <1119684184.168186.1383045899448.open-xchange@HIDDEN>
In-Reply-To: <1119684184.168186.1383045899448.open-xchange@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 15727
Cc: Pádraig Brady <P@HIDDEN>, 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)




> So why not enhance rsync regarding performance?
----
It's designed for slow, remote copies.  It special-cases local copies, but
uses much of the of the old code.  It also follows it's
manpage.  It also does id translation and storage of ACL's and
Xattrs on file systems that don't support it.  It has a complete
different set of requirements.

cp was designed for locally mounted file systems.  Having
cp really be able to do "updates" with -u and really treat
destinations as files (-T) and really remove destinations
before attempting a copy, seems much more reasonable in line
with what cp should do.


> 
>>   For that matter, 'cp' could _relearn_ a thing
>> or two from 'dd' when it comes to speed.
> 
> IMO no: this would add further bloat to the sources
> which in turn is harder to maintain.  Ever looked at
> copy.c, e.g. at copy_internal()?
---
Yes.  It's grown considerably in the past few years.  But the main
thing it could relearn from 'dd' is using larger buffer sizes.

It's only half the speed of DD, so it's not like it's *that* slow.
(vs. rsync, being ~32x slower for a LAN mounted file to a local copy).

Where as cp from ~5 years ago used to be about 80% the speed of 'dd'.

So cp's speed has dropped by ~33%...

That's what I meant by "relearn" a thing to two from dd.

(likely in regards to buffer size, where on dd I'll specify 16M for
over LAN copies.

>> fast as 'dd', but now that often doesn't seem to be the case.
> 
> hmm, well, could it be that this is because many features have
> been added over the years? ...
----
possibly -- but if it used larger buffer sizes, that problem would
mostly go away.  Like I said -- it's not that much worse that 'dd'.



> I think rm is simply not the right tool for such kind
> of synchronization.
----
synchronization implies deleting files on target that don't exist
on source.  That's not updating or "treating remote as file" for
purposes of update (-T)


You need to make the docs much more clear about "cp"s limitations.

update isn't eally update, and -T is certainly wrong at the very
least.  If you feel you'd rather document cp's limitations,
that's fine...

cp is a great tool, don't get me wrong!  But when it added update
and -T, --remove-destination, it started inferring or promising
more than you were willing to deliver.  That should be documented.

To be honest, I missed the 'file' bit in --remove-destination and
focused on how it was different from -f in removing the destination
before the copy (manpage says to contrast w/-f)...

That still doesn't let it off the hook w/regards to "-T" where it
doesn't treat the destination as a file and remove it first.





Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Oct 2013 16:07:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 29 12:07:13 2013
Received: from localhost ([127.0.0.1]:51354 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VbBp3-00048x-5u
	for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 12:07:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44791)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <pth@HIDDEN>) id 1VbBp0-00048i-Kd
 for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 12:07:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pth@HIDDEN>) id 1VbBoo-0001rw-8O
 for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 12:07:05 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:49114)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <pth@HIDDEN>)
 id 1VbBoo-0001rs-5X
 for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 12:06:58 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46483)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <pth@HIDDEN>)
 id 1VbBoh-0007ns-SF
 for bug-coreutils@HIDDEN; Tue, 29 Oct 2013 12:06:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pth@HIDDEN>) id 1VbBob-0001qn-Kz
 for bug-coreutils@HIDDEN; Tue, 29 Oct 2013 12:06:51 -0400
Received: from cantor2.suse.de ([195.135.220.15]:35800 helo=mx2.suse.de)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <pth@HIDDEN>)
 id 1VbBob-0001qR-FS
 for bug-coreutils@HIDDEN; Tue, 29 Oct 2013 12:06:45 -0400
Received: from relay2.suse.de (unknown [195.135.220.254])
 by mx2.suse.de (Postfix) with ESMTP id DCCCEA5D7F
 for <bug-coreutils@HIDDEN>; Tue, 29 Oct 2013 17:06:43 +0100 (CET)
Date: Tue, 29 Oct 2013 17:06:43 +0100
From: Philipp Thomas <pth@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
Message-ID: <20131029160643.GB14231@HIDDEN>
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
 <526E0DBB.9050900@HIDDEN> <526ECF6E.2030604@HIDDEN>
 <526EDF9F.30308@HIDDEN>
 <1119684184.168186.1383045899448.open-xchange@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1119684184.168186.1383045899448.open-xchange@HIDDEN>
X-Operating-System: openSUSE - Kernel Linux 3.11.3-1-desktop x86_64
Organization: SUSE LINUX Products GmbH, =?iso-8859-1?Q?G?=
 =?iso-8859-1?Q?F=3A_Jeff_Hawn=2C_Jennifer_Guild=2C_Felix_Imend=F6rffer=2C?=
 =?iso-8859-1?Q?_HRB_21284_=28AG_N=FCrnberg=29?=
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

* Bernhard Voelker (mail@HIDDEN) [20131029 12:26]:

> hmm, well, could it be that this is because many features have
> been added over the years? ...

Leave alone checks that cp needs to do but dd doesn't.

Philipp




Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 29 Oct 2013 11:25:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 29 07:25:14 2013
Received: from localhost ([127.0.0.1]:50805 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Vb7Q9-0004AT-32
	for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 07:25:13 -0400
Received: from moutng.kundenserver.de ([212.227.17.9]:54273)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mail@HIDDEN>) id 1Vb7Q4-0004AA-VI
 for 15727 <at> debbugs.gnu.org; Tue, 29 Oct 2013 07:25:10 -0400
Received: from oxbaltgw06.schlund.de (oxbaltgw06.schlund.de [172.19.246.12])
 by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis)
 id 0MZK36-1VGHiB1wQW-00Kz3m; Tue, 29 Oct 2013 12:24:59 +0100
Date: Tue, 29 Oct 2013 12:24:59 +0100 (CET)
From: Bernhard Voelker <mail@HIDDEN>
To: Linda Walsh <coreutils@HIDDEN>
Message-ID: <1119684184.168186.1383045899448.open-xchange@HIDDEN>
In-Reply-To: <526EDF9F.30308@HIDDEN>
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
 <526E0DBB.9050900@HIDDEN> <526ECF6E.2030604@HIDDEN>
 <526EDF9F.30308@HIDDEN>
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Priority: 3
Importance: Medium
X-Mailer: Open-Xchange Mailer v7.2.2-Rev25
X-Provags-ID: V02:K0:S/PAa3/2y+xpnANVNdExMQmzRmtxaUzGB1ANsB/oDBR
 V9SbjiH4/ZTxBs+pzpTOyLXbhoIx6BHoe/F5nDDdwpLCS8db07
 FOf6h4EYvrdNSpOdtgn6PQsmqETsBp3tdXLrUthvYASOEar2MR
 8u3VZ3ZcnoU8W5SkEZIZkqpHNrjpc0msHeIM7y5011X7y2TrMG
 iPYPOQLZGRAJ25ECxdu5P9JmUotilx2efAhmAGKIJRq59K7qlV
 rmtRdPar1V2q3330wwdGNL6Hhcyof7t9gxopSvMooykrx6W+X2
 fPvd9Cip5lEwmgHzMem5meeMCOEM+FH3kdXr6KRaN9L/Fx8SeG
 RWVXtVTeoHaCB9euFMbNjBY0M827CY9z9VFIorch3+32/1maf6
 6+lxkjxB5SxGqKxHpwRH9Ik3jjRuKmfG0U=
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 15727
Cc: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>, 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: Bernhard Voelker <mail@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

> On October 28, 2013 at 11:05 PM Linda Walsh <coreutils@HIDDEN> wrote:
> On 10/28/2013 1:56 PM, Bernhard Voelker wrote:
>> [...]=C2=A0 Tools like rsync may be better for such a scenario
>> than cp(1) which is made primarily to

> [...]=C2=A0 As for 'rsync', it's speed is *comparatively* abysmal
> for local-to-local copies.

So why not enhance rsync regarding performance?

>=C2=A0 For that matter, 'cp' could _relearn_ a thing
> or two from 'dd' when it comes to speed.

IMO no: this would add further bloat to the sources
which in turn is harder to maintain.=C2=A0 Ever looked at
copy.c, e.g. at copy_internal()?
http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/copy.c#n1598

>=C2=A0 Used to be that cp was nearly as
> fast as 'dd', but now that often doesn't seem to be the case.

hmm, well, could it be that this is because many features have
been added over the years? ...

I think rm is simply not the right tool for such kind
of synchronization.

Have a nice day,
Berny




Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 28 Oct 2013 22:05:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 28 18:05:32 2013
Received: from localhost ([127.0.0.1]:49986 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VauwF-0007O1-QL
	for submit <at> debbugs.gnu.org; Mon, 28 Oct 2013 18:05:32 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:33262)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>) id 1VauwC-0007Ns-L4
 for 15727 <at> debbugs.gnu.org; Mon, 28 Oct 2013 18:05:29 -0400
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 r9SM5Koa005036; Mon, 28 Oct 2013 15:05:22 -0700
Message-ID: <526EDF9F.30308@HIDDEN>
Date: Mon, 28 Oct 2013 15:05:19 -0700
From: Linda Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Bernhard Voelker <mail@HIDDEN>
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
 <526E0DBB.9050900@HIDDEN> <526ECF6E.2030604@HIDDEN>
In-Reply-To: <526ECF6E.2030604@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 15727
Cc: Pádraig Brady <P@HIDDEN>, 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)



On 10/28/2013 1:56 PM, Bernhard Voelker wrote:
>>  If you don't care what's in the destination at all,
>>   why not just rm it before the copy?
>>
>> "--remove-destination" option is supposed to do?
> "info coreutils 'cp invocation'" says:
----
    But if I specify "-a" or "-r" those imply recursive.  Why has it been
assumed that recursive doesn't mean to remove files (and then empty directories)
on the target?

>> Also note, I tried to use it with the "update" option, [...]
> 
> ... and it may be a question to discuss whether --remove-destination
> should be able to rmdir() emtpy directories, but that GNU extension
> should never help you out in the case of non-empty directories.
---
	But if combined with "recursive"?  There's also the -T
option which says to treat the destination as a "file" and not a "dir" --
which could be construed as a deliberate choice on the part of the user
to circumvent restrictions on directory removal -- i.e. specifically
since its intent is to ignore the fact that the target is a directory and
to treat it as a file.


> I got the overall impression that you try to sync a source to a
> destination.  Tools like rsync may be better for such a scenario
> than cp(1) which is made primarily to
> 
>   cp: copy files and directories
----
     That was true until various options (and restrictions) were added.
"-f" used to be more forceful about removing obstacles (though I can't say
it ever used to override directory restrictions).  But adding to it's copy
'mission', --update, and --remove-destination, but gave a basis for expanding
the definition of cp.  As for 'rsync', it's speed is *comparatively* abysmal
for local-to-local copies.  For that matter, 'cp' could _relearn_ a thing
or two from 'dd' when it comes to speed.  Used to be that cp was nearly as
fast as 'dd', but now that often doesn't seem to be the case.

     I'm fine with the idea of requiring a '__GNU_ENHANCEMENTS__=[list]'
option in the ENV, or consulting an "rc" file in
something like (~/.rc/Gnu/<package|tool>|/etc/Gnu/coreutils) that
could list areas to override restrictions & feature removals like:
(cp_dir_restrictions,rm_dot_override[etc] to restore or allow
enhancements beyond the growing, posix-restrictions.  Even a
posix=pre2003 would be useful, since it was about the 2003 updates
that started changing posix from descriptive to proscriptive.

    Please remember the idea behind things like 'ksh' and 'bash' (bourne-again)
were to allow features not in the original posix spec --- many of which posix
eventually accepted.  If there is nothing that provides an outlet for these,
posix will only devolve instead of evolve.  FSF/Gnu used to offer evolutionary
options over posix -- but now... it seems fsf/gnu has decided to submit to
the posix restrictions as a ceiling.  I still assert that any posix rules
that go beyond the original POSIX mission statement to be Descriptive
(or to provide for minimum requirements/features) that move into *proscriptive*,
or disallowal of features is, by definition outside the bounds of the
original POSIX and shouldn't really be abusing the name (I *liked* POSIX up
until it started removing features!)....


> Have a nice day,
---
Cheers!





Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 28 Oct 2013 20:56:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 28 16:56:26 2013
Received: from localhost ([127.0.0.1]:49867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VatrO-0004cI-2Q
	for submit <at> debbugs.gnu.org; Mon, 28 Oct 2013 16:56:26 -0400
Received: from moutng.kundenserver.de ([212.227.17.9]:60596)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mail@HIDDEN>) id 1VatrL-0004c4-0J
 for 15727 <at> debbugs.gnu.org; Mon, 28 Oct 2013 16:56:24 -0400
Received: from [192.168.1.11] (p5499C6C3.dip0.t-ipconnect.de [84.153.198.195])
 by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis)
 id 0MCqF1-1VRrAK1qUN-009gH6; Mon, 28 Oct 2013 21:56:15 +0100
Message-ID: <526ECF6E.2030604@HIDDEN>
Date: Mon, 28 Oct 2013 21:56:14 +0100
From: Bernhard Voelker <mail@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130329 Thunderbird/17.0.5
MIME-Version: 1.0
To: Linda Walsh <coreutils@HIDDEN>
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
 <526E0DBB.9050900@HIDDEN>
In-Reply-To: <526E0DBB.9050900@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Provags-ID: V02:K0:k3b1fsx/FTh9uxylZW4tJcf9QIeTOj2o3k7CJBlO19/
 At+KbfGnozPCl7kOi1rr9mjCulp/BcWG7ysLzCT1cUA0j/aqYg
 J+yEx15Ay6EMkR+1yKnKawNtduGr6Fo/1RO4hLCHIKsfV2W/Mi
 oxQC0FixnVKjeAIqqI6KolF+usTSMzuWuMBIjuSIids6NMg2xM
 XbgsNeGsUcLg96kIj79h69uhq9++n4l77JCXwwqQ4GcylFv32N
 iWlRtoLhFbGslYNy5W77xtcpZRBa7AqPXDI237Jz5N0vj1TRIe
 gt7ahw6lL4yOrD4B2u9FaNTsuHUtqRAGqFOBuI8p5nA781XdMc
 GYYXzLHSiJfvOZ/a09iHXUiH+pDe7qOwfA1t+BivA
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 15727
Cc: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>, 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi Linda,

On 10/28/2013 08:09 AM, Linda Walsh wrote:
> On 10/27/2013 5:38 PM, Pádraig Brady wrote:
>> So overwriting files with dirs and vice versa
>> is prohibited by POSIX.  The existing cp options
>> do not adjust this aspect. If you don't care what's
>> in the destination at all, why not just rm it before the copy?
> 
> 
> Um --- isn't that what the "--remove-destination" option is supposed to
> do?

"info coreutils 'cp invocation'" says:

  `--remove-destination'
       Remove each existing destination file before attempting to open it
       (contrast with `-f' above).

In this case, "file" really means a regular file (or socket, fifo, ...)
but no directory.  The documentation could be clearer about that ...

> Also note, I tried to use it with the "update" option, [...]

... and it may be a question to discuss whether --remove-destination
should be able to rmdir() emtpy directories, but that GNU extension
should never help you out in the case of non-empty directories.
I got the overall impression that you try to sync a source to a
destination.  Tools like rsync may be better for such a scenario
than cp(1) which is made primarily to

  cp: copy files and directories

Have a nice day,
Berny




Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 28 Oct 2013 07:09:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 28 03:09:57 2013
Received: from localhost ([127.0.0.1]:48093 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VagxY-0004v3-40
	for submit <at> debbugs.gnu.org; Mon, 28 Oct 2013 03:09:56 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:34193)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>) id 1VagxS-0004uo-Hr
 for 15727 <at> debbugs.gnu.org; Mon, 28 Oct 2013 03:09:51 -0400
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 r9S79kKp053766; Mon, 28 Oct 2013 00:09:49 -0700
Message-ID: <526E0DBB.9050900@HIDDEN>
Date: Mon, 28 Oct 2013 00:09:47 -0700
From: Linda Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Pádraig Brady <P@HIDDEN>
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
References: <526C8CFF.9060804@HIDDEN> <526DB1F1.6080309@HIDDEN>
In-Reply-To: <526DB1F1.6080309@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 15727
Cc: 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)



On 10/27/2013 5:38 PM, Pádraig Brady wrote:
> So overwriting files with dirs and vice versa
> is prohibited by POSIX.  The existing cp options
> do not adjust this aspect. If you don't care what's
> in the destination at all, why not just rm it before the copy?


Um --- isn't that what the "--remove-destination" option is supposed to
do?


Also note, I tried to use it with the "update" option, since in my real
case, in "/var/log", some programs had changed from using a single
log file to using their own dir under /var/log and multiple log files.

It's not like I'm making that up.

As for the posix comment.  Since when is FSF/Gnu governed by a
corporate controlled POSIX?  I.e. POSIX is supposed to supply
interop standards, not limitations on functionality.






Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at 15727 <at> debbugs.gnu.org:


Received: (at 15727) by debbugs.gnu.org; 28 Oct 2013 00:38:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 27 20:38:22 2013
Received: from localhost ([127.0.0.1]:47933 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Vaaqb-0002Zk-W0
	for submit <at> debbugs.gnu.org; Sun, 27 Oct 2013 20:38:22 -0400
Received: from mail2.vodafone.ie ([213.233.128.44]:65530)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1VaaqW-0002ZS-Q1
 for 15727 <at> debbugs.gnu.org; Sun, 27 Oct 2013 20:38:17 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApQBAEKxbVJtTWgW/2dsb2JhbAANS4cmuFKCeoEygxkBAQEEIw8BRhALDQEKAgIFFgQHAgIJAwIBAgFFBg0BBwEBiAikbnaSE4EpjXkzB4JqgUIDnmyNDYE+
Received: from unknown (HELO [192.168.1.79]) ([109.77.104.22])
 by mail2.vodafone.ie with ESMTP; 28 Oct 2013 00:38:10 +0000
Message-ID: <526DB1F1.6080309@HIDDEN>
Date: Mon, 28 Oct 2013 00:38:09 +0000
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130110 Thunderbird/17.0.2
MIME-Version: 1.0
To: Linda Walsh <coreutils@HIDDEN>
Subject: Re: bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>)
 breaks if one of files is a dir and other not
References: <526C8CFF.9060804@HIDDEN>
In-Reply-To: <526C8CFF.9060804@HIDDEN>
X-Enigmail-Version: 1.5.2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 15727
Cc: 15727 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 10/27/2013 03:48 AM, Linda Walsh wrote:
> 
> I was trying to update a copy of /var (=>/root2/var).
> It issues non-fatal, failure messages when copying from or to
> a non-dir entry to a dir entry.
> 
> I tried -a to force the removal of the target dir, or target file.
> 
> It didn't work.
> 
> I tried --remove-destination, which is clearly not "file" specific
> (i.e. should remove dir), it didn't work either.
> 
> The problem doesn't happen with pipes or sockets overwriting
> files or any combo... seems just dirs are a problem.
> 
> mkdir a
> touch a/file2dir
> mkdir a/dir2file
> cp -a a b
> mv a/file2dir a/x
> mv a/dir2file a/file2dir
> mv a/x a/dir2file
> ---
> state=
> 
>> ll a b
> a:
> total 0
> -rw-rw-r-- 1 0 Oct 26 20:37 dir2file
> drwxrwxr-x 2 6 Oct 26 20:37 file2dir/
> b:
> total 0
> drwxrwxr-x 2 6 Oct 26 20:37 dir2file/
> -rw-rw-r-- 1 0 Oct 26 20:37 file2dir
> 
> now try copying new changes from 'a' to 'b' -- can't do it.
> 
>> cp -a a/. b/.
> cp: cannot overwrite non-directory ‘b/././file2dir’ with directory ‘a/./file2dir’
> cp: cannot overwrite directory ‘b/././dir2file’ with non-directory
> 
> 
> -a/--archive is suppose to duplicate *types* on the target -- it should
> be able to make either change without --force or pre-removal,
> HOWEVER,
> 
> I'd suggest
> 1) allowing directories to overwrite files as that seems reasonable...t
> and
> 2) with either -f OR --remove-destination, a file would overwrite a directory (dir removed).
> 2b)  One might argue that with -f, where dest is a file the failure comes first, aborting a try
> for removal; however, certainly, with --remove-destination, the destination (whatever it is)
> should be removed 1st and no error should be occurring.
> 
> Version: (on suse linux)...
> 
> cp (GNU coreutils) 8.21 - Copyright (C) 2013

So overwriting files with dirs and vice versa
is prohibited by POSIX.  The existing cp options
do not adjust this aspect. If you don't care what's
in the destination at all, why not just rm it before the copy?

thanks,
Pádraig.




Information forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Oct 2013 03:48:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 26 23:48:51 2013
Received: from localhost ([127.0.0.1]:46793 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VaHLP-0002AD-4F
	for submit <at> debbugs.gnu.org; Sat, 26 Oct 2013 23:48:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39266)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>) id 1VaHLM-00029y-I2
 for submit <at> debbugs.gnu.org; Sat, 26 Oct 2013 23:48:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaHL8-0002P4-Ud
 for submit <at> debbugs.gnu.org; Sat, 26 Oct 2013 23:48:43 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51501)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaHL8-0002P0-Rd
 for submit <at> debbugs.gnu.org; Sat, 26 Oct 2013 23:48:34 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40980)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaHL2-0004PK-R8
 for bug-coreutils@HIDDEN; Sat, 26 Oct 2013 23:48:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaHKu-0002N2-JE
 for bug-coreutils@HIDDEN; Sat, 26 Oct 2013 23:48:28 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:52668)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaHKu-0002MX-AL
 for bug-coreutils@HIDDEN; Sat, 26 Oct 2013 23:48:20 -0400
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 r9R3mFvI066902
 for <bug-coreutils@HIDDEN>; Sat, 26 Oct 2013 20:48:17 -0700
Message-ID: <526C8CFF.9060804@HIDDEN>
Date: Sat, 26 Oct 2013 20:48:15 -0700
From: Linda Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-coreutils@HIDDEN
Subject: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of
 files is a dir and other not
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.tlinx.org id
 r9R3mFvI066902
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


I was trying to update a copy of /var (=3D>/root2/var).
It issues non-fatal, failure messages when copying from or to
a non-dir entry to a dir entry.

I tried -a to force the removal of the target dir, or target file.

It didn't work.

I tried --remove-destination, which is clearly not "file" specific
(i.e. should remove dir), it didn't work either.

The problem doesn't happen with pipes or sockets overwriting
files or any combo... seems just dirs are a problem.

mkdir a
touch a/file2dir
mkdir a/dir2file
cp -a a b
mv a/file2dir a/x
mv a/dir2file a/file2dir
mv a/x a/dir2file
---
state=3D

> ll a b
a:
total 0
-rw-rw-r-- 1 0 Oct 26 20:37 dir2file
drwxrwxr-x 2 6 Oct 26 20:37 file2dir/
b:
total 0
drwxrwxr-x 2 6 Oct 26 20:37 dir2file/
-rw-rw-r-- 1 0 Oct 26 20:37 file2dir

now try copying new changes from 'a' to 'b' -- can't do it.

> cp -a a/. b/.
cp: cannot overwrite non-directory =E2=80=98b/././file2dir=E2=80=99 with =
directory =E2=80=98a/./file2dir=E2=80=99
cp: cannot overwrite directory =E2=80=98b/././dir2file=E2=80=99 with non-=
directory


-a/--archive is suppose to duplicate *types* on the target -- it should
be able to make either change without --force or pre-removal,
HOWEVER,

I'd suggest
1) allowing directories to overwrite files as that seems reasonable...t
and
2) with either -f OR --remove-destination, a file would overwrite a direc=
tory=20
(dir removed).
2b)  One might argue that with -f, where dest is a file the failure comes=
 first,=20
aborting a try
for removal; however, certainly, with --remove-destination, the destinati=
on=20
(whatever it is)
should be removed 1st and no error should be occurring.

Version: (on suse linux)...

cp (GNU coreutils) 8.21 - Copyright (C) 2013






Acknowledgement sent to Linda Walsh <coreutils@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#15727; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 11 Jan 2019 09:30:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.