Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 23464 Details for
Bug 37682
coreutils-5.0.91-r4 fails on acl patch
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
And another new patch
003_all_coreutils-xattr.patch (text/plain), 11.74 KB, created by
Paul Giordano
on 2004-01-09 06:41:47 UTC
(
hide
)
Description:
And another new patch
Filename:
MIME Type:
Creator:
Paul Giordano
Created:
2004-01-09 06:41:47 UTC
Size:
11.74 KB
patch
obsolete
>diff -urN coreutils-5.0.91.old/configure.ac coreutils-5.0.91/configure.ac >--- coreutils-5.0.91.old/configure.ac 2003-12-29 19:15:19.000000000 -0800 >+++ coreutils-5.0.91/configure.ac 2003-12-29 19:13:20.000000000 -0800 >@@ -235,6 +235,9 @@ > # For src/kill.c. > AC_CHECK_DECLS([strsignal, strtoimax, sys_siglist, _sys_siglist, __sys_siglist]) > >+# Extended attribute copying. >+AC_FUNC_XATTR >+ > jm_LIB_CHECK > > AM_GNU_GETTEXT([external], [need-ngettext]) >diff -urN coreutils-5.0.91.old/doc/coreutils.texi coreutils-5.0.91/doc/coreutils.texi >--- coreutils-5.0.91.old/doc/coreutils.texi 2003-12-29 19:15:19.000000000 -0800 >+++ coreutils-5.0.91/doc/coreutils.texi 2003-12-29 19:13:20.000000000 -0800 >@@ -5937,6 +5937,19 @@ > directory in a different order). > Equivalent to @option{-dpPR}. > >+@itemx @w{@kbd{--attributes}=@var{regex}} >+@opindex --attributes >+Preserve extended attributes whose names match the specified regular >+expression. The default behavior or @command{cp} if no >+@option{--attributes} option is given is to preserve all extended >+attributes except file permissions. If @var{regex} is ``@samp{-}'', no >+extended attributes are preserved. >+ >+This option does not affect the preservation of discretionary file >+permissions (i.e., file mode permission bits and access control lists). >+To control the preservation of file permissions, the @option{-p} or >+@option{--preserve=mode} options are used. >+ > @item -b > @itemx @w{@kbd{--backup}[=@var{method}]} > @opindex -b >@@ -6040,7 +6053,7 @@ > > @table @samp > @itemx mode >-Preserve the permission attributes. >+Preserve the permission attributes, including access control lists. > @itemx ownership > Preserve the owner and group. On most modern systems, > only the super-user may change the owner of a file, and regular users >@@ -6056,7 +6069,6 @@ > @itemx all > Preserve all file attributes. > Equivalent to specifying all of the above. >-@c Mention ACLs here. > @end table > > Using @option{--preserve} with no @var{attribute_list} is equivalent >diff -urN coreutils-5.0.91.old/m4/xattr.m4 coreutils-5.0.91/m4/xattr.m4 >--- coreutils-5.0.91.old/m4/xattr.m4 1969-12-31 16:00:00.000000000 -0800 >+++ coreutils-5.0.91/m4/xattr.m4 2003-12-29 19:13:20.000000000 -0800 >@@ -0,0 +1,38 @@ >+# xattr.m4 - check for Extended Attributes (Linux) >+ >+# Copyright (C) 2003 Free Software Foundation, Inc. >+ >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 2, or (at your option) >+# any later version. >+ >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+ >+# You should have received a copy of the GNU General Public License >+# along with this program; if not, write to the Free Software Foundation, >+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ >+ >+# Written by Andreas Gruenbacher. >+ >+AC_DEFUN([AC_FUNC_XATTR], >+[ >+ AC_CHECK_HEADERS(attr/error_context.h attr/libattr.h) >+ if test "$ac_cv_header_attr_libattr_h" = yes \ >+ && test "$ac_cv_header_attr_error_context_h" = yes; then >+ use_xattr=1 >+ else >+ use_xattr=0 >+ fi >+ AC_DEFINE_UNQUOTED(USE_XATTR, $use_xattr, >+ [Define if you want extended attribute support.]) >+ xattr_saved_LIBS=$LIBS >+ AC_SEARCH_LIBS(attr_copy_file, attr, >+ [LIB_XATTR=$ac_cv_search_attr_copy_file]) >+ AC_SUBST(LIB_XATTR) >+ AC_CHECK_FUNCS(attr_copy_file) >+ LIBS=$xattr_saved_LIBS >+]) >diff -urN coreutils-5.0.91.old/man/cp.1 coreutils-5.0.91/man/cp.1 >--- coreutils-5.0.91.old/man/cp.1 2003-09-02 13:02:28.000000000 -0700 >+++ coreutils-5.0.91/man/cp.1 2003-12-29 19:13:20.000000000 -0800 >@@ -60,6 +60,14 @@ > mode,ownership,timestamps), if possible > additional attributes: links, all > .TP >+\fB\-\-attributes\fR=\fIregex\fR >+preserve extended attributes whose name >+matches the specified regular expression >+(defaults to preserving all extended >+.IP >+attributes except file permissions; >+regex=`-' preserves no extended attributes). >+.TP > \fB\-\-no\-preserve\fR=\fIATTR_LIST\fR > don't preserve the specified attributes > .TP >diff -urN coreutils-5.0.91.old/src/Makefile.am coreutils-5.0.91/src/Makefile.am >--- coreutils-5.0.91.old/src/Makefile.am 2003-12-29 19:15:20.000000000 -0800 >+++ coreutils-5.0.91/src/Makefile.am 2003-12-29 19:18:34.000000000 -0800 >@@ -36,9 +36,9 @@ > ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) -lcurses @LIB_ACL@ > shred_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) > vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) -lcurses @LIB_ACL@ >-cp_LDADD = $(LDADD) @LIB_ACL@ >-mv_LDADD = $(LDADD) @LIB_ACL@ >-ginstall_LDADD = $(LDADD) @LIB_ACL@ >+cp_LDADD = $(LDADD) @LIB_ACL@ @LIB_XATTR@ >+mv_LDADD = $(LDADD) @LIB_ACL@ @LIB_XATTR@ >+ginstall_LDADD = $(LDADD) @LIB_ACL@ @LIB_XATTR@ > > ## If necessary, add -lm to resolve use of pow in lib/strtod.c. > sort_LDADD = $(LDADD) $(POW_LIB) >diff -urN coreutils-5.0.91.old/src/copy.c coreutils-5.0.91/src/copy.c >--- coreutils-5.0.91.old/src/copy.c 2003-12-29 19:15:20.000000000 -0800 >+++ coreutils-5.0.91/src/copy.c 2003-12-29 19:13:20.000000000 -0800 >@@ -44,6 +44,13 @@ > #include "xreadlink.h" > #include "acl.h" > >+#ifdef USE_XATTR >+# include "regex.h" >+# include <stdarg.h> >+# include <attr/error_context.h> >+# include <attr/libattr.h> >+#endif >+ > #define DO_CHOWN(Chown, File, New_uid, New_gid) \ > (Chown (File, New_uid, New_gid) \ > /* If non-root uses -p, it's ok if we can't preserve ownership. \ >@@ -114,6 +121,104 @@ > return 0; > } > >+#if USE_XATTR >+static void >+copy_attr_error (struct error_context *ctx, const char *fmt, ...) >+{ >+ int err = errno; >+ va_list ap; >+ int len; >+ char *buffer; >+ >+ /* There is no error function that takes a va_list argument, >+ so we print the message in a buffer first. */ >+ >+ va_start (ap, fmt); >+ len = vsnprintf (NULL, 0, fmt, ap); >+ if (len > 0) >+ { >+ buffer = xmalloc (len + 1); >+ vsnprintf (buffer, len + 1, fmt, ap); >+ error (0, err, "%s", buffer); >+ free (buffer); >+ } >+ va_end (ap); >+} >+ >+static const char * >+copy_attr_quote (struct error_context *ctx, const char *str) >+{ >+ return xstrdup (quote (str)); >+} >+ >+static void >+copy_attr_free (struct error_context *ctx, const char *str) >+{ >+ free ((void *) str); >+} >+ >+struct copy_attr_context >+ { >+ struct error_context ctx; >+ const char *re_pattern; >+ struct re_pattern_buffer re_compiled; >+ } copy_attr_ctx = { >+ { copy_attr_error, >+ copy_attr_quote, >+ copy_attr_free } >+ }; >+ >+static int >+copy_attr_filter (const char *name, struct error_context *ctx) >+{ >+ struct copy_attr_context *copy_ctx = (struct copy_attr_context *) ctx; >+ >+ return (attr_copy_check_permissions (name, ctx) >+ && copy_ctx->re_pattern != NULL >+ && re_search (©_ctx->re_compiled, name, strlen (name), 0, >+ strlen (name), NULL) >= 0); >+} >+#endif /* USE_XATTR */ >+ >+static int >+copy_extended_attributes (const char *src_path, const char *dst_path, >+ const struct cp_options *x) >+{ >+#if USE_XATTR >+ if (x->attr_pattern == NULL) >+ return 0; >+ >+ if (copy_attr_ctx.re_pattern != x->attr_pattern) >+ { >+ struct re_pattern_buffer *c = ©_attr_ctx.re_compiled; >+ size_t len = strlen (x->attr_pattern); >+ const char *err; >+ >+ free (c->fastmap); >+ free (c->buffer); >+ >+ copy_attr_ctx.re_pattern = x->attr_pattern; >+ c->allocated = 2 * len; >+ c->buffer = xmalloc (c->allocated); >+ c->fastmap = xmalloc (256); >+ c->translate = 0; >+ err = re_compile_pattern (x->attr_pattern, len, c); >+ if (err) >+ { >+ free (c->fastmap); >+ free (c->buffer); >+ copy_attr_ctx.re_pattern = NULL; >+ error (EXIT_FAILURE, 0, _("%s: invalid regular expression: %s"), >+ x->attr_pattern, err); >+ } >+ } >+ return attr_copy_file (src_path, dst_path, >+ copy_attr_filter, ©_attr_ctx.ctx); >+#else /* USE_XATTR */ >+ return 0; >+#endif /* USE_XATTR */ >+} >+ > /* Read the contents of the directory SRC_PATH_IN, and recursively > copy the contents to DST_PATH_IN. NEW_DST is nonzero if > DST_PATH_IN is a directory that was created previously in the >@@ -1575,6 +1680,9 @@ > } > #endif > >+ if (copy_extended_attributes (src_path, dst_path, x)) >+ delayed_fail = 1; >+ > if (x->preserve_mode || x->move_mode) > { > if (copy_acl (src_path, dst_path, src_mode) && x->require_preserve) >diff -urN coreutils-5.0.91.old/src/copy.h coreutils-5.0.91/src/copy.h >--- coreutils-5.0.91.old/src/copy.h 2003-12-29 19:15:20.000000000 -0800 >+++ coreutils-5.0.91/src/copy.h 2003-12-29 19:13:20.000000000 -0800 >@@ -106,6 +106,10 @@ > int preserve_mode; > int preserve_timestamps; > >+ /* Regular expression pattern that specifies which extended attributes to >+ copy. NULL stands for copying no extended attributes. */ >+ const char *attr_pattern; >+ > /* Enabled for mv, and for cp by the --preserve=links option. > If nonzero, attempt to preserve in the destination files any > logical hard links between the source files. If used with cp's >diff -urN coreutils-5.0.91.old/src/cp.c coreutils-5.0.91/src/cp.c >--- coreutils-5.0.91.old/src/cp.c 2003-12-29 19:15:20.000000000 -0800 >+++ coreutils-5.0.91/src/cp.c 2003-12-29 19:13:20.000000000 -0800 >@@ -77,7 +77,8 @@ > SPARSE_OPTION, > STRIP_TRAILING_SLASHES_OPTION, > TARGET_DIRECTORY_OPTION, >- UNLINK_DEST_BEFORE_OPENING >+ UNLINK_DEST_BEFORE_OPENING, >+ PRESERVE_XATTRS_OPTION > }; > > /* Initial number of entries in each hash table entry's table of inodes. */ >@@ -136,6 +137,7 @@ > {"parents", no_argument, NULL, PARENTS_OPTION}, > {"path", no_argument, NULL, PARENTS_OPTION}, /* Deprecated. */ > {"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION}, >+ {"attributes", required_argument, NULL, PRESERVE_XATTRS_OPTION}, > {"recursive", no_argument, NULL, 'R'}, > {"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING}, > {"reply", required_argument, NULL, REPLY_OPTION}, >@@ -224,6 +226,13 @@ > -v, --verbose explain what is being done\n\ > -x, --one-file-system stay on this file system\n\ > "), stdout); >+ fputs(_("\n\ >+ --attributes=regex preserve extended attributes whose name\n\ >+ matches the specified regular expression\n\ >+ (defaults to preserving all extended\n\ >+ attributes except file permissions;\n\ >+ regex=`-' preserves no extended attributes).\n\ >+"), stdout); > fputs (HELP_OPTION_DESCRIPTION, stdout); > fputs (VERSION_OPTION_DESCRIPTION, stdout); > fputs (_("\ >@@ -789,6 +798,8 @@ > x->verbose = 0; > x->dest_info = NULL; > x->src_info = NULL; >+ >+ x->attr_pattern = ""; /* all extended attributes */ > } > > /* Given a string, ARG, containing a comma-separated list of arguments >@@ -984,6 +995,13 @@ > x.require_preserve = 1; > break; > >+ case PRESERVE_XATTRS_OPTION: >+ if (strcmp (optarg, "-") == 0) >+ x.attr_pattern = NULL; >+ else >+ x.attr_pattern = optarg; >+ break; >+ > case PARENTS_OPTION: > flag_path = 1; > break; >diff -urN coreutils-5.0.91.old/src/install.c coreutils-5.0.91/src/install.c >--- coreutils-5.0.91.old/src/install.c 2003-12-29 19:15:20.000000000 -0800 >+++ coreutils-5.0.91/src/install.c 2003-12-29 19:13:20.000000000 -0800 >@@ -247,6 +247,8 @@ > x->xstat = stat; > x->dest_info = NULL; > x->src_info = NULL; >+ >+ x->attr_pattern = NULL; /* no extended attributes */ > } > > int >diff -urN coreutils-5.0.91.old/src/mv.c coreutils-5.0.91/src/mv.c >--- coreutils-5.0.91.old/src/mv.c 2003-12-29 19:15:20.000000000 -0800 >+++ coreutils-5.0.91/src/mv.c 2003-12-29 19:13:20.000000000 -0800 >@@ -138,6 +138,8 @@ > x->xstat = lstat; > x->dest_info = NULL; > x->src_info = NULL; >+ >+ x->attr_pattern = ""; /* all extended attributes */ > } > > /* If PATH is an existing directory, return nonzero, else 0. */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 37682
:
23461
|
23463
| 23464 |
23465