Patchwork [05/11] findutils: Fix compilation for x32 toolchain

login
register
mail settings
Submitter Nitin A Kamble
Date Dec. 8, 2011, 5:48 a.m.
Message ID <7e5d0671426509d061abbe8b320f65f2cfb3a8a0.1323323130.git.nitin.a.kamble@intel.com>
Download mbox | patch
Permalink /patch/16443/
State Accepted
Commit 8a80a3510c65419a6fcd9e38ad3ef4234778b921
Headers show

Comments

Nitin A Kamble - Dec. 8, 2011, 5:48 a.m.
From: Nitin A Kamble <nitin.a.kamble@intel.com>

Work around gnulib time_t assumption in findutils for x32

time_t is 64bit and long int is 32bit on x32.  But gnulib used in
findutils assumes time_t values fit into long int.  Such assumption is
invalid for x32 and should be removed.

This patch is a workaround to compile gnulib for x32.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-Off-By: H.J. Lu <hjl.tools@gmail.com>
---
 .../findutils-4.4.2/findutils_fix_for_x32.patch    |   40 ++++++++++++++++++++
 meta/recipes-extended/findutils/findutils_4.4.2.bb |    5 +-
 2 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch
Khem Raj - Dec. 8, 2011, 7:14 a.m.
On Wed, Dec 7, 2011 at 9:48 PM,  <nitin.a.kamble@intel.com> wrote:
> From: Nitin A Kamble <nitin.a.kamble@intel.com>
>
> Work around gnulib time_t assumption in findutils for x32

if its a workaround can it be applied only to x32 with help of overrides please

>
> time_t is 64bit and long int is 32bit on x32.  But gnulib used in
> findutils assumes time_t values fit into long int.  Such assumption is
> invalid for x32 and should be removed.
>
> This patch is a workaround to compile gnulib for x32.
>
> Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
> Signed-Off-By: H.J. Lu <hjl.tools@gmail.com>
> ---
>  .../findutils-4.4.2/findutils_fix_for_x32.patch    |   40 ++++++++++++++++++++
>  meta/recipes-extended/findutils/findutils_4.4.2.bb |    5 +-
>  2 files changed, 43 insertions(+), 2 deletions(-)
>  create mode 100644 meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch
>
> diff --git a/meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch b/meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch
> new file mode 100644
> index 0000000..dd2ab0e
> --- /dev/null
> +++ b/meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch
> @@ -0,0 +1,40 @@
> +UpstreamStatus: Pending
> +
> +Author: H.J. Lu <hjl.tools@gmail.com>
> +
> +Work around gnulib time_t assumption in findutils for x32
> +
> +time_t is 64bit and long int is 32bit on x32.  But gnulib used in
> +findutils assumes time_t values fit into long int.  Such assumption is
> +invalid for x32 and should be removed.
> +
> +This patch is a workaround to compile gnulib for x32.
> +
> +Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/05
> +
> +
> +Index: findutils-4.4.2/gnulib/lib/getdate.y
> +===================================================================
> +--- findutils-4.4.2.orig/gnulib/lib/getdate.y
> ++++ findutils-4.4.2/gnulib/lib/getdate.y
> +@@ -114,7 +114,6 @@
> +    wraps around, but there's no portable way to check for that at
> +    compile-time.  */
> + verify (TYPE_IS_INTEGER (time_t));
> +-verify (LONG_MIN <= TYPE_MINIMUM (time_t) && TYPE_MAXIMUM (time_t) <= LONG_MAX);
> +
> + /* An integer value, and the number of digits in its textual
> +    representation.  */
> +Index: findutils-4.4.2/gnulib/lib/mktime.c
> +===================================================================
> +--- findutils-4.4.2.orig/gnulib/lib/mktime.c
> ++++ findutils-4.4.2/gnulib/lib/mktime.c
> +@@ -166,7 +166,7 @@ ydhms_diff (long int year1, long int yda
> + {
> +   verify (C99_integer_division, -1 / 2 == 0);
> +   verify (long_int_year_and_yday_are_wide_enough,
> +-        INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
> ++        INT_MAX <= TIME_T_MAX / 2 || TIME_T_MAX <= UINT_MAX);
> +
> +   /* Compute intervening leap days correctly even if year is negative.
> +      Take care to avoid integer overflow here.  */
> diff --git a/meta/recipes-extended/findutils/findutils_4.4.2.bb b/meta/recipes-extended/findutils/findutils_4.4.2.bb
> index cfc6546..c25ba4c 100644
> --- a/meta/recipes-extended/findutils/findutils_4.4.2.bb
> +++ b/meta/recipes-extended/findutils/findutils_4.4.2.bb
> @@ -1,10 +1,11 @@
>  require findutils.inc
>
> -PR = "r0"
> +PR = "r1"
>
>  SRC_URI += "file://01-27017.patch \
>             file://02-28824.patch \
> -            file://03-28872.patch"
> +            file://03-28872.patch \
> +            file://findutils_fix_for_x32.patch "
>
>  SRC_URI[md5sum] = "351cc4adb07d54877fa15f75fb77d39f"
>  SRC_URI[sha256sum] = "434f32d171cbc0a5e72cfc5372c6fc4cb0e681f8dce566a0de5b6fccd702b62a"
> --
> 1.7.6.4
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Richard Purdie - Dec. 8, 2011, 9:08 a.m.
On Wed, 2011-12-07 at 23:14 -0800, Khem Raj wrote:
> On Wed, Dec 7, 2011 at 9:48 PM,  <nitin.a.kamble@intel.com> wrote:
> > From: Nitin A Kamble <nitin.a.kamble@intel.com>
> >
> > Work around gnulib time_t assumption in findutils for x32
> 
> if its a workaround can it be applied only to x32 with help of overrides please

Its not a workaround, the patch looks like a generic reasonable fix to
correct assumptions made by the program that aren't true?

Cheers,

Richard
Nitin A Kamble - Dec. 8, 2011, 6:37 p.m.
> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> Richard Purdie
> Sent: Thursday, December 08, 2011 1:08 AM
> To: Patches and discussions about the oe-core layer
> Cc: hjl.tools@gmail.com
> Subject: Re: [OE-core] [PATCH 05/11] findutils: Fix compilation for x32
> toolchain
> 
> On Wed, 2011-12-07 at 23:14 -0800, Khem Raj wrote:
> > On Wed, Dec 7, 2011 at 9:48 PM,  <nitin.a.kamble@intel.com> wrote:
> > > From: Nitin A Kamble <nitin.a.kamble@intel.com>
> > >
> > > Work around gnulib time_t assumption in findutils for x32
> >
> > if its a workaround can it be applied only to x32 with help of
> overrides please
> 
> Its not a workaround, the patch looks like a generic reasonable fix to
> correct assumptions made by the program that aren't true?


Even though x32 caught the issue, the issue is not x32 specific. And also 
other arches are building fine with the change. So I think it is better 
to keep this patch in oecore.

Nitin

> 
> Cheers,
> 
> Richard
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Khem Raj - Dec. 8, 2011, 8:45 p.m.
On Thu, Dec 8, 2011 at 10:37 AM, Kamble, Nitin A
<nitin.a.kamble@intel.com> wrote:
>
>
>> -----Original Message-----
>> From: openembedded-core-bounces@lists.openembedded.org
>> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
>> Richard Purdie
>> Sent: Thursday, December 08, 2011 1:08 AM
>> To: Patches and discussions about the oe-core layer
>> Cc: hjl.tools@gmail.com
>> Subject: Re: [OE-core] [PATCH 05/11] findutils: Fix compilation for x32
>> toolchain
>>
>> On Wed, 2011-12-07 at 23:14 -0800, Khem Raj wrote:
>> > On Wed, Dec 7, 2011 at 9:48 PM,  <nitin.a.kamble@intel.com> wrote:
>> > > From: Nitin A Kamble <nitin.a.kamble@intel.com>
>> > >
>> > > Work around gnulib time_t assumption in findutils for x32
>> >
>> > if its a workaround can it be applied only to x32 with help of
>> overrides please
>>
>> Its not a workaround, the patch looks like a generic reasonable fix to
>> correct assumptions made by the program that aren't true?
>
>
> Even though x32 caught the issue, the issue is not x32 specific. And also
> other arches are building fine with the change. So I think it is better
> to keep this patch in oecore.

OK then change the commit message its confusing.
Nitin A Kamble - Dec. 8, 2011, 10:42 p.m.
> -----Original Message-----

> From: openembedded-core-bounces@lists.openembedded.org

> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of

> Khem Raj

> Sent: Thursday, December 08, 2011 12:45 PM

> To: Patches and discussions about the oe-core layer

> Cc: hjl.tools@gmail.com

> Subject: Re: [OE-core] [PATCH 05/11] findutils: Fix compilation for x32

> toolchain

> 

> On Thu, Dec 8, 2011 at 10:37 AM, Kamble, Nitin A

> <nitin.a.kamble@intel.com> wrote:

> >

> >

> >> -----Original Message-----

> >> From: openembedded-core-bounces@lists.openembedded.org

> >> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf

> Of

> >> Richard Purdie

> >> Sent: Thursday, December 08, 2011 1:08 AM

> >> To: Patches and discussions about the oe-core layer

> >> Cc: hjl.tools@gmail.com

> >> Subject: Re: [OE-core] [PATCH 05/11] findutils: Fix compilation for

> x32

> >> toolchain

> >>

> >> On Wed, 2011-12-07 at 23:14 -0800, Khem Raj wrote:

> >> > On Wed, Dec 7, 2011 at 9:48 PM,  <nitin.a.kamble@intel.com> wrote:

> >> > > From: Nitin A Kamble <nitin.a.kamble@intel.com>

> >> > >

> >> > > Work around gnulib time_t assumption in findutils for x32

> >> >

> >> > if its a workaround can it be applied only to x32 with help of

> >> overrides please

> >>

> >> Its not a workaround, the patch looks like a generic reasonable fix

> to

> >> correct assumptions made by the program that aren't true?

> >

> >

> > Even though x32 caught the issue, the issue is not x32 specific. And

> also

> > other arches are building fine with the change. So I think it is

> better

> > to keep this patch in oecore.

> 

> OK then change the commit message its confusing.


Ok, I changed the commit message in the contrib. branch nitin/x32.
Nitin

> 

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch b/meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch
new file mode 100644
index 0000000..dd2ab0e
--- /dev/null
+++ b/meta/recipes-extended/findutils/findutils-4.4.2/findutils_fix_for_x32.patch
@@ -0,0 +1,40 @@ 
+UpstreamStatus: Pending
+
+Author: H.J. Lu <hjl.tools@gmail.com>
+
+Work around gnulib time_t assumption in findutils for x32
+
+time_t is 64bit and long int is 32bit on x32.  But gnulib used in
+findutils assumes time_t values fit into long int.  Such assumption is
+invalid for x32 and should be removed.
+
+This patch is a workaround to compile gnulib for x32.
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/05
+
+
+Index: findutils-4.4.2/gnulib/lib/getdate.y
+===================================================================
+--- findutils-4.4.2.orig/gnulib/lib/getdate.y
++++ findutils-4.4.2/gnulib/lib/getdate.y
+@@ -114,7 +114,6 @@
+    wraps around, but there's no portable way to check for that at
+    compile-time.  */
+ verify (TYPE_IS_INTEGER (time_t));
+-verify (LONG_MIN <= TYPE_MINIMUM (time_t) && TYPE_MAXIMUM (time_t) <= LONG_MAX);
+ 
+ /* An integer value, and the number of digits in its textual
+    representation.  */
+Index: findutils-4.4.2/gnulib/lib/mktime.c
+===================================================================
+--- findutils-4.4.2.orig/gnulib/lib/mktime.c
++++ findutils-4.4.2/gnulib/lib/mktime.c
+@@ -166,7 +166,7 @@ ydhms_diff (long int year1, long int yda
+ {
+   verify (C99_integer_division, -1 / 2 == 0);
+   verify (long_int_year_and_yday_are_wide_enough,
+-	  INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
++	  INT_MAX <= TIME_T_MAX / 2 || TIME_T_MAX <= UINT_MAX);
+ 
+   /* Compute intervening leap days correctly even if year is negative.
+      Take care to avoid integer overflow here.  */
diff --git a/meta/recipes-extended/findutils/findutils_4.4.2.bb b/meta/recipes-extended/findutils/findutils_4.4.2.bb
index cfc6546..c25ba4c 100644
--- a/meta/recipes-extended/findutils/findutils_4.4.2.bb
+++ b/meta/recipes-extended/findutils/findutils_4.4.2.bb
@@ -1,10 +1,11 @@ 
 require findutils.inc
 
-PR = "r0"
+PR = "r1"
 
 SRC_URI += "file://01-27017.patch \
             file://02-28824.patch \
-            file://03-28872.patch"
+            file://03-28872.patch \
+            file://findutils_fix_for_x32.patch "
 
 SRC_URI[md5sum] = "351cc4adb07d54877fa15f75fb77d39f"
 SRC_URI[sha256sum] = "434f32d171cbc0a5e72cfc5372c6fc4cb0e681f8dce566a0de5b6fccd702b62a"