[Toybox] cp.c

Rob Landley rob at landley.net
Sat Mar 13 01:15:47 PST 2021


On 3/12/21 2:15 PM, enh wrote:
>     But could I get a second opinion on that since I obviously flubbed allowing this
>     patch in last time? My blog suggests I was hip-deep in doing the first round of
>     modern shell stuff.

Which I was also doing when I got this email, and it was the end of a long day,
and none of _my_ test cases ever hit this so I wanted to see if you had one that
did. (That's why I wanted the second opinion.)

>     > it seems from the history like the EXDEV assignment was for the later test of
>     > `errno != EXDEV` and is really meant to be a "did we successfully move?". i
>     > don't think that's still valid now the force/clobber code has been added?
> 
>     I think the rest of it's ok?
> 
> yeah, i _think_ so, but i worry that it's past the level of complexity that
> humans can cope with. sure you don't just want an explicit `moved` boolean?

I'll add a comment on why we're setting errno = EXDEV, and rename "rc" to... I
dunno, "send"? (rc = 0 means "don't try to send this file to the destination
anymore, whether by cp or mv" and it consistently means that through its
lifetime. Splitting that role into two variables doesn't seem clearer to me?)

Rob



More information about the Toybox mailing list