Re: coreutils 9.2 - breaking change in cp and mv
[Since this reply msg by me (rw) is opinion/rant, I didn't think it belongs in the Factory list, so am posting it to Users.] On Wed, 05 Apr 2023 23:16:46 +0200, mh@mike.franken.de wrote (to factory@lists.opensuse.org):
On Montag, 3. April 2023 12:00:22 CEST Dominique Leuenberger wrote:
==== coreutils ==== Version update (9.1 -> 9.2) Subpackages: coreutils-lang [...] * 'cp -n' and 'mv -n' now exit with nonzero status if they skip their action because the destination exists, and likewise for 'cp - i', 'ln -i', and 'mv -i' when the user declines. (POSIX specifies this for 'cp -i' and 'mv -i'.) [...]
be warned: This might break lots of Makefiles and other scripts. cp -n and mv -n return 1, if *any* file to copy or move exists in the destination. I'm not sure, why this was introduced, because using -n originally should avoid a non zero return status.
I say, let them break. The functionality defined for the '-n' (--no-clobber) option before was broken. It was: "Do not overwrite an existing file; silently do nothing instead." That does not allow a script or makefile to detect whether the copy or move succeeded completely. If it doesn't succeed, it should return error status. The change is too bad for the scripts and makefiles written for the old functionality, but most of them using '-n' were probably carelessly written, and were bugs waiting to happen. Seeing an error will give people an opportunity to fix it. I was happy when first becoming aware of a new --no-clobber option for these utilities, until noticing that no proper result status was returned. That made it unusable for my scripts and makefiles, and so, mine won't break from the change. "It usually does what you want" is not good enough. BTW, the '-t' and '-T' options were a welcome addition to make the behavior of cp, mv, and ln, more deterministic. In scripts, one of those two should always be used. -- Robert Webb
On Donnerstag, 6. April 2023 04:24:48 CEST Robert Webb via openSUSE Users wrote:
[Since this reply msg by me (rw) is opinion/rant, I didn't think it belongs in the Factory list, so am posting it to Users.]
It was not meant as a rant. I just had the problem with some makefiles and wanted to give a warning to other people, because it took me some time to find out the reason for the make failures. [...]
-- Robert Webb
Bye. Michael.
On Thu, 06 Apr 2023 10:18:58 +0200, mh@mike.franken.de wrote:
On Donnerstag, 6. April 2023 04:24:48 CEST Robert Webb via openSUSE Users wrote:
[Since this reply msg by me (rw) is opinion/rant, I didn't think it belongs in the Factory list, so am posting it to Users.]
It was not meant as a rant. I just had the problem with some makefiles and wanted to give a warning to other people, because it took me some time to find out the reason for the make failures.
Yes, excuse me. I did not mean to say that your post was a rant. Your post alerted people to a change to basic tools, cp and mv, that could cause problems. That is appropriate for the Factory list. My message though, replying to yours, was just opinion (rant). -- Robert Webb
participants (2)
-
mh@mike.franken.de
-
Robert Webb