Re: [PATCH] Fix include for xattr.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 06, 2018 at 10:31:07AM +0200, Martin Kletzander wrote:
> The proper file that should be included is `sys/xattr.h` as that comes from
> `glibc` and not `attr/xattr.h` which ships with the `attr` utility.
> 
> We're most probably not the only ones because `attr/xattr.h` added a #warning to
> their include resulting in the following compilation errors:
> 
> In file included from securityselinuxlabeltest.c:31:0:
> /usr/include/attr/xattr.h:5:2: error: #warning "Please change your <attr/xattr.h> includes to <sys/xattr.h>" [-Werror=cpp]
>  #warning "Please change your <attr/xattr.h> includes to <sys/xattr.h>"
>   ^~~~~~~
> 
> In file included from securityselinuxhelper.c:37:0:
> /usr/include/attr/xattr.h:5:2: error: #warning "Please change your <attr/xattr.h> includes to <sys/xattr.h>" [-Werror=cpp]
>  #warning "Please change your <attr/xattr.h> includes to <sys/xattr.h>"
>   ^~~~~~~

So looks like we were confused when first doing this. This header is provided
by the libattr-devel RPM so appears fine to use, but in fact only the
attr/libattr.h header is allowed. The attr/xattr.h header is in fact preventing
to be sys/xattr.h, as it contains this:

  #ifndef _SYS_XATTR_H
  #define _SYS_XATTR_H    1


> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
> 
> Not pushing as build-breaker because we are still in freeze and I'd still like
> someone with SELinux to check this patch.  My VM with such system stopped
> working just now =(
> 
>  m4/virt-attr.m4                  | 2 +-
>  tests/securityselinuxhelper.c    | 2 +-
>  tests/securityselinuxlabeltest.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/m4/virt-attr.m4 b/m4/virt-attr.m4
> index c55bd7dbd823..478549c17f12 100644
> --- a/m4/virt-attr.m4
> +++ b/m4/virt-attr.m4
> @@ -5,7 +5,7 @@ AC_DEFUN([LIBVIRT_ARG_ATTR],[
>  ])
>  
>  AC_DEFUN([LIBVIRT_CHECK_ATTR],[
> -  LIBVIRT_CHECK_LIB([ATTR], [attr], [getxattr], [attr/xattr.h])
> +  LIBVIRT_CHECK_LIB([ATTR], [attr], [getxattr], [sys/xattr.h])
>  ])
>  
>  AC_DEFUN([LIBVIRT_RESULT_ATTR],[
> diff --git a/tests/securityselinuxhelper.c b/tests/securityselinuxhelper.c
> index 22b6709554b4..fe6f2b5fd9b0 100644
> --- a/tests/securityselinuxhelper.c
> +++ b/tests/securityselinuxhelper.c
> @@ -34,7 +34,7 @@
>  #include <string.h>
>  #include <sys/vfs.h>
>  #include <unistd.h>
> -#include <attr/xattr.h>
> +#include <sys/xattr.h>
>  
>  #ifndef NFS_SUPER_MAGIC
>  # define NFS_SUPER_MAGIC 0x6969
> diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
> index c684989fd26e..48fee7cd285b 100644
> --- a/tests/securityselinuxlabeltest.c
> +++ b/tests/securityselinuxlabeltest.c
> @@ -28,7 +28,7 @@
>  
>  #include <selinux/selinux.h>
>  #include <selinux/context.h>
> -#include <attr/xattr.h>
> +#include <sys/xattr.h>
>  
>  #include "internal.h"
>  #include "testutils.h"

Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux