rpms/coreutils/devel coreutils-acl.patch, 1.2, 1.3 coreutils.spec, 1.134, 1.135

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Aug 24 15:53:10 UTC 2006


Author: twaugh

Update of /cvs/dist/rpms/coreutils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv28593

Modified Files:
	coreutils-acl.patch coreutils.spec 
Log Message:
* Thu Aug 24 2006 Tim Waugh <twaugh at redhat.com>
- Fixed warnings in acl patch (bug #203166).


coreutils-acl.patch:
 ChangeLog       |   45 ++++++++++++
 NEWS            |    3 
 config.hin      |   30 ++++++++
 configure.ac    |    2 
 lib/acl.c       |  209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 lib/acl.h       |    7 +
 m4/posix_acl.m4 |   28 +++++++
 src/Makefile.am |   12 +--
 src/copy.c      |  173 +++++++++++++++++++++++++++++-----------------
 src/copy.h      |    3 
 src/cp.c        |   98 +++++++++++++++++++-------
 src/install.c   |    1 
 src/ls.c        |    8 +-
 src/mv.c        |    6 -
 14 files changed, 509 insertions(+), 116 deletions(-)

Index: coreutils-acl.patch
===================================================================
RCS file: /cvs/dist/rpms/coreutils/devel/coreutils-acl.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- coreutils-acl.patch	27 Oct 2005 15:05:08 -0000	1.2
+++ coreutils-acl.patch	24 Aug 2006 15:53:08 -0000	1.3
@@ -1,297 +1,72 @@
---- /dev/null	2005-10-10 09:36:06.437701000 +0100
-+++ coreutils-5.92/m4/posix_acl.m4	2005-10-27 11:44:29.000000000 +0100
-@@ -0,0 +1,28 @@
-+#serial 1
-+
-+dnl Written by Andreas Gruenbacher <a.gruenbacher at computer.org>.
+--- coreutils-5.97/ChangeLog.acl	2006-06-22 13:52:13.000000000 +0100
++++ coreutils-5.97/ChangeLog	2006-08-24 14:07:42.000000000 +0100
+@@ -0,0 +1,45 @@
++2002-07-01  Bernhard Rosenkraenzer <bero at bero.org>
++	* Port the following patch to 4.1.9:
 +
-+dnl Posix 1003.1e draft standard 17 (abandoned) and similar
-+dnl access control list support
-+AC_DEFUN([ag_POSIX_ACL],
-+[
-+  AC_CHECK_HEADERS(sys/acl.h)
-+  AC_CHECK_LIB(acl, main, cu_cv_lacl=yes, cu_cv_lacl=no)
-+  if test "$cu_cv_lacl" = yes; then
-+    LIBACL=-lacl
-+  else
-+    LIBACL=
-+  fi
-+  AC_SUBST(LIBACL)
-+  OLDLIBS="$LIBS"
-+  LIBS="$LIBS $LIBACL"
-+  AC_CHECK_FUNCS(acl_get_file acl_set_file acl_free acl_to_text \
-+                 acl_from_text acl_delete_def_file)
-+  # Linux specific extensions:
-+  AC_CHECK_FUNCS(acl_entries acl_extended_file)
-+  LIBS="$OLDLIBS"
++2002-04-10  Andreas Gruenbacher  <a.gruenbacher at computer.org>
 +
-+  if test $ac_cv_header_sys_acl_h = yes; then
-+    AC_DEFINE(USE_ACL, 1, [Define if you want access control list support.])
-+  fi
-+])
---- coreutils-5.92/lib/acl.h.acl	2005-05-14 08:58:06.000000000 +0100
-+++ coreutils-5.92/lib/acl.h	2005-10-27 11:44:29.000000000 +0100
-@@ -18,11 +18,16 @@
- 
-    Written by Paul Eggert.  */
- 
--#if HAVE_SYS_ACL_H && HAVE_ACL
-+#if HAVE_SYS_ACL_H
- # include <sys/acl.h>
- #endif
-+#if HAVE_SYS_TYPES_H
-+# include <sys/types.h>
-+#endif
- #if ! defined GETACLCNT && defined ACL_CNT
- # define GETACLCNT ACL_CNT
- #endif
- 
- int file_has_acl (char const *, struct stat const *);
-+int copy_acl (char const *, char const *, mode_t);
-+int set_acl (char const *, mode_t);
---- coreutils-5.92/lib/acl.c.acl	2005-09-22 07:47:18.000000000 +0100
-+++ coreutils-5.92/lib/acl.c	2005-10-27 11:44:29.000000000 +0100
-@@ -22,18 +22,30 @@
- # include <config.h>
- #endif
- 
-+#if ENABLE_NLS
-+# include <libintl.h>
-+# define _(Text) gettext (Text)
-+#else
-+# define _(Text) Text
-+#endif
++	* Version 4.1.8acl.
 +
- #include <sys/types.h>
- #include <sys/stat.h>
- #ifndef S_ISLNK
- # define S_ISLNK(Mode) 0
- #endif
- 
-+#include <stdlib.h>
++	* src/copy.c (get_dest_mode): Remove.
++	* src/copy.c (copy_internal): Merge src_mode and src_type.
++	* src/copy.c (copy_internal): Add dst_mode and dst_mode_valid,
++	which are set when the destination file mode is changed temporarily.
++	* src/copy.c (copy_internal): Check effective permissions after
++	mkdir(). Add S_IRWXU only after saving the default permissions, so
++	the default permissions can be restored. This is needed with
++	default ACLs on some systems.
++	* src/copy.c (copy_internal): Use dst_mode and dst_mode_valid for
++	ran_chown. Save the current permissions if needed before chown().
++	* src/copy.c (copy_internal): Clean up the final permission setting
++	code and prepare for copy/set ACL support.
++	* src/cp.c, src/install.c, src/mv.c, src/copy.h: Remove umask_kill,
++	and never change the startup umask. The functions creating files need
++	the original umask to be active to create the correct permissions
++	inside directories with default ACLs; umask_kill no longer works.
++	* src/cp.c (struct dir_attr, re_protect, make_path_private): Remove
++	is_new_dir and add mode and mode_valid instead.
++	* src/cp.c (make_path_private): Remove the mode parameter. Pass in
++	cp_options, instead of cp_options->xstat only. Stat the source dir,
++	and create the destination dir with the source dir's mode as create
++	mode (see analog change to src/copy.c (copy_internal)). Check if the
++	effective permissions include S_IRWXU. Remember the original code only
++	if needed later.
++	* lib/acl.h, lib/acl.c (copy_acl, set_acl): Add these functions,
++	initially with the bare non-ACL functionality.
++	* src/copy.c (copy_internal): Use copy_acl and set_acl instead of chmod.
++	* src/cp.c (re_protect): Use copy_acl instead of chmod.
++	* m4/posix_acl.m4, configure.ac (ag_POSIX_ACL): Add POSIX ACL tests.
++	* lib/acl.h: Remove HAVE_ACL symbol; <sys/acl.h> is needed for POSIX
++	ACLs even if there is no acl system call.
++	* lib/acl.c (ENOTSUP): Provide default value.
++	* lib/acl.c (file_has_acl, copy_acl, set_acl): Add Linux ACL
++	implementations.
++	* src/ls.c: change `HAVE_ACL' to `HAVE_ACL || USE_ACL' for POSIX ACLs:
++	there is no acl system call for POSIX ACLs.
++	* tests/misc: Add my own small test suite so it doesn't get lost.
 +
- #include "acl.h"
- 
- #include <errno.h>
- #ifndef ENOSYS
- # define ENOSYS (-1)
- #endif
-+#ifndef ENOTSUP
-+# define ENOTSUP (-1)
-+#endif
+--- coreutils-5.97/NEWS.acl	2006-08-24 14:07:42.000000000 +0100
++++ coreutils-5.97/NEWS	2006-08-24 14:07:42.000000000 +0100
+@@ -1,3 +1,6 @@
++[4.5.3acl]
++* ACL framework and Linux ACL support.
++* `cp -p' and `mv' now preserve ACLs
+ GNU coreutils NEWS                                    -*- outline -*-
  
- #ifndef MIN_ACL_ENTRIES
- # define MIN_ACL_ENTRIES 4
-@@ -45,19 +57,201 @@
- int
- file_has_acl (char const *file, struct stat const *filestat)
- {
--  /* FIXME: This implementation should work on recent-enough versions
--     of HP-UX, Solaris, and Unixware, but it simply returns 0 with
--     POSIX 1003.1e (draft 17 -- abandoned), AIX, GNU/Linux, Irix, and
--     Tru64.  Please see Samba's source/lib/sysacls.c file for
--     fix-related ideas.  */
--
- #if HAVE_ACL && defined GETACLCNT
-+  /* This implementation should work on recent-enough versions of HP-UX,
-+     Solaris, and Unixware.  */
-+
-   if (! S_ISLNK (filestat->st_mode))
-     {
-       int n = acl (file, GETACLCNT, 0, NULL);
-       return n < 0 ? (errno == ENOSYS ? 0 : -1) : (MIN_ACL_ENTRIES < n);
-     }
-+#elif HAVE_ACL_EXTENDED_FILE
-+
-+  /* Linux specific.  */
-+
-+  if (! S_ISLNK (filestat->st_mode))
-+    {
-+      int ret = acl_extended_file (file);
-+      if (ret < 0)
-+	return (errno == ENOSYS || errno == ENOTSUP) ? 0 : -1;
-+      return ret;
-+    }
-+#else
-+  /* FIXME: Add support for AIX, Irix, and Tru64, FreeBSD, etc.
-+     Please see Samba's source/lib/sysacls.c file for fix-related ideas.  */
- #endif
+ * Major changes in release 5.97 (2006-06-24) [stable]
+--- coreutils-5.97/src/install.c.acl	2005-09-23 21:50:49.000000000 +0100
++++ coreutils-5.97/src/install.c	2006-08-24 14:07:42.000000000 +0100
+@@ -153,7 +153,6 @@
+   x->mode = S_IRUSR | S_IWUSR;
+   x->stdin_tty = false;
  
-   return 0;
- }
-+
-+/* Copy the permissions from SRC_PATH to DST_PATH, including access control
-+   lists on systems where this is supported. MODE is the file mode for
-+   DST_PATH, including the file type.
-+   Also sets special bits in MODE on DST_PATH.  */
-+
-+int
-+copy_acl (char const *src_path, char const *dst_path, mode_t mode)
-+{
-+#if HAVE_ACL_GET_FILE && HAVE_ACL_SET_FILE && HAVE_ACL_FREE && \
-+    HAVE_ACL_ENTRIES
-+
-+  /* Linux specific. Will work on all POSIX 1003.1e draft 17 (abandoned)
-+     compliant systems if the acl_entries() function is implemented.  */
-+
-+  acl_t acl = acl_get_file (src_path, ACL_TYPE_ACCESS);
-+  if (acl == NULL)
-+    {
-+      if (errno == ENOSYS || errno == ENOTSUP)
-+	return set_acl (dst_path, mode);
-+      else
-+        {
-+	  error (0, errno, "%s", quote (src_path));
-+	  return -1;
-+	}
-+    }
-+
-+  if (acl_set_file (dst_path, ACL_TYPE_ACCESS, acl))
-+    {
-+      int saved_errno = errno;
-+
-+      if (errno == ENOSYS || errno == ENOTSUP)
-+        {
-+	  int n = acl_entries (acl);
-+
-+	  acl_free (acl);
-+	  if (n == 3)
-+	    {
-+	      if (chmod (dst_path, mode))
-+		saved_errno = errno;
-+	      else
-+		return 0;
-+	    }
-+	  else
-+	    chmod (dst_path, mode);
-+	}
-+      else
-+	{
-+	  acl_free (acl);
-+	  chmod (dst_path, mode);
-+	}
-+      error (0, saved_errno, _("preserving permissions for %s"),
-+	     quote (dst_path));
-+      return -1;
-+    }
-+  acl_free (acl);
-+
-+  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
-+    {
-+      /* We did not call chmod so far, so the special bits have not yet
-+         been set.  */
-+
-+      if (chmod (dst_path, mode))
-+	{
-+	  error (0, errno, _("preserving permissions for %s"),
-+	  	 quote (dst_path));
-+	  return -1;
-+	}
-+    }
-+
-+  if (S_ISDIR (mode))
-+    {
-+      acl = acl_get_file (src_path, ACL_TYPE_DEFAULT);
-+      if (acl == NULL)
-+	{
-+	  error (0, errno, "%s", quote (src_path));
-+	  return -1;
-+	}
-+
-+      if (acl_set_file (dst_path, ACL_TYPE_DEFAULT, acl))
-+	{
-+	  error (0, errno, _("preserving permissions for %s"),
-+		 quote (dst_path));
-+	  acl_free(acl);
-+	  return -1;
-+	}
-+      else
-+        acl_free(acl);
-+    }
-+  return 0;
-+#else
-+  int ret = chmod (dst_path, mode);
-+  if (ret)
-+    error (0, errno, _("preserving permissions for %s"), quote (dst_path));
-+  return ret;
-+#endif
-+}
-+
-+/* Set the permissions of PATH, overwriting access control lists, on systems
-+   where this is supported. MODE is the file mode for PATH, including the
-+   file type. Also sets special bits in MODE on PATH.  */
-+
-+int
-+set_acl (char const *path, mode_t mode)
-+{
-+#if HAVE_ACL_FROM_TEXT && HAVE_ACL_SET_FILE && HAVE_ACL_FREE && \
-+       HAVE_ACL_DELETE_DEF_FILE
-+  char acl_text[] = "u::---,g::---,o::---";
-+  acl_t acl;
-+
-+  if (mode & S_IRUSR) acl_text[ 3] = 'r';
-+  if (mode & S_IWUSR) acl_text[ 4] = 'w';
-+  if (mode & S_IXUSR) acl_text[ 5] = 'x';
-+  if (mode & S_IRGRP) acl_text[10] = 'r';
-+  if (mode & S_IWGRP) acl_text[11] = 'w';
-+  if (mode & S_IXGRP) acl_text[12] = 'x';
-+  if (mode & S_IROTH) acl_text[17] = 'r';
-+  if (mode & S_IWOTH) acl_text[18] = 'w';
-+  if (mode & S_IXOTH) acl_text[19] = 'x';
-+
-+  acl = acl_from_text(acl_text);
-+  if (!acl)
-+    {
-+      error (0, errno, "%s", quote (path));
-+      return -1;
-+    }
-+
-+  if (acl_set_file(path, ACL_TYPE_ACCESS, acl))
-+    {
-+      int saved_errno = errno;
-+      acl_free (acl);
-+
-+      if (errno == ENOTSUP || errno == ENOSYS)
-+	{
-+	  if (chmod (path, mode))
-+	    saved_errno = errno;
-+	  else
-+	    return 0;
-+	}
-+      error (0, saved_errno, _("setting permissions for %s"), quote (path));
-+      return -1;
-+    }
-+  acl_free (acl);
-+
-+  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
-+    {
-+      /* We did not call chmod so far, so the special bits have not yet
-+         been set.  */
-+
-+      if (chmod (path, mode))
-+	{
-+	  error (0, errno, _("preserving permissions for %s"),
-+	  	 quote (path));
-+	  return -1;
-+	}
-+    }
-+
-+  if (S_ISDIR (mode) && acl_delete_def_file (path))
-+    {
-+      error (0, errno, _("setting permissions for %s"), quote (path));
-+      return -1;
-+    }
-+  return 0;
-+#else
-+  int ret = chmod (path, mode);
-+  if (ret)
-+    error (0, errno, _("setting permissions for %s"), quote (path));
-+  return ret;
-+#endif
-+}
-+
---- coreutils-5.92/src/mv.c.acl	2005-07-03 17:55:19.000000000 +0100
-+++ coreutils-5.92/src/mv.c	2005-10-27 11:44:29.000000000 +0100
+-  x->umask_kill = 0;
+   x->update = false;
+   x->verbose = false;
+   x->dest_info = NULL;
+--- coreutils-5.97/src/mv.c.acl	2006-01-21 11:15:35.000000000 +0000
++++ coreutils-5.97/src/mv.c	2006-08-24 14:07:42.000000000 +0100
 @@ -135,12 +135,6 @@
    x->mode = 0;
    x->stdin_tty = isatty (STDIN_FILENO);
@@ -305,55 +80,17 @@
    x->update = false;
    x->verbose = false;
    x->dest_info = NULL;
---- coreutils-5.92/src/ls.c.acl	2005-10-27 11:44:29.000000000 +0100
-+++ coreutils-5.92/src/ls.c	2005-10-27 11:44:29.000000000 +0100
-@@ -193,13 +193,13 @@
- 
-     enum filetype filetype;
- 
--#if HAVE_ACL
-+#if HAVE_ACL || USE_ACL
-     /* For long listings, true if the file has an access control list.  */
-     bool have_acl;
- #endif
-   };
- 
--#if HAVE_ACL
-+#if HAVE_ACL || USE_ACL
- # define FILE_HAS_ACL(F) ((F)->have_acl)
- #else
- # define FILE_HAS_ACL(F) 0
-@@ -334,7 +334,7 @@
- /* Whether any of the files has an ACL.  This affects the width of the
-    mode column.  */
- 
--#if HAVE_ACL
-+#if HAVE_ACL || USE_ACL
- static bool any_has_acl;
- #else
- enum { any_has_acl = false };
-@@ -2582,7 +2582,7 @@
- 	  return 0;
- 	}
- 
--#if HAVE_ACL
-+#if HAVE_ACL || USE_ACL
-       if (format == long_format)
- 	{
- 	  int n = file_has_acl (absolute_name, &f->stat);
---- coreutils-5.92/src/install.c.acl	2005-09-23 21:58:37.000000000 +0100
-+++ coreutils-5.92/src/install.c	2005-10-27 11:44:29.000000000 +0100
-@@ -153,7 +153,6 @@
-   x->mode = S_IRUSR | S_IWUSR;
-   x->stdin_tty = false;
- 
--  x->umask_kill = 0;
-   x->update = false;
-   x->verbose = false;
-   x->dest_info = NULL;
---- coreutils-5.92/src/cp.c.acl	2005-09-16 08:51:01.000000000 +0100
-+++ coreutils-5.92/src/cp.c	2005-10-27 11:44:29.000000000 +0100
-@@ -56,7 +56,8 @@
+--- coreutils-5.97/src/cp.c.acl	2005-09-16 08:50:33.000000000 +0100
++++ coreutils-5.97/src/cp.c	2006-08-24 14:13:48.000000000 +0100
+@@ -24,6 +24,7 @@
+ #include <getopt.h>
+ 
+ #include "system.h"
++#include "acl.h"
+ #include "argmatch.h"
+ #include "backupfile.h"
+ #include "copy.h"
+@@ -56,7 +57,8 @@
     need to be fixed after copying. */
  struct dir_attr
  {
@@ -363,7 +100,7 @@
    size_t slash_offset;
    struct dir_attr *next;
  };
-@@ -327,9 +328,14 @@
+@@ -327,9 +329,14 @@
  	    }
  	}
  
@@ -381,7 +118,7 @@
  	    {
  	      error (0, errno, _("failed to preserve permissions for %s"),
  		     quote (dst_name));
-@@ -347,8 +353,7 @@
+@@ -347,8 +354,7 @@
  
     SRC_OFFSET is the index in CONST_DIR (which is a destination
     directory) of the beginning of the source directory name.
@@ -391,7 +128,7 @@
     If VERBOSE_FMT_STRING is nonzero, use it as a printf format
     string for printing a message after successfully making a directory.
     The format should take two string arguments: the names of the
-@@ -364,15 +369,20 @@
+@@ -364,15 +370,20 @@
  
  static bool
  make_dir_parents_private (char const *const_dir, size_t src_offset,
@@ -414,7 +151,7 @@
  
    ASSIGN_STRDUPA (dir, const_dir);
  
-@@ -407,12 +417,20 @@
+@@ -407,12 +418,20 @@
  	  if ((*xstat) (dir, &stats))
  	    {
  	      /* This component does not exist.  We must set
@@ -437,7 +174,7 @@
  	      if (mkdir (dir, mode))
  		{
  		  error (0, errno, _("cannot make directory %s"),
-@@ -424,6 +442,46 @@
+@@ -424,6 +443,46 @@
  		  if (verbose_fmt_string != NULL)
  		    printf (verbose_fmt_string, src, dir);
  		}
@@ -484,7 +221,7 @@
  	    }
  	  else if (!S_ISDIR (stats.st_mode))
  	    {
-@@ -433,7 +491,7 @@
+@@ -433,7 +492,7 @@
  	    }
  	  else
  	    {
@@ -493,7 +230,7 @@
  	      *new_dst = false;
  	    }
  	  *slash++ = '/';
-@@ -536,10 +594,6 @@
+@@ -536,10 +595,6 @@
  	 Copy the files `file1' through `filen'
  	 to the existing directory `edir'. */
        int i;
@@ -504,7 +241,7 @@
  
        /* Initialize these hash tables only if we'll need them.
  	 The problems they're used to detect can arise only if
-@@ -585,9 +639,9 @@
+@@ -585,9 +640,9 @@
  	         leading directories. */
  	      parent_exists =
  		(make_dir_parents_private
@@ -516,7 +253,7 @@
  	    }
  	  else
  	    {
-@@ -697,12 +751,6 @@
+@@ -697,12 +752,6 @@
    /* Not used.  */
    x->stdin_tty = false;
  
@@ -529,7 +266,7 @@
    x->update = false;
    x->verbose = false;
    x->dest_info = NULL;
-@@ -987,9 +1035,6 @@
+@@ -987,9 +1036,6 @@
  				   version_control_string)
  		   : no_backups);
  
@@ -539,21 +276,83 @@
    if (x.dereference == DEREF_UNDEFINED)
      {
        if (x.recursive)
---- coreutils-5.92/src/copy.h.acl	2005-07-03 10:45:51.000000000 +0100
-+++ coreutils-5.92/src/copy.h	2005-10-27 11:44:29.000000000 +0100
-@@ -165,9 +165,6 @@
-      Create destination directories as usual. */
-   bool symbolic_link;
+--- coreutils-5.97/src/Makefile.am.acl	2006-08-24 14:07:42.000000000 +0100
++++ coreutils-5.97/src/Makefile.am	2006-08-24 14:07:42.000000000 +0100
+@@ -52,9 +52,9 @@
+ LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
+ 
+ # for eaccess in lib/euidaccess.c.
+-cp_LDADD = $(LDADD) $(LIB_EACCESS)
+-ginstall_LDADD = $(LDADD) $(LIB_EACCESS)
+-mv_LDADD = $(LDADD) $(LIB_EACCESS)
++cp_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@
++ginstall_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@
++mv_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@
+ pathchk_LDADD = $(LDADD) $(LIB_EACCESS)
+ rm_LDADD = $(LDADD) $(LIB_EACCESS)
+ test_LDADD = $(LDADD) $(LIB_EACCESS)
+@@ -63,11 +63,11 @@
+ 
+ # for clock_gettime and fdatasync
+ dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
+-dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+-ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
++dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@
++ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@
+ pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+ shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
+-vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
++vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@
+ 
+ ## If necessary, add -lm to resolve use of pow in lib/strtod.c.
+ sort_LDADD = $(LDADD) $(POW_LIB)
+--- coreutils-5.97/src/ls.c.acl	2006-08-24 14:07:42.000000000 +0100
++++ coreutils-5.97/src/ls.c	2006-08-24 14:07:42.000000000 +0100
+@@ -193,13 +193,13 @@
+ 
+     enum filetype filetype;
+ 
+-#if HAVE_ACL
++#if HAVE_ACL || USE_ACL
+     /* For long listings, true if the file has an access control list.  */
+     bool have_acl;
+ #endif
+   };
+ 
+-#if HAVE_ACL
++#if HAVE_ACL || USE_ACL
+ # define FILE_HAS_ACL(F) ((F)->have_acl)
+ #else
+ # define FILE_HAS_ACL(F) 0
+@@ -334,7 +334,7 @@
+ /* Whether any of the files has an ACL.  This affects the width of the
+    mode column.  */
+ 
+-#if HAVE_ACL
++#if HAVE_ACL || USE_ACL
+ static bool any_has_acl;
+ #else
+ enum { any_has_acl = false };
+@@ -2582,7 +2582,7 @@
+ 	  return 0;
+ 	}
  
--  /* The bits to preserve in created files' modes. */
--  mode_t umask_kill;
--
-   /* If true, do not copy a nondirectory that has an existing destination
-      with the same or newer modification time. */
-   bool update;
---- coreutils-5.92/src/copy.c.acl	2005-09-25 06:57:47.000000000 +0100
-+++ coreutils-5.92/src/copy.c	2005-10-27 11:57:41.000000000 +0100
-@@ -101,26 +101,6 @@
+-#if HAVE_ACL
++#if HAVE_ACL || USE_ACL
+       if (format == long_format)
+ 	{
+ 	  int n = file_has_acl (absolute_name, &f->stat);
+--- coreutils-5.97/src/copy.c.acl	2006-05-12 08:04:29.000000000 +0100
++++ coreutils-5.97/src/copy.c	2006-08-24 14:14:52.000000000 +0100
+@@ -30,6 +30,7 @@
+ #endif
+ 
+ #include "system.h"
++#include "acl.h"
+ #include "backupfile.h"
+ #include "copy.h"
+ #include "cp-hash.h"
+@@ -101,26 +102,6 @@
  /* The invocation name of this program.  */
  extern char *program_name;
  
@@ -580,7 +379,7 @@
  /* FIXME: describe */
  /* FIXME: rewrite this to use a hash table so we avoid the quadratic
     performance hit that's probably noticeable only on trees deeper
-@@ -460,18 +440,41 @@
+@@ -460,18 +441,41 @@
       succeeded, because the chown must have reset those bits.  */
    if (!(*new_dst
  	&& !(*chown_succeeded && (src_sb->st_mode & ~S_IRWXUGO)))
@@ -589,9 +388,11 @@
      {
 -      if (fchmod (dest_desc, get_dest_mode (x, src_sb->st_mode)) != 0)
 +      if (x->preserve_mode || x->move_mode)
-+	{
+ 	{
+-	  error (0, errno, _("setting permissions for %s"), quote (dst_name));
+-	  if (x->set_mode || x->require_preserve)
 +	  if (copy_acl (src_name, dst_name, src_sb->st_mode))
-+	    {
+ 	    {
 +	      error (0, errno, _("preserving ACL for %s"), quote (dst_name));
 +	      if (x->set_mode || x->require_preserve)
 +	      {
@@ -601,11 +402,9 @@
 +	    }
 +	}
 +      else if (x->set_mode)
- 	{
--	  error (0, errno, _("setting permissions for %s"), quote (dst_name));
--	  if (x->set_mode || x->require_preserve)
++	{
 +	  if (set_acl (dst_name, x->mode))
- 	    {
++	    {
 +	      error (0, errno, _("setting ACL for %s"), quote (dst_name));
  	      return_val = false;
  	      goto close_src_and_dst_desc;
@@ -626,7 +425,7 @@
      }
  #endif
  
-@@ -908,13 +911,14 @@
+@@ -908,13 +912,14 @@
    struct stat src_sb;
    struct stat dst_sb;
    mode_t src_mode;
@@ -642,7 +441,7 @@
    bool preserve_metadata;
  
    if (x->move_mode && rename_succeeded)
-@@ -928,11 +932,9 @@
+@@ -928,11 +933,9 @@
        return false;
      }
  
@@ -655,7 +454,7 @@
      {
        error (0, 0, _("omitting directory %s"), quote (src_name));
        return false;
-@@ -1001,7 +1003,7 @@
+@@ -1001,7 +1004,7 @@
  
  	  if (!S_ISDIR (dst_sb.st_mode))
  	    {
@@ -664,7 +463,7 @@
  		{
  		  error (0, 0,
  		     _("cannot overwrite non-directory %s with directory %s"),
-@@ -1027,7 +1029,7 @@
+@@ -1027,7 +1030,7 @@
  		}
  	    }
  
@@ -673,7 +472,7 @@
  	    {
  	      if (S_ISDIR (dst_sb.st_mode))
  		{
-@@ -1067,7 +1069,7 @@
+@@ -1067,7 +1070,7 @@
  	     This may be due to an interactive `negative' reply to the
  	     prompt about the existing file.  It may also be due to the
  	     use of the --reply=no option.  */
@@ -682,7 +481,7 @@
  	    {
  	      /* cp and mv treat -i and -f differently.  */
  	      if (x->move_mode)
-@@ -1181,7 +1183,7 @@
+@@ -1175,7 +1178,7 @@
    /* If the source is a directory, we don't always create the destination
       directory.  So --verbose should not announce anything until we're
       sure we'll create a directory. */
@@ -691,7 +490,7 @@
      {
        printf ("%s -> %s", quote_n (0, src_name), quote_n (1, dst_name));
        if (backup_succeeded)
-@@ -1229,7 +1231,7 @@
+@@ -1223,7 +1226,7 @@
  		|| (command_line_arg
  		    && x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
  		|| x->dereference == DEREF_ALWAYS))
@@ -700,7 +499,7 @@
      {
        earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev);
      }
-@@ -1242,7 +1244,7 @@
+@@ -1236,7 +1239,7 @@
        /* Avoid damaging the destination file system by refusing to preserve
  	 hard-linked directories (which are found at least in Netapp snapshot
  	 directories).  */
@@ -709,7 +508,7 @@
  	{
  	  /* If src_name and earlier_file refer to the same directory entry,
  	     then warn about copying a directory into itself.  */
-@@ -1292,7 +1294,7 @@
+@@ -1295,7 +1298,7 @@
      {
        if (rename (src_name, dst_name) == 0)
  	{
@@ -718,7 +517,7 @@
  	    printf ("%s -> %s\n", quote_n (0, src_name), quote_n (1, dst_name));
  	  if (rename_succeeded)
  	    *rename_succeeded = true;
-@@ -1405,7 +1407,7 @@
+@@ -1408,7 +1411,7 @@
       In such cases, set this variable to zero.  */
    preserve_metadata = true;
  
@@ -727,7 +526,7 @@
      {
        struct dir_list *dir;
  
-@@ -1430,16 +1432,38 @@
+@@ -1433,16 +1436,38 @@
  
        if (new_dst || !S_ISDIR (dst_sb.st_mode))
  	{
@@ -770,7 +569,7 @@
  	  /* Insert the created directory's inode and device
               numbers into the search structure, so that we can
               avoid copying it again.  */
-@@ -1515,23 +1539,24 @@
+@@ -1518,23 +1543,24 @@
  	  goto un_backup;
  	}
      }
@@ -800,7 +599,7 @@
  	{
  	  error (0, errno, _("cannot create fifo %s"), quote (dst_name));
  	  goto un_backup;
-@@ -1539,10 +1564,10 @@
+@@ -1542,10 +1568,10 @@
      }
    else
  #endif
@@ -814,7 +613,7 @@
  	{
  	  error (0, errno, _("cannot create special file %s"),
  		 quote (dst_name));
-@@ -1551,7 +1576,7 @@
+@@ -1554,7 +1580,7 @@
      }
    else
  #ifdef S_ISLNK
@@ -823,7 +622,7 @@
      {
        char *src_link_val = xreadlink (src_name, src_sb.st_size);
        if (src_link_val == NULL)
-@@ -1654,6 +1679,25 @@
+@@ -1657,6 +1683,25 @@
    if (!(copied_as_regular && HAVE_FCHOWN) && x->preserve_ownership
        && (new_dst || !SAME_OWNER_AND_GROUP (src_sb, dst_sb)))
      {
@@ -849,7 +648,7 @@
        if (chown (dst_name, src_sb.st_uid, src_sb.st_gid) == 0)
  	chown_succeeded = true;
        else if (! chown_failure_ok (x))
-@@ -1682,21 +1726,23 @@
+@@ -1685,21 +1730,23 @@
    }
  #endif
  
@@ -872,169 +671,389 @@
 +      if (copy_acl (src_name, dst_name, src_mode) && x->require_preserve)
 +	return false;
 +    }
-+  else if (x->set_mode)
++  else if (x->set_mode)
++    {
++      if (set_acl (dst_name, x->mode) && x->require_preserve)
++	return false;
++    }
++  else if (dst_mode_valid)
++    {
++      if (chmod (dst_name, dst_mode))
++        {
++	  error (0, errno, _("preserving permissions for %s"),
++	         quote (dst_name));
++	  if (x->require_preserve)
+ 	    return false;
+ 	}
+     }
+--- coreutils-5.97/src/copy.h.acl	2005-07-03 10:31:19.000000000 +0100
++++ coreutils-5.97/src/copy.h	2006-08-24 14:07:42.000000000 +0100
+@@ -165,9 +165,6 @@
+      Create destination directories as usual. */
+   bool symbolic_link;
+ 
+-  /* The bits to preserve in created files' modes. */
+-  mode_t umask_kill;
+-
+   /* If true, do not copy a nondirectory that has an existing destination
+      with the same or newer modification time. */
+   bool update;
+--- /dev/null	2006-08-24 09:50:30.595836250 +0100
++++ coreutils-5.97/m4/posix_acl.m4	2006-08-24 14:07:42.000000000 +0100
+@@ -0,0 +1,28 @@
++#serial 1
++
++dnl Written by Andreas Gruenbacher <a.gruenbacher at computer.org>.
++
++dnl Posix 1003.1e draft standard 17 (abandoned) and similar
++dnl access control list support
++AC_DEFUN([ag_POSIX_ACL],
++[
++  AC_CHECK_HEADERS(sys/acl.h)
++  AC_CHECK_LIB(acl, main, cu_cv_lacl=yes, cu_cv_lacl=no)
++  if test "$cu_cv_lacl" = yes; then
++    LIBACL=-lacl
++  else
++    LIBACL=
++  fi
++  AC_SUBST(LIBACL)
++  OLDLIBS="$LIBS"
++  LIBS="$LIBS $LIBACL"
++  AC_CHECK_FUNCS(acl_get_file acl_set_file acl_free acl_to_text \
++                 acl_from_text acl_delete_def_file)
++  # Linux specific extensions:
++  AC_CHECK_FUNCS(acl_entries acl_extended_file)
++  LIBS="$OLDLIBS"
++
++  if test $ac_cv_header_sys_acl_h = yes; then
++    AC_DEFINE(USE_ACL, 1, [Define if you want access control list support.])
++  fi
++])
+--- coreutils-5.97/configure.ac.acl	2006-08-24 14:07:42.000000000 +0100
++++ coreutils-5.97/configure.ac	2006-08-24 14:07:42.000000000 +0100
+@@ -251,6 +251,8 @@
+ AM_GNU_GETTEXT([external], [need-ngettext])
+ AM_GNU_GETTEXT_VERSION(0.13.1)
+ 
++ag_POSIX_ACL
++
+ AC_CONFIG_FILES(
+   Makefile
+   doc/Makefile
+--- coreutils-5.97/config.hin.acl	2006-06-10 10:03:51.000000000 +0100
++++ coreutils-5.97/config.hin	2006-08-24 14:07:42.000000000 +0100
+@@ -101,6 +101,30 @@
+ /* Define to 1 if you have the `acl' function. */
+ #undef HAVE_ACL
+ 
++/* Define to 1 if you have the `acl_delete_def_file' function. */
++#undef HAVE_ACL_DELETE_DEF_FILE
++
++/* Define to 1 if you have the `acl_entries' function. */
++#undef HAVE_ACL_ENTRIES
++
++/* Define to 1 if you have the `acl_extended_file' function. */
++#undef HAVE_ACL_EXTENDED_FILE
++
++/* Define to 1 if you have the `acl_free' function. */
++#undef HAVE_ACL_FREE
++
++/* Define to 1 if you have the `acl_from_text' function. */
++#undef HAVE_ACL_FROM_TEXT
++
++/* Define to 1 if you have the `acl_get_file' function. */
++#undef HAVE_ACL_GET_FILE
++
++/* Define to 1 if you have the `acl_set_file' function. */
++#undef HAVE_ACL_SET_FILE
++
++/* Define to 1 if you have the `acl_to_text' function. */
++#undef HAVE_ACL_TO_TEXT
++
+ /* Define to 1 if you have the `alarm' function. */
+ #undef HAVE_ALARM
+ 
+@@ -589,6 +613,9 @@
+ /* Define to 1 if you have the `lchown' function. */
+ #undef HAVE_LCHOWN
+ 
++/* Define to 1 if you have the `acl' library (-lacl). */
++#undef HAVE_LIBACL
++
+ /* Define to 1 if you have the `dgc' library (-ldgc). */
+ #undef HAVE_LIBDGC
+ 
+@@ -1507,6 +1534,9 @@
+    safe for multithreaded apps. */
+ #undef USE_UNLOCKED_IO
+ 
++/* Define if you want access control list support. */
++#undef USE_ACL
++
+ /* Version number of package */
+ #undef VERSION
+ 
+--- coreutils-5.97/lib/acl.c.acl	2005-09-22 07:05:39.000000000 +0100
++++ coreutils-5.97/lib/acl.c	2006-08-24 14:14:10.000000000 +0100
+@@ -22,18 +22,33 @@
+ # include <config.h>
+ #endif
+ 
++#if ENABLE_NLS
++# include <libintl.h>
++# define _(Text) gettext (Text)
++#else
++# define _(Text) Text
++#endif
++
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #ifndef S_ISLNK
+ # define S_ISLNK(Mode) 0
+ #endif
+ 
++#include <stdlib.h>
++#include <acl/libacl.h>
++
+ #include "acl.h"
++#include "error.h"
++#include "quote.h"
+ 
+ #include <errno.h>
+ #ifndef ENOSYS
+ # define ENOSYS (-1)
+ #endif
++#ifndef ENOTSUP
++# define ENOTSUP (-1)
++#endif
+ 
+ #ifndef MIN_ACL_ENTRIES
+ # define MIN_ACL_ENTRIES 4
+@@ -45,19 +60,201 @@
+ int
+ file_has_acl (char const *file, struct stat const *filestat)
+ {
+-  /* FIXME: This implementation should work on recent-enough versions
+-     of HP-UX, Solaris, and Unixware, but it simply returns 0 with
+-     POSIX 1003.1e (draft 17 -- abandoned), AIX, GNU/Linux, Irix, and
+-     Tru64.  Please see Samba's source/lib/sysacls.c file for
+-     fix-related ideas.  */
+-
+ #if HAVE_ACL && defined GETACLCNT
++  /* This implementation should work on recent-enough versions of HP-UX,
++     Solaris, and Unixware.  */
++
+   if (! S_ISLNK (filestat->st_mode))
+     {
+       int n = acl (file, GETACLCNT, 0, NULL);
+       return n < 0 ? (errno == ENOSYS ? 0 : -1) : (MIN_ACL_ENTRIES < n);
+     }
++#elif HAVE_ACL_EXTENDED_FILE
++
++  /* Linux specific.  */
++
++  if (! S_ISLNK (filestat->st_mode))
++    {
++      int ret = acl_extended_file (file);
++      if (ret < 0)
++	return (errno == ENOSYS || errno == ENOTSUP) ? 0 : -1;
++      return ret;
++    }
++#else
++  /* FIXME: Add support for AIX, Irix, and Tru64, FreeBSD, etc.
++     Please see Samba's source/lib/sysacls.c file for fix-related ideas.  */
+ #endif
+ 
+   return 0;
+ }
++
++/* Copy the permissions from SRC_PATH to DST_PATH, including access control
++   lists on systems where this is supported. MODE is the file mode for
++   DST_PATH, including the file type.
++   Also sets special bits in MODE on DST_PATH.  */
++
++int
++copy_acl (char const *src_path, char const *dst_path, mode_t mode)
++{
++#if HAVE_ACL_GET_FILE && HAVE_ACL_SET_FILE && HAVE_ACL_FREE && \
++    HAVE_ACL_ENTRIES
++
++  /* Linux specific. Will work on all POSIX 1003.1e draft 17 (abandoned)
++     compliant systems if the acl_entries() function is implemented.  */
++
++  acl_t acl = acl_get_file (src_path, ACL_TYPE_ACCESS);
++  if (acl == NULL)
++    {
++      if (errno == ENOSYS || errno == ENOTSUP)
++	return set_acl (dst_path, mode);
++      else
++        {
++	  error (0, errno, "%s", quote (src_path));
++	  return -1;
++	}
++    }
++
++  if (acl_set_file (dst_path, ACL_TYPE_ACCESS, acl))
++    {
++      int saved_errno = errno;
++
++      if (errno == ENOSYS || errno == ENOTSUP)
++        {
++	  int n = acl_entries (acl);
++
++	  acl_free (acl);
++	  if (n == 3)
++	    {
++	      if (chmod (dst_path, mode))
++		saved_errno = errno;
++	      else
++		return 0;
++	    }
++	  else
++	    chmod (dst_path, mode);
++	}
++      else
++	{
++	  acl_free (acl);
++	  chmod (dst_path, mode);
++	}
++      error (0, saved_errno, _("preserving permissions for %s"),
++	     quote (dst_path));
++      return -1;
++    }
++  acl_free (acl);
++
++  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
 +    {
-+      if (set_acl (dst_name, x->mode) && x->require_preserve)
-+	return false;
++      /* We did not call chmod so far, so the special bits have not yet
++         been set.  */
++
++      if (chmod (dst_path, mode))
++	{
++	  error (0, errno, _("preserving permissions for %s"),
++	  	 quote (dst_path));
++	  return -1;
++	}
 +    }
-+  else if (dst_mode_valid)
++
++  if (S_ISDIR (mode))
 +    {
-+      if (chmod (dst_name, dst_mode))
-+        {
++      acl = acl_get_file (src_path, ACL_TYPE_DEFAULT);
++      if (acl == NULL)
++	{
++	  error (0, errno, "%s", quote (src_path));
++	  return -1;
++	}
++
++      if (acl_set_file (dst_path, ACL_TYPE_DEFAULT, acl))
++	{
 +	  error (0, errno, _("preserving permissions for %s"),
-+	         quote (dst_name));
-+	  if (x->require_preserve)
- 	    return false;
- 	}
-     }
---- coreutils-5.92/src/Makefile.am.acl	2005-09-29 11:28:37.000000000 +0100
-+++ coreutils-5.92/src/Makefile.am	2005-10-27 11:44:29.000000000 +0100
-@@ -50,9 +50,9 @@
- LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
- 
- # for eaccess in lib/euidaccess.c.
--cp_LDADD = $(LDADD) $(LIB_EACCESS)
--ginstall_LDADD = $(LDADD) $(LIB_EACCESS)
--mv_LDADD = $(LDADD) $(LIB_EACCESS)
-+cp_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@
-+ginstall_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@
-+mv_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@
- pathchk_LDADD = $(LDADD) $(LIB_EACCESS)
- rm_LDADD = $(LDADD) $(LIB_EACCESS)
- test_LDADD = $(LDADD) $(LIB_EACCESS)
-@@ -61,11 +61,11 @@
- 
- # for clock_gettime and fdatasync
- dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
--dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
--ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
-+dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@
-+ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@
- pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
- shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
--vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
-+vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@
- 
- ## If necessary, add -lm to resolve use of pow in lib/strtod.c.
- sort_LDADD = $(LDADD) $(POW_LIB)
---- coreutils-5.92/configure.ac.acl	2005-10-22 19:12:36.000000000 +0100
-+++ coreutils-5.92/configure.ac	2005-10-27 11:44:30.000000000 +0100
-@@ -251,6 +251,8 @@
- AM_GNU_GETTEXT([external], [need-ngettext])
- AM_GNU_GETTEXT_VERSION(0.13.1)
- 
-+ag_POSIX_ACL
++		 quote (dst_path));
++	  acl_free(acl);
++	  return -1;
++	}
++      else
++        acl_free(acl);
++    }
++  return 0;
++#else
++  int ret = chmod (dst_path, mode);
++  if (ret)
++    error (0, errno, _("preserving permissions for %s"), quote (dst_path));
++  return ret;
++#endif
++}
 +
- AC_CONFIG_FILES(
-   Makefile
-   doc/Makefile
---- coreutils-5.92/config.hin.acl	2005-10-22 19:14:08.000000000 +0100
-+++ coreutils-5.92/config.hin	2005-10-27 11:44:30.000000000 +0100
-@@ -101,6 +101,30 @@
- /* Define to 1 if you have the `acl' function. */
- #undef HAVE_ACL
- 
-+/* Define to 1 if you have the `acl_delete_def_file' function. */
-+#undef HAVE_ACL_DELETE_DEF_FILE
++/* Set the permissions of PATH, overwriting access control lists, on systems
++   where this is supported. MODE is the file mode for PATH, including the
++   file type. Also sets special bits in MODE on PATH.  */
 +
-+/* Define to 1 if you have the `acl_entries' function. */
-+#undef HAVE_ACL_ENTRIES
++int
++set_acl (char const *path, mode_t mode)
++{
++#if HAVE_ACL_FROM_TEXT && HAVE_ACL_SET_FILE && HAVE_ACL_FREE && \
++       HAVE_ACL_DELETE_DEF_FILE
++  char acl_text[] = "u::---,g::---,o::---";
++  acl_t acl;
 +
-+/* Define to 1 if you have the `acl_extended_file' function. */
-+#undef HAVE_ACL_EXTENDED_FILE
++  if (mode & S_IRUSR) acl_text[ 3] = 'r';
++  if (mode & S_IWUSR) acl_text[ 4] = 'w';
++  if (mode & S_IXUSR) acl_text[ 5] = 'x';
++  if (mode & S_IRGRP) acl_text[10] = 'r';
++  if (mode & S_IWGRP) acl_text[11] = 'w';
++  if (mode & S_IXGRP) acl_text[12] = 'x';
++  if (mode & S_IROTH) acl_text[17] = 'r';
++  if (mode & S_IWOTH) acl_text[18] = 'w';
++  if (mode & S_IXOTH) acl_text[19] = 'x';
 +
-+/* Define to 1 if you have the `acl_free' function. */
-+#undef HAVE_ACL_FREE
++  acl = acl_from_text(acl_text);
++  if (!acl)
++    {
++      error (0, errno, "%s", quote (path));
++      return -1;
++    }
 +
-+/* Define to 1 if you have the `acl_from_text' function. */
-+#undef HAVE_ACL_FROM_TEXT
++  if (acl_set_file(path, ACL_TYPE_ACCESS, acl))
++    {
++      int saved_errno = errno;
++      acl_free (acl);
 +
-+/* Define to 1 if you have the `acl_get_file' function. */
-+#undef HAVE_ACL_GET_FILE
++      if (errno == ENOTSUP || errno == ENOSYS)
++	{
++	  if (chmod (path, mode))
++	    saved_errno = errno;
++	  else
++	    return 0;
++	}
++      error (0, saved_errno, _("setting permissions for %s"), quote (path));
++      return -1;
++    }
++  acl_free (acl);
 +
-+/* Define to 1 if you have the `acl_set_file' function. */
-+#undef HAVE_ACL_SET_FILE
++  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
++    {
++      /* We did not call chmod so far, so the special bits have not yet
++         been set.  */
 +
-+/* Define to 1 if you have the `acl_to_text' function. */
-+#undef HAVE_ACL_TO_TEXT
++      if (chmod (path, mode))
++	{
++	  error (0, errno, _("preserving permissions for %s"),
++	  	 quote (path));
++	  return -1;
++	}
++    }
 +
- /* Define to 1 if you have the `alarm' function. */
- #undef HAVE_ALARM
- 
-@@ -589,6 +613,9 @@
- /* Define to 1 if you have the `lchown' function. */
- #undef HAVE_LCHOWN
- 
-+/* Define to 1 if you have the `acl' library (-lacl). */
-+#undef HAVE_LIBACL
++  if (S_ISDIR (mode) && acl_delete_def_file (path))
++    {
++      error (0, errno, _("setting permissions for %s"), quote (path));
++      return -1;
++    }
++  return 0;
++#else
++  int ret = chmod (path, mode);
++  if (ret)
++    error (0, errno, _("setting permissions for %s"), quote (path));
++  return ret;
++#endif
++}
 +
- /* Define to 1 if you have the `dgc' library (-ldgc). */
- #undef HAVE_LIBDGC
- 
-@@ -1496,6 +1523,9 @@
-    safe for multithreaded apps. */
- #undef USE_UNLOCKED_IO
+--- coreutils-5.97/lib/acl.h.acl	2005-05-14 08:58:06.000000000 +0100
++++ coreutils-5.97/lib/acl.h	2006-08-24 14:14:13.000000000 +0100
+@@ -18,11 +18,16 @@
  
-+/* Define if you want access control list support. */
-+#undef USE_ACL
-+
- /* Version number of package */
- #undef VERSION
+    Written by Paul Eggert.  */
  
---- coreutils-5.92/NEWS.acl	2005-10-22 19:11:56.000000000 +0100
-+++ coreutils-5.92/NEWS	2005-10-27 11:44:30.000000000 +0100
-@@ -1,3 +1,6 @@
-+[4.5.3acl]
-+* ACL framework and Linux ACL support.
-+* `cp -p' and `mv' now preserve ACLs
- GNU coreutils NEWS                                    -*- outline -*-
+-#if HAVE_SYS_ACL_H && HAVE_ACL
++#if HAVE_SYS_ACL_H
+ # include <sys/acl.h>
+ #endif
++#if HAVE_SYS_TYPES_H
++# include <sys/types.h>
++#endif
+ #if ! defined GETACLCNT && defined ACL_CNT
+ # define GETACLCNT ACL_CNT
+ #endif
  
- * Major changes in release 5.92 (2005-10-22) [stable]
---- coreutils-5.92/ChangeLog.acl	2005-10-22 19:12:51.000000000 +0100
-+++ coreutils-5.92/ChangeLog	2005-10-27 11:44:30.000000000 +0100
-@@ -0,0 +1,45 @@
-+2002-07-01  Bernhard Rosenkraenzer <bero at bero.org>
-+	* Port the following patch to 4.1.9:
-+
-+2002-04-10  Andreas Gruenbacher  <a.gruenbacher at computer.org>
-+
-+	* Version 4.1.8acl.
-+
-+	* src/copy.c (get_dest_mode): Remove.
-+	* src/copy.c (copy_internal): Merge src_mode and src_type.
-+	* src/copy.c (copy_internal): Add dst_mode and dst_mode_valid,
-+	which are set when the destination file mode is changed temporarily.
-+	* src/copy.c (copy_internal): Check effective permissions after
-+	mkdir(). Add S_IRWXU only after saving the default permissions, so
-+	the default permissions can be restored. This is needed with
-+	default ACLs on some systems.
-+	* src/copy.c (copy_internal): Use dst_mode and dst_mode_valid for
-+	ran_chown. Save the current permissions if needed before chown().
-+	* src/copy.c (copy_internal): Clean up the final permission setting
-+	code and prepare for copy/set ACL support.
-+	* src/cp.c, src/install.c, src/mv.c, src/copy.h: Remove umask_kill,
-+	and never change the startup umask. The functions creating files need
-+	the original umask to be active to create the correct permissions
-+	inside directories with default ACLs; umask_kill no longer works.
-+	* src/cp.c (struct dir_attr, re_protect, make_path_private): Remove
-+	is_new_dir and add mode and mode_valid instead.
-+	* src/cp.c (make_path_private): Remove the mode parameter. Pass in
-+	cp_options, instead of cp_options->xstat only. Stat the source dir,
-+	and create the destination dir with the source dir's mode as create
-+	mode (see analog change to src/copy.c (copy_internal)). Check if the
-+	effective permissions include S_IRWXU. Remember the original code only
-+	if needed later.
-+	* lib/acl.h, lib/acl.c (copy_acl, set_acl): Add these functions,
-+	initially with the bare non-ACL functionality.
-+	* src/copy.c (copy_internal): Use copy_acl and set_acl instead of chmod.
-+	* src/cp.c (re_protect): Use copy_acl instead of chmod.
-+	* m4/posix_acl.m4, configure.ac (ag_POSIX_ACL): Add POSIX ACL tests.
-+	* lib/acl.h: Remove HAVE_ACL symbol; <sys/acl.h> is needed for POSIX
-+	ACLs even if there is no acl system call.
-+	* lib/acl.c (ENOTSUP): Provide default value.
-+	* lib/acl.c (file_has_acl, copy_acl, set_acl): Add Linux ACL
-+	implementations.
-+	* src/ls.c: change `HAVE_ACL' to `HAVE_ACL || USE_ACL' for POSIX ACLs:
-+	there is no acl system call for POSIX ACLs.
-+	* tests/misc: Add my own small test suite so it doesn't get lost.
-+
+ int file_has_acl (char const *, struct stat const *);
++int copy_acl (char const *, char const *, mode_t);
++int set_acl (char const *, mode_t);


Index: coreutils.spec
===================================================================
RCS file: /cvs/dist/rpms/coreutils/devel/coreutils.spec,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -r1.134 -r1.135
--- coreutils.spec	23 Aug 2006 09:56:42 -0000	1.134
+++ coreutils.spec	24 Aug 2006 15:53:08 -0000	1.135
@@ -280,6 +280,9 @@
 /sbin/runuser
 
 %changelog
+* Thu Aug 24 2006 Tim Waugh <twaugh at redhat.com>
+- Fixed warnings in acl patch (bug #203166).
+
 * Wed Aug 23 2006 Tim Waugh <twaugh at redhat.com> 5.97-8
 - Don't chdir until after PAM bits in su (bug #197659).
 




More information about the fedora-cvs-commits mailing list