This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2 v3] tst-fanotify: new simple test


On 09/05/2013 08:34 AM, Mike Frysinger wrote:
> On Wednesday 04 September 2013 04:56:43 Andreas Jaeger wrote:
>> On 09/03/2013 05:20 AM, Mike Frysinger wrote:
>>> Basic test for the fanotify functions.
>>
>> This test fails on my Linux 3.10 x86-64 system:
>>
>> env GCONV_PATH=/home/aj/build/glibc/x86-64/iconvdata LC_ALL=C
>> /home/aj/build/glibc/x86-64/elf/ld-linux-x86-64.so.2 --library-path
>> /home/aj/build/glibc/x86-64:/home/aj/build/glibc/x86-64/math:/home/aj/build
>> /glibc/x86-64/elf:/home/aj/build/glibc/x86-64/dlfcn:/home/aj/build/glibc/x8
>> 6-64/nss:/home/aj/build/glibc/x86-64/nis:/home/aj/build/glibc/x86-64/rt:/ho
>> me/aj/build/glibc/x86-64/resolv:/home/aj/build/glibc/x86-64/crypt:/home/aj/
>> build/glibc/x86-64/nptl /home/aj/build/glibc/x86-64/misc/tst-fanotify  >
>> /home/aj/build/glibc/x86-64/misc/tst-fanotify.out
>> fanotify_init (0, 0) failed: Operation not permitted
>> make[2]: *** [/home/aj/build/glibc/x86-64/misc/tst-fanotify.out] Error 1
>>
>>
>> The fanotify_init calls requires the CAP_SYS_ADMIN capability - and
>> since I run this as user, I do not have it.
>>
>> Please let the test fail gracefully in this case and handle EPERM,
> 
> try this

Works for me. Could you send a proper patch, please?

Thanks,
Andreas

> -mike
> 
> diff --git a/sysdeps/unix/sysv/linux/tst-fanotify.c b/sysdeps/unix/sysv/linux/tst-fanotify.c
> index b88995d..b21e160 100644
> --- a/sysdeps/unix/sysv/linux/tst-fanotify.c
> +++ b/sysdeps/unix/sysv/linux/tst-fanotify.c
> @@ -29,11 +29,14 @@ do_test (void)
>    fd = fanotify_init (0, 0);
>    if (fd < 0)
>      {
> -      if (errno == ENOSYS)
> -	{
> -	  puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
> -	  return 0;
> -	}
> +      switch (errno) {
> +      case ENOSYS:
> +	puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
> +	return 0;
> +      case EPERM:
> +	puts ("SKIP: missing proper permissions for runtime test");
> +	return 0;
> +      }
>  
>        perror ("fanotify_init (0, 0) failed");
>        return 1;
> 


-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]