DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5647IxtL800454
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 5647IxtL800454
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=y7W2UZN0
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E07D53851A8E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1751613537;
	bh=r4rIFlijw/hYr8YbvMW1tZRwjMEEmDAbmtvZcdsRrpk=;
	h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=y7W2UZN0PQmRW6ZIdsh0bQTd8SPkH8nDbTpUrWZlKBF0anitmHwPXLn22xT3Dawpz
	 tgMqTMHx0JMitwmJpC2N2WFUsjvNTVZ93B7h+d+MXCeydKYRUrLB1vigyKYwQb2aAc
	 gxdUNhV4sP7I5QcKerYaSHaJDU0MwCQASAAtukw0=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97E043858C56
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 97E043858C56
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751613480; cv=none;
 b=slwtu4HOV9Fth3QbRx6zPxN6O0cukMcdjxzsUp9HA2uAyl3f2GLKSCVANXbtChM4ru7pv0Ac4yvXP7gVvombPfnupY861VYA1ABoWh2C9MMrtXl3OR+FWaDRj5AVkjTNKIVHmu22qQYWiiolnMp1Jz3ANQmlzcvcC7LjLt9KgkI=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1751613480; c=relaxed/simple;
 bh=mvqUGK4CXx1EnhPIfOaj0NN6f4xPTfpoFv4eNRtcGuk=;
 h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
 b=M+G7RKDYLcJIo69WK4bTFMk/AuEETnvt0gPwd5AkwKvnK7Hl8wxH/UTpQceZ0CQa53krZMJi8bUedY2nvnNejd/uSy5rPbKFf+uh2YKTz7HWZnaOzne7tb3XwuqIolu0X2tj0TYN1m+6z6uyJyxNClEMnK7CXXSfNQbe1GnrjYk=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97E043858C56
Message-ID: <103dbb12-14f9-4ba7-a601-e700e80936fd@holgerdanske.com>
Date: Fri, 4 Jul 2025 00:17:51 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Misleading (irritating) output from cp
To: cygwin@cygwin.com
References: <AS8P189MB142953E18F990E3E3D069CBAA442A@AS8P189MB1429.EURP189.PROD.OUTLOOK.COM>
Content-Language: en-US
In-Reply-To: <AS8P189MB142953E18F990E3E3D069CBAA442A@AS8P189MB1429.EURP189.PROD.OUTLOOK.COM>
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: David Christensen via Cygwin <cygwin@cygwin.com>
Reply-To: David Christensen <dpchrist@holgerdanske.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 5647IxtL800454

On 7/3/25 22:18, Fergus Daly via Cygwin wrote:
> If you try
> $ cp -v existingfile existingdirectory
> you get feedback
> 'existingfile' -> 'existingdirectory/existingfile'
> which is just fine. (Omitting the switch -v silences the feedback: also fine.)
> Whereas: if you try
> $ cp -v existingfile nonexistingdirectory
> you get feedback (two lines)
> 'existingfile' -> 'nonexistingdirectory'
> /bin/cp: cannot create regular file: No such file or directory
> of which the 2nd line is useful advice but the 1st line is just a bit misleading / irritating / .. difficult to ignore .. whatever.
> (Try the same / similar thing with any other command e.g. rm e.g. md5sum and you just get the 2nd line advice.)
> Try
> $ cp -v existingfile nonexistingdirectory 2> /dev/null
> then you suppress line 2 as required; but you still get line 1 which now is _very_ misleading / _very_ irritating!
> This "feature" is matched in Linux.
> Maybe a small thing but not to me. (Where it occurs it rather screws up the smooth evolution of session logs.)
> Does anybody know of a way of suppressing the 1st line feedback?
> Thank you!


I use Windows/Cygwin, Debian GNU/Linux, FreeBSD, and macOS.  The first 
two have GNU "userland" while the latter two have FreeBSD "userland". 
Both userlands provide commands with identical names (including "cp), 
but those commands accept different sets of options and can behave 
differently in subtle or not-so-subtle ways.  Moving between platforms 
and using the terminal can be maddening.  Similarly, trying to write 
multi-platform shell scripts.


Here are your first two examples on Debian GNU/Linux:

2025-07-03 23:15:31 dpchrist@laalaa ~
$ cat /etc/debian_version; uname -a
11.11
Linux laalaa 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) 
x86_64 GNU/Linux

2025-07-03 23:16:03 dpchrist@laalaa ~
$ touch foo

2025-07-03 23:16:12 dpchrist@laalaa ~
$ mkdir bar

2025-07-03 23:16:14 dpchrist@laalaa ~
$ cp -v foo bar
'foo' -> 'bar/foo'

2025-07-03 23:16:46 dpchrist@laalaa ~
$ cp -v foo bar/baz/quux
'foo' -> 'bar/baz/quux'
cp: cannot create regular file 'bar/baz/quux': No such file or directory


So, GNU/Linux cp option -v seems to match Windows/Cygwin.


Here are the same examples on FreeBSD:

2025-07-03 23:17:29 dpchrist@f5 ~
$ freebsd-version -kru
13.5-RELEASE
13.5-RELEASE
13.5-RELEASE-p1

2025-07-03 23:17:41 dpchrist@f5 ~
$ touch foo

2025-07-03 23:17:45 dpchrist@f5 ~
$ mkdir bar

2025-07-03 23:17:48 dpchrist@f5 ~
$ cp -v foo bar
foo -> bar/foo

2025-07-03 23:17:52 dpchrist@f5 ~
$ cp -v foo bar/baz/quux
cp: bar/baz/quux: No such file or directory


So, FreeBSD cp option -v seems to match your expectations.


David


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

