[Toybox] [BUG] du applet prints wrong output for 2GB+ files

darken darken at darken.eu
Fri Sep 30 01:39:59 PDT 2016


I can confirm that the patch works.
With the patch there are a few warnings during compilation though, safe to
ignore?

See: https://gist.github.com/d4rken/710cd1ab6265e062aaa2374e7be75452



2016-09-29 20:44 GMT+02:00 enh <enh at google.com>:

> the attached patch fixes LP32 for me, without obviously breaking
> anything. a quick grep didn't show any obvious case where making
> dirtree::extra larger would break anything, but rob will know
> better...
>
> On Thu, Sep 29, 2016 at 11:37 AM, darken <darken at darken.eu> wrote:
> > Why isn't `TT.total` the issue?
> >
> > I couldn't find `dirtree::extra`, could you link me to that?
> >
> > A patch would consist of changing one or more `long` into `long long`?
> >
> > 2016-09-29 20:22 GMT+02:00 enh <enh at google.com>:
> >>
> >> (looks like the real problem is dirtree::extra is long.)
> >>
> >> On Thu, Sep 29, 2016 at 11:17 AM, enh <enh at google.com> wrote:
> >> > works for me on Nexus 9. looks like du.c's TT.total is a signed long,
> >> > so on LP32...
> >> >
> >> > On Thu, Sep 29, 2016 at 11:07 AM, darken <darken at darken.eu> wrote:
> >> >> The du applet prints a ridiculously large size if the total size
> >> >> exceeds
> >> >> 2GB.
> >> >>
> >> >> Reproduced on a Nexus5 with Android 6.0, but I don't think this is
> >> >> Android
> >> >> specific.
> >> >> It doesn't matter if it's multiple files or a single one.
> >> >> Could reproduce it by dd'ing a 2GB file full of zeros.
> >> >>
> >> >>> root at hammerhead:/cache # busybox du -hs /sdcard/2GBTestFile
> >> >>>
> >> >>> 2.5G    /sdcard/2GBTestFile
> >> >>>
> >> >>> root at hammerhead:/cache # ./toybox-armv6l du -s /sdcard/2GBTestFile
> >> >>>
> >> >>> 18446744073707954404    /sdcard/2GBTestFile
> >> >>>
> >> >>> root at hammerhead:/cache # ./toybox-armv6l du -hs /sdcard/2GBTestFile
> >> >>>
> >> >>> 16E     /sdcard/2GBTestFile
> >> >>
> >> >>
> >> >> This ticket has more console logs showing the issue.
> >> >> https://github.com/landley/toybox/issues/51
> >> >>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> Toybox mailing list
> >> >> Toybox at lists.landley.net
> >> >> http://lists.landley.net/listinfo.cgi/toybox-landley.net
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Elliott Hughes - http://who/enh - http://jessies.org/~enh/
> >> > Android native code/tools questions? Mail me/drop by/add me as a
> >> > reviewer.
> >>
> >>
> >>
> >> --
> >> Elliott Hughes - http://who/enh - http://jessies.org/~enh/
> >> Android native code/tools questions? Mail me/drop by/add me as a
> reviewer.
> >
> >
>
>
>
> --
> Elliott Hughes - http://who/enh - http://jessies.org/~enh/
> Android native code/tools questions? Mail me/drop by/add me as a reviewer.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20160930/72b0bb77/attachment-0003.htm>


More information about the Toybox mailing list