delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/07/04/03:19:00

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 AT delorie DOT 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 AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT 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 AT cygwin DOT com
References: <AS8P189MB142953E18F990E3E3D069CBAA442A AT AS8P189MB1429 DOT EURP189 DOT PROD DOT OUTLOOK DOT COM>
In-Reply-To: <AS8P189MB142953E18F990E3E3D069CBAA442A@AS8P189MB1429.EURP189.PROD.OUTLOOK.COM>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: David Christensen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: David Christensen <dpchrist AT holgerdanske DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
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 AT 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 AT laalaa ~
$ touch foo

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

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

2025-07-03 23:16:46 dpchrist AT 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 AT f5 ~
$ freebsd-version -kru
13.5-RELEASE
13.5-RELEASE
13.5-RELEASE-p1

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

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

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

2025-07-03 23:17:52 dpchrist AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019