On Mon, Apr 20, 2020 at 07:45:37PM +0100, Kevin Chadwick wrote: > > > There are some unavoidable complexities to the sheer size of the tree, > > and the necessities of updates not to fail... > > I have noticed recently that I occasionally get a gz truncated message (I > think > due to tcp timeout) and then the dependent package doesn't get updated. I then > re-run pkg_add -u. > > Is the way to deal with this from a script, to; re-run pkg_add -u, if it's > output is > 0 ? Nope, it's definitely the wrong place to fix things.
You should fix your pipes (change the timeouts or whatever). If worse comes to worst, pkg_add could *possibly* retry running ftp(1), but that makes little sense. If the transport layer is *broken* my gut feeling is that the transport layer needs fixing! Application layer should be able to rely on a *working* transport layer. That's what all network books have been saying for >30 years.