[Toybox] A couple of minor fixes

Paul Barker paul at paulbarker.me.uk
Tue Jun 14 00:54:51 PDT 2016


On Mon, 13 Jun 2016 16:49:46 +0100
Paul Barker <paul at paulbarker.me.uk> wrote:

> On Mon, 13 Jun 2016 16:13:19 +0100
> Paul Barker <paul at paulbarker.me.uk> wrote:
> > 
> > I still agree that this should be fixed in glibc if possible though.
> > I'll build a test app later and see what happens for different trim
> > values (INT_MAX, INT_MAX/2, INT_MAX/4, etc) with glibc in an
> > OpenEmbedded build.
> > 
> 
> 	#include <limits.h>
> 	#include <stdio.h>
> 
> 	int main(int argc, char *argv[])
> 	{
> 	    const char *str = "Hello, World!";
> 	    int trim[] = { INT_MAX, INT_MAX/2, INT_MAX/4,
> 		    INT_MAX/8, INT_MAX/16, INT_MAX/32, INT_MAX/64,
> 		    INT_MAX/128, INT_MAX/256, INT_MAX/512 };
> 	    int i;
> 
> 	    for (i = 0; i < 10; i++) {
>         	printf("trim=%d : ", trim[i]);
> 	        printf("%.*s", trim[i], str);
>         	printf("\n");
> 	    }
> 
> 	    return 0;
> 	}
> 

I've now tried this on:
* Debian 8 (aka jessie or stable with glibc 2.19-18+deb8u4), x86_64
* Debian testing (aka stretch with glibc 2.22-11), x86_64.
* glibc 2.23 built from source on Debian testing, x86_64
* glibc built from source on Debian testing, x86_64

INT_MAX/2 and smaller work for all these:

	trim=2147483647 :
	trim=1073741823 : Hello, World!
	trim=536870911 : Hello, World!
	trim=268435455 : Hello, World!
	trim=134217727 : Hello, World!
	trim=67108863 : Hello, World!
	trim=33554431 : Hello, World!
	trim=16777215 : Hello, World!
	trim=8388607 : Hello, World!
	trim=4194303 : Hello, World!

I've also tried:
* OpenEmbedded master branch built for x86_64 (glibc post-2.23 release
  from git repository)
* OpenEmbedded krogoth branch (mid-2016 release, glibc 2.23)
* OpenEmbedded fido branch (mid-2015 release, glibc 2.21)
* OpenEmbedded daisy branch (mid-2014 release, glibc 2.19)

All of these show the following behaviour:

	trim=2147483647 :
	trim=1073741823 :
	trim=536870911 :
	trim=268435455 :
	trim=134217727 : Hello, World!
	trim=67108863 : Hello, World!
	trim=33554431 : Hello, World!
	trim=16777215 : Hello, World!
	trim=8388607 : Hello, World!
	trim=4194303 : Hello, World!

That's the same issue I saw on OE master built for i586 so this isn't a
32-bit vs 64-bit issue. It's down at INT_MAX/16 before anything is
printed out. It's also not a recent bug as it exists in code from 2014.

I'll investigate further and then raise this on the OpenEmbedded
bugzilla. It's either an effect of patches/configuration applied by
OpenEmbedded or it's an upstream bug that's only triggered when
cross-compiling.

Thanks,
Paul Barker



More information about the Toybox mailing list