diff mbox series

cryptsetup: fix build with pre C11 toolchains

Message ID efe392e11d8deb9334a1b567a010b9dae466143b.1534335249.git.baruch@tkos.co.il
State Accepted
Commit d9cfe343d230fe95ad84842b9b2ed87667da6430
Headers show
Series cryptsetup: fix build with pre C11 toolchains | expand

Commit Message

Baruch Siach Aug. 15, 2018, 12:14 p.m. UTC
Add a patch removing a redefined typedef. Redefinition of typedef, even
to the same type, used to be illegal before C11.

Fixes:
http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Hi Hollis,

Can you git this a run on your autobuilder? I would like to verify that
it actually fixes the problem before I send the patch upstream.

Thanks,
baruch
---
 .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch

Comments

Hollis Blanchard Aug. 15, 2018, 3:10 p.m. UTC | #1
I can manually place this in the autobuilder's checkout of buildroot, 
but maybe it will pick some arbitrary branch the next time it runs. Is 
there a better way to try it out?

Hollis Blanchard
Mentor Graphics Emulation Division

On 08/15/2018 05:14 AM, Baruch Siach wrote:
> Add a patch removing a redefined typedef. Redefinition of typedef, even
> to the same type, used to be illegal before C11.
>
> Fixes:
> http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
> http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
> http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> Hi Hollis,
>
> Can you git this a run on your autobuilder? I would like to verify that
> it actually fixes the problem before I send the patch upstream.
>
> Thanks,
> baruch
> ---
>   .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
>   1 file changed, 46 insertions(+)
>   create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch
>
> diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> new file mode 100644
> index 000000000000..fa865314a7da
> --- /dev/null
> +++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> @@ -0,0 +1,46 @@
> +From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
> +From: Baruch Siach <baruch@tkos.co.il>
> +Date: Wed, 15 Aug 2018 14:13:46 +0300
> +Subject: [PATCH] Remove json_object typedef
> +
> +The json-c header already defines the same typedef. While C11 allows
> +typedef redefinition to the same type, older versions of gcc disallow
> +that.
> +
> +In file included from lib/luks2/luks2_internal.h:32,
> +                 from lib/luks2/luks2_disk_metadata.c:24:
> +lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
> +
> +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> +---
> + lib/luks2/luks2.h | 1 -
> + lib/setup.c       | 1 +
> + 2 files changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
> +index ee57b41ba974..25e36190da45 100644
> +--- a/lib/luks2/luks2.h
> ++++ b/lib/luks2/luks2.h
> +@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
> + /*
> +  * LUKS2 header in-memory.
> +  */
> +-typedef struct json_object json_object;
> + struct luks2_hdr {
> + 	size_t		hdr_size;
> + 	uint64_t	seqid;
> +diff --git a/lib/setup.c b/lib/setup.c
> +index fddbe7ef7897..856f6e80f465 100644
> +--- a/lib/setup.c
> ++++ b/lib/setup.c
> +@@ -28,6 +28,7 @@
> + #include <sys/utsname.h>
> + #include <fcntl.h>
> + #include <errno.h>
> ++#include <json-c/json.h>
> +
> + #include "libcryptsetup.h"
> + #include "luks.h"
> +--
> +2.18.0
> +
Matt Weber Aug. 15, 2018, 3:12 p.m. UTC | #2
Hollis,
On Wed, Aug 15, 2018 at 10:10 AM Hollis Blanchard
<hollis_blanchard@mentor.com> wrote:
>
> I can manually place this in the autobuilder's checkout of buildroot,
> but maybe it will pick some arbitrary branch the next time it runs. Is
> there a better way to try it out?

https://git.busybox.net/buildroot-test/tree/utils/br-reproduce-build

using the hash from one of those failing commits will reproduce the
build.  then you can git am the patch in a verify the fix.

>
> Hollis Blanchard
> Mentor Graphics Emulation Division
>
> On 08/15/2018 05:14 AM, Baruch Siach wrote:
> > Add a patch removing a redefined typedef. Redefinition of typedef, even
> > to the same type, used to be illegal before C11.
> >
> > Fixes:
> > http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
> > http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
> > http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/
> >
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > ---
> > Hi Hollis,
> >
> > Can you git this a run on your autobuilder? I would like to verify that
> > it actually fixes the problem before I send the patch upstream.
> >
> > Thanks,
> > baruch
> > ---
> >   .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
> >   1 file changed, 46 insertions(+)
> >   create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch
> >
> > diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> > new file mode 100644
> > index 000000000000..fa865314a7da
> > --- /dev/null
> > +++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> > @@ -0,0 +1,46 @@
> > +From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
> > +From: Baruch Siach <baruch@tkos.co.il>
> > +Date: Wed, 15 Aug 2018 14:13:46 +0300
> > +Subject: [PATCH] Remove json_object typedef
> > +
> > +The json-c header already defines the same typedef. While C11 allows
> > +typedef redefinition to the same type, older versions of gcc disallow
> > +that.
> > +
> > +In file included from lib/luks2/luks2_internal.h:32,
> > +                 from lib/luks2/luks2_disk_metadata.c:24:
> > +lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
> > +
> > +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > +---
> > + lib/luks2/luks2.h | 1 -
> > + lib/setup.c       | 1 +
> > + 2 files changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
> > +index ee57b41ba974..25e36190da45 100644
> > +--- a/lib/luks2/luks2.h
> > ++++ b/lib/luks2/luks2.h
> > +@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
> > + /*
> > +  * LUKS2 header in-memory.
> > +  */
> > +-typedef struct json_object json_object;
> > + struct luks2_hdr {
> > +     size_t          hdr_size;
> > +     uint64_t        seqid;
> > +diff --git a/lib/setup.c b/lib/setup.c
> > +index fddbe7ef7897..856f6e80f465 100644
> > +--- a/lib/setup.c
> > ++++ b/lib/setup.c
> > +@@ -28,6 +28,7 @@
> > + #include <sys/utsname.h>
> > + #include <fcntl.h>
> > + #include <errno.h>
> > ++#include <json-c/json.h>
> > +
> > + #include "libcryptsetup.h"
> > + #include "luks.h"
> > +--
> > +2.18.0
> > +
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Baruch Siach Aug. 15, 2018, 5:09 p.m. UTC | #3
Hi Hollis,

Hollis Blanchard writes:
> I can manually place this in the autobuilder's checkout of buildroot, but
> maybe it will pick some arbitrary branch the next time it runs. Is there a
> better way to try it out?

No need to run it under the autobuilder script, only on the same
machine. Just do a separate checkout of buildroot, set a config (any
config), and do 'make host-cryptsetup'. Verify that the build fails with
the error mentioned in the patch. Then, apply this patch, delete
output/build/host-cryptsetup-2.0.3/, and do 'make host-cryptsetup'
again.

baruch

> On 08/15/2018 05:14 AM, Baruch Siach wrote:
>> Add a patch removing a redefined typedef. Redefinition of typedef, even
>> to the same type, used to be illegal before C11.
>>
>> Fixes:
>> http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
>> http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
>> http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/
>>
>> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> ---
>> Hi Hollis,
>>
>> Can you git this a run on your autobuilder? I would like to verify that
>> it actually fixes the problem before I send the patch upstream.
>>
>> Thanks,
>> baruch
>> ---
>>   .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
>>   1 file changed, 46 insertions(+)
>>   create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch
>>
>> diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
>> new file mode 100644
>> index 000000000000..fa865314a7da
>> --- /dev/null
>> +++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
>> @@ -0,0 +1,46 @@
>> +From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
>> +From: Baruch Siach <baruch@tkos.co.il>
>> +Date: Wed, 15 Aug 2018 14:13:46 +0300
>> +Subject: [PATCH] Remove json_object typedef
>> +
>> +The json-c header already defines the same typedef. While C11 allows
>> +typedef redefinition to the same type, older versions of gcc disallow
>> +that.
>> +
>> +In file included from lib/luks2/luks2_internal.h:32,
>> +                 from lib/luks2/luks2_disk_metadata.c:24:
>> +lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
>> +
>> +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> +---
>> + lib/luks2/luks2.h | 1 -
>> + lib/setup.c       | 1 +
>> + 2 files changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
>> +index ee57b41ba974..25e36190da45 100644
>> +--- a/lib/luks2/luks2.h
>> ++++ b/lib/luks2/luks2.h
>> +@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
>> + /*
>> +  * LUKS2 header in-memory.
>> +  */
>> +-typedef struct json_object json_object;
>> + struct luks2_hdr {
>> + 	size_t		hdr_size;
>> + 	uint64_t	seqid;
>> +diff --git a/lib/setup.c b/lib/setup.c
>> +index fddbe7ef7897..856f6e80f465 100644
>> +--- a/lib/setup.c
>> ++++ b/lib/setup.c
>> +@@ -28,6 +28,7 @@
>> + #include <sys/utsname.h>
>> + #include <fcntl.h>
>> + #include <errno.h>
>> ++#include <json-c/json.h>
>> +
>> + #include "libcryptsetup.h"
>> + #include "luks.h"
>> +--
>> +2.18.0
>> +
Hollis Blanchard Aug. 15, 2018, 8:24 p.m. UTC | #4
Worked for me.

Tested-by: Hollis Blanchard <hollis_blanchard@mentor.com>

Hollis Blanchard
Mentor Graphics Emulation Division

On 08/15/2018 05:14 AM, Baruch Siach wrote:
> Add a patch removing a redefined typedef. Redefinition of typedef, even
> to the same type, used to be illegal before C11.
>
> Fixes:
> http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
> http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
> http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> Hi Hollis,
>
> Can you git this a run on your autobuilder? I would like to verify that
> it actually fixes the problem before I send the patch upstream.
>
> Thanks,
> baruch
> ---
>   .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
>   1 file changed, 46 insertions(+)
>   create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch
>
> diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> new file mode 100644
> index 000000000000..fa865314a7da
> --- /dev/null
> +++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> @@ -0,0 +1,46 @@
> +From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
> +From: Baruch Siach <baruch@tkos.co.il>
> +Date: Wed, 15 Aug 2018 14:13:46 +0300
> +Subject: [PATCH] Remove json_object typedef
> +
> +The json-c header already defines the same typedef. While C11 allows
> +typedef redefinition to the same type, older versions of gcc disallow
> +that.
> +
> +In file included from lib/luks2/luks2_internal.h:32,
> +                 from lib/luks2/luks2_disk_metadata.c:24:
> +lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
> +
> +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> +---
> + lib/luks2/luks2.h | 1 -
> + lib/setup.c       | 1 +
> + 2 files changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
> +index ee57b41ba974..25e36190da45 100644
> +--- a/lib/luks2/luks2.h
> ++++ b/lib/luks2/luks2.h
> +@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
> + /*
> +  * LUKS2 header in-memory.
> +  */
> +-typedef struct json_object json_object;
> + struct luks2_hdr {
> + 	size_t		hdr_size;
> + 	uint64_t	seqid;
> +diff --git a/lib/setup.c b/lib/setup.c
> +index fddbe7ef7897..856f6e80f465 100644
> +--- a/lib/setup.c
> ++++ b/lib/setup.c
> +@@ -28,6 +28,7 @@
> + #include <sys/utsname.h>
> + #include <fcntl.h>
> + #include <errno.h>
> ++#include <json-c/json.h>
> +
> + #include "libcryptsetup.h"
> + #include "luks.h"
> +--
> +2.18.0
> +
Baruch Siach Aug. 16, 2018, 5:19 a.m. UTC | #5
Hi Hollis,

Hollis Blanchard writes:
> Worked for me.
>
> Tested-by: Hollis Blanchard <hollis_blanchard@mentor.com>

Thanks for the confirmation. I sent the patch upstream:

  https://gitlab.com/cryptsetup/cryptsetup/merge_requests/49

I'm not sure upstream would like the namespace pollution in this patch.

baruch

> On 08/15/2018 05:14 AM, Baruch Siach wrote:
>> Add a patch removing a redefined typedef. Redefinition of typedef, even
>> to the same type, used to be illegal before C11.
>>
>> Fixes:
>> http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
>> http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
>> http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/
>>
>> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> ---
>> Hi Hollis,
>>
>> Can you git this a run on your autobuilder? I would like to verify that
>> it actually fixes the problem before I send the patch upstream.
>>
>> Thanks,
>> baruch
>> ---
>>   .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
>>   1 file changed, 46 insertions(+)
>>   create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch
>>
>> diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
>> new file mode 100644
>> index 000000000000..fa865314a7da
>> --- /dev/null
>> +++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
>> @@ -0,0 +1,46 @@
>> +From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
>> +From: Baruch Siach <baruch@tkos.co.il>
>> +Date: Wed, 15 Aug 2018 14:13:46 +0300
>> +Subject: [PATCH] Remove json_object typedef
>> +
>> +The json-c header already defines the same typedef. While C11 allows
>> +typedef redefinition to the same type, older versions of gcc disallow
>> +that.
>> +
>> +In file included from lib/luks2/luks2_internal.h:32,
>> +                 from lib/luks2/luks2_disk_metadata.c:24:
>> +lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
>> +
>> +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> +---
>> + lib/luks2/luks2.h | 1 -
>> + lib/setup.c       | 1 +
>> + 2 files changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
>> +index ee57b41ba974..25e36190da45 100644
>> +--- a/lib/luks2/luks2.h
>> ++++ b/lib/luks2/luks2.h
>> +@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
>> + /*
>> +  * LUKS2 header in-memory.
>> +  */
>> +-typedef struct json_object json_object;
>> + struct luks2_hdr {
>> + 	size_t		hdr_size;
>> + 	uint64_t	seqid;
>> +diff --git a/lib/setup.c b/lib/setup.c
>> +index fddbe7ef7897..856f6e80f465 100644
>> +--- a/lib/setup.c
>> ++++ b/lib/setup.c
>> +@@ -28,6 +28,7 @@
>> + #include <sys/utsname.h>
>> + #include <fcntl.h>
>> + #include <errno.h>
>> ++#include <json-c/json.h>
>> +
>> + #include "libcryptsetup.h"
>> + #include "luks.h"
>> +--
>> +2.18.0
>> +
Peter Korsgaard Aug. 17, 2018, 3:01 p.m. UTC | #6
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:

 > Add a patch removing a redefined typedef. Redefinition of typedef, even
 > to the same type, used to be illegal before C11.

 > Fixes:
 > http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
 > http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
 > http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/

 > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
 > ---
 > Hi Hollis,

 > Can you git this a run on your autobuilder? I would like to verify that
 > it actually fixes the problem before I send the patch upstream.

Committed, thanks.

I see that discussion are ongoing with upstream, but we can adjust the
patch later if/when changes are needed.
Baruch Siach Aug. 20, 2018, 4:22 a.m. UTC | #7
Hi Hillis,

On Thu, Aug 16, 2018 at 08:19:16AM +0300, Baruch Siach wrote:
> Hollis Blanchard writes:
> > Worked for me.
> >
> > Tested-by: Hollis Blanchard <hollis_blanchard@mentor.com>
> 
> Thanks for the confirmation. I sent the patch upstream:
> 
>   https://gitlab.com/cryptsetup/cryptsetup/merge_requests/49
> 
> I'm not sure upstream would like the namespace pollution in this patch.

As I expected, Milan Broz, cryptsetup upstream developer, didn't like the 
namespace violation that this patch introduces. But he is also unable to 
reproduce the issue on his CentOS6 system. So we might end up with no upstream 
acceptable solution. Can you help Milan in reproducing the build failure?

Thanks,
baruch

> > On 08/15/2018 05:14 AM, Baruch Siach wrote:
> >> Add a patch removing a redefined typedef. Redefinition of typedef, even
> >> to the same type, used to be illegal before C11.
> >>
> >> Fixes:
> >> http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
> >> http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
> >> http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/
> >>
> >> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> >> ---
> >> Hi Hollis,
> >>
> >> Can you git this a run on your autobuilder? I would like to verify that
> >> it actually fixes the problem before I send the patch upstream.
> >>
> >> Thanks,
> >> baruch
> >> ---
> >>   .../0001-Remove-json_object-typedef.patch     | 46 +++++++++++++++++++
> >>   1 file changed, 46 insertions(+)
> >>   create mode 100644 package/cryptsetup/0001-Remove-json_object-typedef.patch
> >>
> >> diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> >> new file mode 100644
> >> index 000000000000..fa865314a7da
> >> --- /dev/null
> >> +++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
> >> @@ -0,0 +1,46 @@
> >> +From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
> >> +From: Baruch Siach <baruch@tkos.co.il>
> >> +Date: Wed, 15 Aug 2018 14:13:46 +0300
> >> +Subject: [PATCH] Remove json_object typedef
> >> +
> >> +The json-c header already defines the same typedef. While C11 allows
> >> +typedef redefinition to the same type, older versions of gcc disallow
> >> +that.
> >> +
> >> +In file included from lib/luks2/luks2_internal.h:32,
> >> +                 from lib/luks2/luks2_disk_metadata.c:24:
> >> +lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
> >> +
> >> +Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> >> +---
> >> + lib/luks2/luks2.h | 1 -
> >> + lib/setup.c       | 1 +
> >> + 2 files changed, 1 insertion(+), 1 deletion(-)
> >> +
> >> +diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
> >> +index ee57b41ba974..25e36190da45 100644
> >> +--- a/lib/luks2/luks2.h
> >> ++++ b/lib/luks2/luks2.h
> >> +@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
> >> + /*
> >> +  * LUKS2 header in-memory.
> >> +  */
> >> +-typedef struct json_object json_object;
> >> + struct luks2_hdr {
> >> + 	size_t		hdr_size;
> >> + 	uint64_t	seqid;
> >> +diff --git a/lib/setup.c b/lib/setup.c
> >> +index fddbe7ef7897..856f6e80f465 100644
> >> +--- a/lib/setup.c
> >> ++++ b/lib/setup.c
> >> +@@ -28,6 +28,7 @@
> >> + #include <sys/utsname.h>
> >> + #include <fcntl.h>
> >> + #include <errno.h>
> >> ++#include <json-c/json.h>
> >> +
> >> + #include "libcryptsetup.h"
> >> + #include "luks.h"
> >> +--
> >> +2.18.0
Hollis Blanchard Aug. 20, 2018, 9:05 p.m. UTC | #8
On 08/19/2018 09:22 PM, Baruch Siach wrote:
> Hi Hillis,
>
> On Thu, Aug 16, 2018 at 08:19:16AM +0300, Baruch Siach wrote:
>> Hollis Blanchard writes:
>>> Worked for me.
>>>
>>> Tested-by: Hollis Blanchard <hollis_blanchard@mentor.com>
>> Thanks for the confirmation. I sent the patch upstream:
>>
>>    https://gitlab.com/cryptsetup/cryptsetup/merge_requests/49
>>
>> I'm not sure upstream would like the namespace pollution in this patch.
> As I expected, Milan Broz, cryptsetup upstream developer, didn't like the
> namespace violation that this patch introduces. But he is also unable to
> reproduce the issue on his CentOS6 system. So we might end up with no upstream
> acceptable solution. Can you help Milan in reproducing the build failure?
Yes, I posted a comment to your merge request, and will try to help 
further there.

Hollis Blanchard
Mentor Graphics Emulation Division
Peter Korsgaard Aug. 23, 2018, 7:13 p.m. UTC | #9
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:

 > Add a patch removing a redefined typedef. Redefinition of typedef, even
 > to the same type, used to be illegal before C11.

 > Fixes:
 > http://autobuild.buildroot.net/results/93b/93b300a62f2ddbad66eab08e25fc3225969f224b/
 > http://autobuild.buildroot.net/results/6c6/6c6092d633400498ee5b8090733a949a9632e473/
 > http://autobuild.buildroot.net/results/f46/f46ef6123b5fa92753ff534b4ef7bea3f53ac388/

 > Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Committed to 2018.02.x and 2018.05.x, thanks.
diff mbox series

Patch

diff --git a/package/cryptsetup/0001-Remove-json_object-typedef.patch b/package/cryptsetup/0001-Remove-json_object-typedef.patch
new file mode 100644
index 000000000000..fa865314a7da
--- /dev/null
+++ b/package/cryptsetup/0001-Remove-json_object-typedef.patch
@@ -0,0 +1,46 @@ 
+From 567e7f8664c621f8aeaa95d9f4ab4b590574f572 Mon Sep 17 00:00:00 2001
+From: Baruch Siach <baruch@tkos.co.il>
+Date: Wed, 15 Aug 2018 14:13:46 +0300
+Subject: [PATCH] Remove json_object typedef
+
+The json-c header already defines the same typedef. While C11 allows
+typedef redefinition to the same type, older versions of gcc disallow
+that.
+
+In file included from lib/luks2/luks2_internal.h:32,
+                 from lib/luks2/luks2_disk_metadata.c:24:
+lib/luks2/luks2.h:86: error: redefinition of typedef 'json_object'
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+ lib/luks2/luks2.h | 1 -
+ lib/setup.c       | 1 +
+ 2 files changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
+index ee57b41ba974..25e36190da45 100644
+--- a/lib/luks2/luks2.h
++++ b/lib/luks2/luks2.h
+@@ -83,7 +83,6 @@ struct luks2_hdr_disk {
+ /*
+  * LUKS2 header in-memory.
+  */
+-typedef struct json_object json_object;
+ struct luks2_hdr {
+ 	size_t		hdr_size;
+ 	uint64_t	seqid;
+diff --git a/lib/setup.c b/lib/setup.c
+index fddbe7ef7897..856f6e80f465 100644
+--- a/lib/setup.c
++++ b/lib/setup.c
+@@ -28,6 +28,7 @@
+ #include <sys/utsname.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#include <json-c/json.h>
+ 
+ #include "libcryptsetup.h"
+ #include "luks.h"
+-- 
+2.18.0
+