diff mbox

fakeroot: fix build when libcap-dev is installed

Message ID 1451908883-4942-1-git-send-email-luca@lucaceresoli.net
State Superseded
Headers show

Commit Message

Luca Ceresoli Jan. 4, 2016, 12:01 p.m. UTC
On an Ubuntu host, and probably several other build hosts,
host-fakeroot fails building when libcap-dev is installed.

Error message:

  libfakeroot.c:1646:9: error: conflicting types for 'setxattr'
   ssize_t setxattr(const char *path, const char *name, void *value, size_t size, int flags)
           ^
  In file included from /usr/include/sys/capability.h:30:0,
                   from libfakeroot.c:131:
  /usr/include/x86_64-linux-gnu/sys/xattr.h:39:12: note: previous declaration of 'setxattr' was here
   extern int setxattr (const char *__path, const char *__name,
              ^

To reproduce the bug:

  make defconfig && make host-fakeroot

This is a fakeroot bug fixed in Debian since 1.20.1-1 [0]. Apply the
patch [1] to Buildroot as well.

Buildroot bug reported by aborniak [2] on Ubuntu 15.04 x86_64.
Verified on Ubuntu 14.04 x86_64.

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758406
[1] https://sources.debian.net/patches/patch/fakeroot/1.20.2-1/glibc-xattr-types/
[2] https://bugs.busybox.net/show_bug.cgi?id=8541

Reported-by: aborniak <aborniak@gmail.com>
Cc: aborniak <aborniak@gmail.com>
Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 .../fakeroot/0001-Fix-xattr-type-mismatch.patch    | 108 +++++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100644 package/fakeroot/0001-Fix-xattr-type-mismatch.patch

Comments

Arnout Vandecappelle Jan. 4, 2016, 5:47 p.m. UTC | #1
Hi Luca,

On 04-01-16 13:01, Luca Ceresoli wrote:
> On an Ubuntu host, and probably several other build hosts,
> host-fakeroot fails building when libcap-dev is installed.
> 
> Error message:
> 
>   libfakeroot.c:1646:9: error: conflicting types for 'setxattr'
>    ssize_t setxattr(const char *path, const char *name, void *value, size_t size, int flags)
>            ^
>   In file included from /usr/include/sys/capability.h:30:0,
>                    from libfakeroot.c:131:
>   /usr/include/x86_64-linux-gnu/sys/xattr.h:39:12: note: previous declaration of 'setxattr' was here
>    extern int setxattr (const char *__path, const char *__name,
>               ^
> 
> To reproduce the bug:
> 
>   make defconfig && make host-fakeroot
> 
> This is a fakeroot bug fixed in Debian since 1.20.1-1 [0]. Apply the
> patch [1] to Buildroot as well.

 Are we sure this will not break again on other distros or older Debian/Ubuntu?


> 
> Buildroot bug reported by aborniak [2] on Ubuntu 15.04 x86_64.
> Verified on Ubuntu 14.04 x86_64.
> 
> [0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758406
> [1] https://sources.debian.net/patches/patch/fakeroot/1.20.2-1/glibc-xattr-types/
> [2] https://bugs.busybox.net/show_bug.cgi?id=8541
> 
> Reported-by: aborniak <aborniak@gmail.com>
> Cc: aborniak <aborniak@gmail.com>
> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
>  .../fakeroot/0001-Fix-xattr-type-mismatch.patch    | 108 +++++++++++++++++++++
>  1 file changed, 108 insertions(+)
>  create mode 100644 package/fakeroot/0001-Fix-xattr-type-mismatch.patch
> 
> diff --git a/package/fakeroot/0001-Fix-xattr-type-mismatch.patch b/package/fakeroot/0001-Fix-xattr-type-mismatch.patch
> new file mode 100644
> index 0000000..01962e2
> --- /dev/null
> +++ b/package/fakeroot/0001-Fix-xattr-type-mismatch.patch
> @@ -0,0 +1,108 @@
> +Fix the type of xattr functions to match the glibc headers.

 You should refer to the upstream patch here as well. Ideally also
mention the author but that is hard to find.

 But AFAICS it is identical to upstream, so why not

FAKEROOT_PATCHES = \
	http://sources.debian.net/data/main/f/fakeroot/1.20.2-1/debian/patches/glibc-xattr-types

?

(I'm not 100% sure, but I believe that sources.debian.net should be as stable as snapshot.debian.org).


 Regards,
 Arnout


[snip]
Arnout Vandecappelle Jan. 4, 2016, 9:36 p.m. UTC | #2
On 04-01-16 18:47, Arnout Vandecappelle wrote:
>  Hi Luca,
> 
> On 04-01-16 13:01, Luca Ceresoli wrote:
>> On an Ubuntu host, and probably several other build hosts,
>> host-fakeroot fails building when libcap-dev is installed.
>>
>> Error message:
>>
>>   libfakeroot.c:1646:9: error: conflicting types for 'setxattr'
>>    ssize_t setxattr(const char *path, const char *name, void *value, size_t size, int flags)
>>            ^
>>   In file included from /usr/include/sys/capability.h:30:0,
>>                    from libfakeroot.c:131:
>>   /usr/include/x86_64-linux-gnu/sys/xattr.h:39:12: note: previous declaration of 'setxattr' was here
>>    extern int setxattr (const char *__path, const char *__name,
>>               ^
>>
>> To reproduce the bug:
>>
>>   make defconfig && make host-fakeroot
>>
>> This is a fakeroot bug fixed in Debian since 1.20.1-1 [0]. Apply the
>> patch [1] to Buildroot as well.
> 
>  Are we sure this will not break again on other distros or older Debian/Ubuntu?

 I prefer Ricardo's alternative.

 We will have to pay attention however, if upstream (i.e. Debian?) releases a
new version, that we _don't_ take this patch along. Although I'm not sure if the
upstream patch really breaks the build on older systems, I haven't checked when
xattr.h has changed.

 Regards,
 Arnout
Luca Ceresoli Jan. 4, 2016, 10:07 p.m. UTC | #3
Hi Arnout,

Arnout Vandecappelle wrote:
> On 04-01-16 18:47, Arnout Vandecappelle wrote:
>>   Hi Luca,
>>
>> On 04-01-16 13:01, Luca Ceresoli wrote:
>>> On an Ubuntu host, and probably several other build hosts,
>>> host-fakeroot fails building when libcap-dev is installed.
>>>
>>> Error message:
>>>
>>>    libfakeroot.c:1646:9: error: conflicting types for 'setxattr'
>>>     ssize_t setxattr(const char *path, const char *name, void *value, size_t size, int flags)
>>>             ^
>>>    In file included from /usr/include/sys/capability.h:30:0,
>>>                     from libfakeroot.c:131:
>>>    /usr/include/x86_64-linux-gnu/sys/xattr.h:39:12: note: previous declaration of 'setxattr' was here
>>>     extern int setxattr (const char *__path, const char *__name,
>>>                ^
>>>
>>> To reproduce the bug:
>>>
>>>    make defconfig && make host-fakeroot
>>>
>>> This is a fakeroot bug fixed in Debian since 1.20.1-1 [0]. Apply the
>>> patch [1] to Buildroot as well.
>>
>>   Are we sure this will not break again on other distros or older Debian/Ubuntu?

Not sure, but xattr.h should not have changed recently. However...

>
>   I prefer Ricardo's alternative.

...I do prefer Ricardo's patch as well. Thanks, Ricardo. And since it
has already been committed, this discussion is now pointless.

I marked this patch as Superseded in patchwork.
diff mbox

Patch

diff --git a/package/fakeroot/0001-Fix-xattr-type-mismatch.patch b/package/fakeroot/0001-Fix-xattr-type-mismatch.patch
new file mode 100644
index 0000000..01962e2
--- /dev/null
+++ b/package/fakeroot/0001-Fix-xattr-type-mismatch.patch
@@ -0,0 +1,108 @@ 
+Fix the type of xattr functions to match the glibc headers.
+
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -1570,7 +1570,7 @@
+ #endif /* HAVE_CAPSET */
+ 
+ #if defined(HAVE_SETXATTR) || defined(HAVE_LSETXATTR) || defined(HAVE_FSETXATTR)
+-static size_t common_setxattr(INT_STRUCT_STAT *st, const char *name, void * value, size_t size, int flags)
++static int common_setxattr(INT_STRUCT_STAT *st, const char *name, const void * value, size_t size, int flags)
+ {
+   xattr_args xattr;
+   xattr.name = name;
+@@ -1625,7 +1625,7 @@
+ #endif /* defined(HAVE_LISTXATTR) || defined(HAVE_LLISTXATTR) || defined(HAVE_FLISTXATTR) */
+ 
+ #if defined(HAVE_REMOVEXATTR) || defined(HAVE_LREMOVEXATTR) || defined(HAVE_FREMOVEXATTR)
+-static size_t common_removexattr(INT_STRUCT_STAT *st, const char *name)
++static int common_removexattr(INT_STRUCT_STAT *st, const char *name)
+ {
+   xattr_args xattr;
+   xattr.name = name;
+@@ -1643,7 +1643,7 @@
+ #endif /* defined(HAVE_REMOVEXATTR) || defined(HAVE_LREMOVEXATTR) || defined(HAVE_FREMOVEXATTR) */
+ 
+ #ifdef HAVE_SETXATTR
+-ssize_t setxattr(const char *path, const char *name, void *value, size_t size, int flags)
++int setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
+ {
+   INT_STRUCT_STAT st;
+   int r;
+@@ -1664,7 +1664,7 @@
+ #endif /* HAVE_SETXATTR */
+ 
+ #ifdef HAVE_LSETXATTR
+-ssize_t lsetxattr(const char *path, const char *name, void *value, size_t size, int flags)
++int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
+ {
+   INT_STRUCT_STAT st;
+   int r;
+@@ -1685,7 +1685,7 @@
+ #endif /* HAVE_LSETXATTR */
+ 
+ #ifdef HAVE_FSETXATTR
+-ssize_t fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
++int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags)
+ {
+   INT_STRUCT_STAT st;
+   int r;
+@@ -1832,7 +1832,7 @@
+ #endif /* HAVE_FLISTXATTR */
+ 
+ #ifdef HAVE_REMOVEXATTR
+-ssize_t removexattr(const char *path, const char *name)
++int removexattr(const char *path, const char *name)
+ {
+   INT_STRUCT_STAT st;
+   int r;
+@@ -1853,7 +1853,7 @@
+ #endif /* HAVE_REMOVEXATTR */
+ 
+ #ifdef HAVE_LREMOVEXATTR
+-ssize_t lremovexattr(const char *path, const char *name)
++int lremovexattr(const char *path, const char *name)
+ {
+   INT_STRUCT_STAT st;
+   int r;
+@@ -1874,7 +1874,7 @@
+ #endif /* HAVE_LREMOVEXATTR */
+ 
+ #ifdef HAVE_FREMOVEXATTR
+-ssize_t fremovexattr(int fd, const char *name)
++int fremovexattr(int fd, const char *name)
+ {
+   INT_STRUCT_STAT st;
+   int r;
+--- a/wrapfunc.inp
++++ b/wrapfunc.inp
+@@ -168,22 +168,22 @@
+ fgetxattr;ssize_t;(int fd, const char *name, void *value, size_t size);(fd, name, value, size)
+ #endif /* HAVE_FGETXATTR */
+ #ifdef HAVE_SETXATTR
+-setxattr;ssize_t;(const char *path, const char *name, void *value, size_t size, int flags);(path, name, value, size, flags)
++setxattr;int;(const char *path, const char *name, const void *value, size_t size, int flags);(path, name, value, size, flags)
+ #endif /* HAVE_SETXATTR */
+ #ifdef HAVE_LSETXATTR
+-lsetxattr;ssize_t;(const char *path, const char *name, void *value, size_t size, int flags);(path, name, value, size, flags)
++lsetxattr;int;(const char *path, const char *name, const void *value, size_t size, int flags);(path, name, value, size, flags)
+ #endif /* HAVE_LSETXATTR */
+ #ifdef HAVE_FSETXATTR
+-fsetxattr;ssize_t;(int fd, const char *name, void *value, size_t size, int flags);(fd, name, value, size, flags)
++fsetxattr;int;(int fd, const char *name, const void *value, size_t size, int flags);(fd, name, value, size, flags)
+ #endif /* HAVE_FSETXATTR */
+ #ifdef HAVE_REMOVEXATTR
+-removexattr;ssize_t;(const char *path, const char *name);(path, name)
++removexattr;int;(const char *path, const char *name);(path, name)
+ #endif /* HAVE_REMOVEXATTR */
+ #ifdef HAVE_LREMOVEXATTR
+-lremovexattr;ssize_t;(const char *path, const char *name);(path, name)
++lremovexattr;int;(const char *path, const char *name);(path, name)
+ #endif /* HAVE_LREMOVEXATTR */
+ #ifdef HAVE_FREMOVEXATTR
+-fremovexattr;ssize_t;(int fd, const char *name);(fd, name)
++fremovexattr;int;(int fd, const char *name);(fd, name)
+ #endif /* HAVE_FREMOVEXATTR */
+ 
+ #ifdef HAVE_FSTATAT
+