bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] ls - colorize files with capabilities


From: Jim Meyering
Subject: Re: [PATCH] ls - colorize files with capabilities
Date: Fri, 25 Jul 2008 12:40:25 +0200

Kamil Dudka <address@hidden> wrote:
> I hope I didn't forget  anything this time. New version of patch is
> in attachment.

Thanks.
Almost perfect.

Here are two additional change-sets that I will merge into yours.
In the first one, while moving the m4 code, I adjusted quoting (both bourne
shell and m4), and swapped compare arguments in the test script so any diff
output doesn't appear reversed.
The second fixes a problem caught by "make syntax-check".

On what type of system did the new test succeed for you?
On rawhide, capget appears to malfunction:

  # rm t;>t;strace -e capget setcap cap_net_bind_service=ep t 2>&1|cut -c-78
  capget(0x20071026, 0, NULL)             = -1 EFAULT (Bad address)
  capget(0x20071026, 0, {CAP_CHOWN|CAP_DAC_OVERRIDE|CAP_DAC_READ_SEARCH|CAP_FOWN
  capget(0x20071026, 0, NULL)             = -1 EFAULT (Bad address)
  Failed to set capabilities on file `t' (Operation not permitted)
  usage: setcap [-q] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>)
  <filenameN> ]

   Note <filename> must be a regular (non-symlink) file.

Considering the test doesn't pass anywhere I've tried, I'm in
no hurry to apply it.

>From 25b74ca3b1e713b97908bd2e9edd0daba81563bb Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 25 Jul 2008 11:58:00 +0200
Subject: [PATCH] m4/jm-macro.m4: put new test here, not in configure.ac

---
 configure.ac        |   13 -------------
 m4/jm-macros.m4     |   13 +++++++++++++
 tests/ls/capability |    2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 96b2fda..ac93e1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,19 +44,6 @@ gl_EARLY
 gl_INIT
 coreutils_MACROS

-dnl Check whether libcap is usable
-AC_ARG_ENABLE([libcap],
-  AC_HELP_STRING([--disable-libcap], [disable libcap support]),
-  AC_MSG_WARN([libcap support disabled by user]),
-  [AC_CHECK_LIB([cap], [cap_get_file],
-    [AC_CHECK_HEADER([sys/capability.h],
-      [LIB_CAP="-lcap" AC_DEFINE(HAVE_CAP, 1, [libcap usability])],
-      [AC_MSG_WARN([header sys/capability.h was not found, support for libcap 
will not be built])]
-      )],
-    [AC_MSG_WARN([libcap library was not found or not usable, support for 
libcap will not be built])])
-    ])
-AC_SUBST([LIB_CAP])
-
 AC_FUNC_FORK

 optional_bin_progs=
diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
index 062737b..a691d95 100644
--- a/m4/jm-macros.m4
+++ b/m4/jm-macros.m4
@@ -82,6 +82,19 @@ AC_DEFUN([coreutils_MACROS],
     AC_CHECK_FUNCS(fdatasync)
   LIBS=$coreutils_saved_libs

+  # Check whether libcap is usable -- for ls --color support
+  AC_ARG_ENABLE([libcap],
+    AC_HELP_STRING([--disable-libcap], [disable libcap support]),
+    AC_MSG_WARN([libcap support disabled by user]),
+    [AC_CHECK_LIB([cap], [cap_get_file],
+      [AC_CHECK_HEADER([sys/capability.h],
+        [LIB_CAP=-lcap AC_DEFINE([HAVE_CAP], 1, [libcap usability])],
+        [AC_MSG_WARN([header sys/capability.h was not found, support for 
libcap will not be built])]
+      )],
+      [AC_MSG_WARN([libcap library was not found or not usable, support for 
libcap will not be built])])
+    ])
+  AC_SUBST([LIB_CAP])
+
   # See if linking `seq' requires -lm.
   # It does on nearly every system.  The single exception (so far) is
   # BeOS which has all the math functions in the normal runtime library
diff --git a/tests/ls/capability b/tests/ls/capability
index 787de58..549e06b 100755
--- a/tests/ls/capability
+++ b/tests/ls/capability
@@ -38,6 +38,6 @@ code='30;41'
 LS_COLORS="ca=$code" \
   ls --color=always test > out || fail=1
 printf "\033[0m\033[${code}mtest\033[0m\n\033[m" > out_ok || fail=1
-compare out_ok out || fail=1
+compare out out_ok || fail=1

 (exit $fail); exit $fail
--
1.6.0.rc0.46.g2ac23


>From 076cbe6cf31cd33632ce86df6b4be3087ea3db8f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 25 Jul 2008 12:09:11 +0200
Subject: [PATCH] * tests/Makefile.am (root_tests): Add ls/capability.

not in TESTS.
---
 tests/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 309d174..7bdf88a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ root_tests =                                  \
   cp/cp-a-selinux                              \
   cp/preserve-gid                              \
   cp/special-bits                              \
+  ls/capability                                        \
   ls/nameless-uid                              \
   misc/chcon                                   \
   misc/selinux                                 \
@@ -313,7 +314,6 @@ TESTS =                                             \
   ln/misc                                      \
   ln/sf-1                                      \
   ln/target-1                                  \
-  ls/capability                                        \
   ls/color-dtype-dir                           \
   ls/dangle                                    \
   ls/dired                                     \
--
1.6.0.rc0.46.g2ac23




reply via email to

[Prev in Thread] Current Thread [Next in Thread]