[Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

Rob Landley rob at landley.net
Sun Mar 20 20:57:33 PDT 2016


On 03/19/2016 02:40 AM, Andy Chu wrote:
> This fixes a failing test case in mv.test.

There are actually three modes:

-n will leave the existing file.
-f will delete the existing file only if it can't write to it.
--remove-destination will delete the existing file before trying to
write to it.

Alas, for installing, you want --remove-destination. Which is so very
non-posix it doesn't even have a short option. cp -f will stomp a toybox
or busybox binary so everything is bunzip2, and -n will leave the
existing file (not install the new one).

That's why this is still on my todo list, I wanted to have
scripts/install.sh --force do --remove-destination, but can't assume the
host's cp has it. I should just make it rm -f then cp -n in two commands...

Rob

 1458532653.0


More information about the Toybox mailing list