On Mon, May 21, 2018 at 03:10:06PM +0100, Stuart Henderson wrote:
> > show-required-by:
> > @@ -3434,17 +3434,17 @@ show:
> > # du fails if it can't access everything
> > show-size:
> > @if du -ks ${WRKDIR} 2>/dev/null >${WRKDIR}/wrkdir-size; then \
> > - cat ${WRKDIR}/wrkdir-size && rm -f ${WRKDIR}/wrkdir-size; \
> > + cat ${WRKDIR}/wrkdir-size && ${_PBUILD} rm -f
> > ${WRKDIR}/wrkdir-size; \
>
> I think maybe there's a problem here? The redirection isn't done as _pbuild.
> Untested but you could try the old hack for writing as a different user,
> e.g. "| ${_PBUILD} tee ${WRKDIR}/wrkdir-size" instead.
Yes, in the usual case we're always running `du ; chmod -R; du' across
_pbuild owned ${WRKDIR} simply because ./wrkdir-size cannot be created
by the normal user.
Your fix is fine for that.
> > else \
> > - chmod -R u+rX ${WRKDIR}; \
> > + ${_PBUILD} chmod -R u+rX ${WRKDIR}; \
> > du -ks ${WRKDIR}; \
> > fi
>
> I think that's okay, though I'm wondering why the first one writes to
> wrkdir-size
> and this one doesn't.
wrkdir-size caches the output so we can check the return status first
and, if successful, show the results.
Otherwise, we try fixing permissions and rerun du(1) again but with both
error messages and sizes going directly to the shell.
This seems suboptimal; if at all, I'd like to fix this in a separate
diff.