[Toybox] cp.c

enh enh at google.com
Mon Mar 15 12:26:32 PDT 2021


On Sat, Mar 13, 2021 at 1:01 AM Rob Landley <rob at landley.net> wrote:

> 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?)
>

yeah, i think the use of _just_ `rc` was okay too. it was really the "am i
following `errno`, `rc`, or both here?" that was particularly confusing.


> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210315/3ec125ac/attachment-0001.htm>


More information about the Toybox mailing list