DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 56G1AROo2423668 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 56G1AROo2423668 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=mUv0Xm4k X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A3D13858C24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1752628225; bh=8R11+xmCIBfht5lTtDlYUqBwxBAkZIMzFkH1RVHCJZk=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=mUv0Xm4kCiu+GUrnkqUqr7ySv2J1ySw/hbtT0Ml1vMvXHltr4l2hzqFyeMOYtbS23 WC5rBtuWKRd1cviaDq+r4oKDKk694UVnMWPYghnf1E59TjUARgj1pV6l8s7xGrw+aR pfHC9sr3wd9zXiyn/90TxCiLHzXgzmk+fRaZ958Q= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 646B63858D32 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 646B63858D32 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752628190; cv=none; b=hK/LonmKaoOciDyxALgqYNS06GQwD4QwRaIFLaRwzj00hW3+odqi2UjraHs8K8rboJ86TKh4GpIMtoLTLMMbDIukD6UdwrCDnd4dU1F60vL7lJgtdhMng3tWalhiQradb5v/F7+RooTQ8cMn5dGNcSUkaXPcWCAwSZIw+6u4jVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752628190; c=relaxed/simple; bh=LXyZlXqktyhDJof8RVbljHMkMXy0uokMzJap98pFeK4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=TBswqZfA+FRp0NuFTg1Z4BLoHVDyQPMrX8TssWbbxsI4kTFhkcDg1KgarK1oCXccdl1QJxt1JuGCW1svqub2pxX2QvA0Xp5TAMyN9QM7dXs22luN+Kd1ZECS0jo1Z6WbCKWJ2ZvtVx2fcK4ICBdBB0NIDMifbLWmRGmV+KNFC48= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 646B63858D32 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752628188; x=1753232988; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fGHYgfNRwSUTz3m+ocYvxTpiNDD/eQ88utvIr2YjlQM=; b=ttkiwk2hRrByLMYgcwJEOKDuWP1vLHrPe5p+tzORTudkSXW3SotLsOsokUT+ZxDM2R Q650C0JV1VdMXm5iH600gQfKQ7NeZ1KB1CaN12tnI0W+6T7vF1Ieoo8N9BoKobsmrxSv 20MTvppNPMYbQ4KLvCqi/jRrIWr04tvYu6NlOL71YUfaAoA23CSJg3tZKHGt7DUUPVe0 mCLdqprUfsnV3mHs7ae6ZhkoCpW9iTizAoCLq3+w2lFjWXmHmjG2ZKDCua8Q4C+ktQA3 jWHJwbhTXbrjTJY/fZbJD+/ObtwK5HF89elsoWxAiXAkvpOyymlltLKDkSMx05awDVj6 DscA== X-Gm-Message-State: AOJu0YwmiaMcL75SNlkZq499KXWd8Cbj//J5I100Pb5WGOE4BuqQ/B5o cedrQDPBV61RMJLbIub8cPp8S4t0R/9d4TpxDjnNeTbBBsMt8XTRwABzXBM0ryh2rvNXJqB10bW QSMceSjE291fAmHlt24wNfsXBxMjfUgLPz6vx X-Gm-Gg: ASbGncvgbhHRjYTeV6creVEOCOw+YJnI/iMF/Tn0/iRAqASW2EeICv8DiuMKeK1oKMm LCm3Ghjdx91Yz6JtKTCi7XBLPzBWu8QNco4cH5vXXg9uYrT3szO/SZFFlT2mwMOQKBWrDQG9v5K gxs9y7Gws6m+4tzNK4Fj58bDHR8LLcCcjRH4SSqTmRkh1GkPBdH9WGBJrBHH4Wiw30K/8MOzVrs pv0PsLNq2FmuwUC/w== X-Google-Smtp-Source: AGHT+IFE0rGXo435pp06oSaZSsPtZIsnuI+W8JNlZJ8mFKbKVfD7BE3zckjeWDe8pNKE/K4S8r1Nvme/n1sAeIf7bHk= X-Received: by 2002:a05:600c:3b1e:b0:439:643a:c8d5 with SMTP id 5b1f17b1804b1-4562e321debmr7172205e9.0.1752628188257; Tue, 15 Jul 2025 18:09:48 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 15 Jul 2025 18:09:36 -0700 X-Gm-Features: Ac12FXw8FpZ3O3WlazbZDu9Xa0mM3wQ65ZlHi68EgcyC02ehnJ3WJosGYua1bOc Message-ID: Subject: Re: Misleading (irritating) output from cp To: The Cygwin Mailing List Cc: Keith Thompson X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Keith Thompson via Cygwin Reply-To: Keith Thompson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" Fergus Daly 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! Cygwin's "cp" command is provided by the GNU Coreutils package, currently version 9.0. The two-line output you describe doesn't occur with the command "cp -v existingfile nonexistingdirectory". Since "nonexistingdirectory" doesn't exist, the cp command has no way to know whether it's expected to be a directory or a file. It's not a nonexisting directory; it's just a nonexisting *thing*. If the current directory is writable, that command will copy "existingfile" to a new file named "nonexistingdirectory". But you would get that output with: "cp -v existingfile nonexistingdirectory/" where the trailing / requires the target to be a directory. The `info cp` description of the -v / --verbose option is "Print the name of each file before copying it" (which is a little misleading; it actually prints both the source and the target). The `man cp` description is "explain what is being done", which is vague enough to be accurate. Experiment shows that it actually prints (to stdout) the source and target of the copy that it's *about* to perform, and then attempts to perform the copy. If an error occurs, a message is then printed to stderr. Apparently the FreeBSD version of "cp" doesn't print the verbose message if the copy operation fails. Both behaviors strike me as reasonable. I don't think there's any way (other than rebuilding coreutils from source or ) to get "cp" to behave the way you want. -- 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