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 Thursday 05 September 2013 02:59:01 Andreas Jaeger wrote:
> 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/bu
> >> ild
> >> /glibc/x86-64/elf:/home/aj/build/glibc/x86-64/dlfcn:/home/aj/build/glib
> >> c/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?

sending a proper patch before discussion/testing has finished is usually a
waste of time due to the ChangeLog crap, so i don't bother until we agree

i've committed the patch below
-mike

From bb8ea71379ce66936284a6e7ea60dc8255d2ed7f Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 5 Sep 2013 03:02:46 -0400
Subject: [PATCH] tst-fanotify: skip when we get back EPERM

Since fanotify_init requires CAP_SYS_ADMIN in order to work (which usually
means running as root), we need to handle that error case too.

Reported-by: Andreas Jaeger <aj@suse.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 ChangeLog                              |  5 +++++
 sysdeps/unix/sysv/linux/tst-fanotify.c | 13 ++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1f29127..773ea6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-05  Mike Frysinger  <vapier@gentoo.org>
+
+	* sysdeps/unix/sysv/linux/tst-fanotify.c (do_test): Skip test when
+	fanotify_init returns EPERM.
+
 2013-09-04  Joseph Myers  <joseph@codesourcery.com>
 
 	* conform/conformtest.pl (newtoken): Treat tokens not allowed as
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;
-- 
1.8.3.2

Attachment: signature.asc
Description: This is a digitally signed message part.


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