bug#37696: Compile Coreutils without xattr but i installed
On 10/10/19 11:57 AM, Wei MA wrote: I compile the source code. And when i ran tests/cp/capabiliy.sh<http://capabiliy.sh/>, cp preserves attr failed without xattr support . Then i installed xattr. I deleted coreutils and downloaded it again. The problem still exists. I use Ubuntu 18. When i ran cp of Ubuntu, the same commands has no problem. That's a little vague. Can you send us a complete, self-contained test case (e.g., a shell script) illustrating the problem?
bug#37696: Compile Coreutils without xattr but i installed
Hi, I compile the source code. And when i ran tests/cp/capabiliy.sh<http://capabiliy.sh/>, cp preserves attr failed without xattr support . Then i installed xattr. I deleted coreutils and downloaded it again. The problem still exists. I use Ubuntu 18. When i ran cp of Ubuntu, the same commands has no problem. Get Outlook for Android<https://aka.ms/ghei36>
Re: coreutils and xattr
Mike Frysinger [EMAIL PROTECTED] wrote: On Sunday 20 April 2008, Jim Meyering wrote: Mike Frysinger [EMAIL PROTECTED] wrote: On Sunday 20 April 2008, Mike Frysinger wrote: On Sunday 20 April 2008, Jim Meyering wrote: Mike Frysinger [EMAIL PROTECTED] wrote: has work on merging Andreas' patch just stalled ? that and the big nasty i18n patch are about the only thing i carry in Gentoo anymore as everything else has been merged ... I haven't looked at any xattr-related changes for a long time. Do you know if there are other variants of that patch (probably), and if so, how they differ? so we know we're talking about the same thing, i think you're referring to the patch as you cited in an old e-mail and found here: http://www.suse.de/~agruen/coreutils/5.91/ the patch has been updated in opensuse since (i'm attaching the latest one i can find from their coreutils-6.9-43 version). the only thing i have in Gentoo beyond this patch is to add AC_ARG_ENABLE(xattr) support. hmm, you probably want one that applies nicely ;) Thank you. That's a good first step. here is the Gentoo version which applies to 6.11 Hmmm... I applied the patch and tried to build/compile. No go: copy.c: In function 'copy_xattr_filter': copy.c:191: warning: implicit declaration of function 'attr_copy_action' copy.c:192: error: 'ATTR_ACTION_SKIP' undeclared (first use in this function) copy.c:192: error: (Each undeclared identifier is reported only once copy.c:192: error: for each function it appears in.) copy.c:194: error: 'ATTR_ACTION_PERMISSIONS' undeclared (first use in this function) So maybe another patch is required? i researched it and opensuse applies a custom patch to their attr package which creates a new function / enum and coreutils leverages that (which makes for the coreutils code to be much simpler). no idea what Andreas' intentions are here though as i cant seem to find any mention with upstream attr and these changes. Let's see what he has to say... Hi Andreas, We're looking at integrating some of your xattr patches into upstream coreutils, and hit a snag. Do you know when/if upstream attr will be updated to include attr_copy_action and these ATTR_* enum values? Jim ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: coreutils and xattr
Mike Frysinger [EMAIL PROTECTED] wrote: has work on merging Andreas' patch just stalled ? that and the big nasty i18n patch are about the only thing i carry in Gentoo anymore as everything else has been merged ... I haven't looked at any xattr-related changes for a long time. Do you know if there are other variants of that patch (probably), and if so, how they differ? Do they include ChangeLog and NEWS entries, thorough tests, documentation updates, etc.? As for i18n, some students nearly took on the project of implementing a palatable solution recently, but that's been deferred for a few months. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: coreutils and xattr
On Sunday 20 April 2008, Jim Meyering wrote: Mike Frysinger [EMAIL PROTECTED] wrote: has work on merging Andreas' patch just stalled ? that and the big nasty i18n patch are about the only thing i carry in Gentoo anymore as everything else has been merged ... I haven't looked at any xattr-related changes for a long time. Do you know if there are other variants of that patch (probably), and if so, how they differ? so we know we're talking about the same thing, i think you're referring to the patch as you cited in an old e-mail and found here: http://www.suse.de/~agruen/coreutils/5.91/ the patch has been updated in opensuse since (i'm attaching the latest one i can find from their coreutils-6.9-43 version). the only thing i have in Gentoo beyond this patch is to add AC_ARG_ENABLE(xattr) support. Do they include ChangeLog and NEWS entries, thorough tests, documentation updates, etc.? just updates to the .texi file -mike signature.asc Description: This is a digitally signed message part. --- coreutils-6.2.orig/configure.ac +++ coreutils-6.2/configure.ac @@ -246,6 +246,9 @@ AC_CHECK_DECLS([strtoimax, strtoumax]) cu_LIB_CHECK +# Extended attribute copying. +AC_FUNC_XATTR + AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT_VERSION([0.15]) --- /dev/null +++ coreutils-6.2/m4/xattr.m4 @@ -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, + [test $ac_cv_search_attr_copy_file = none required || LIB_XATTR=$ac_cv_search_attr_copy_file]) + AC_SUBST(LIB_XATTR) + AC_CHECK_FUNCS(attr_copy_file) + LIBS=$xattr_saved_LIBS +]) --- coreutils-6.2.orig/src/Makefile.am +++ coreutils-6.2/src/Makefile.am @@ -112,6 +112,10 @@ cp_LDADD += $(LIB_ACL) mv_LDADD += $(LIB_ACL) ginstall_LDADD += $(LIB_ACL) +cp_LDADD += $(LIB_XATTR) +mv_LDADD += $(LIB_XATTR) +ginstall_LDADD += $(LIB_XATTR) + $(PROGRAMS): ../lib/libcoreutils.a SUFFIXES = .sh --- coreutils-6.2.orig/src/copy.c +++ coreutils-6.2/src/copy.c @@ -53,6 +53,12 @@ #include xreadlink.h #include yesno.h +#if USE_XATTR +# include stdarg.h +# include attr/error_context.h +# include attr/libattr.h +#endif + #ifndef HAVE_FCHOWN # define HAVE_FCHOWN false # define fchown(fd, uid, gid) (-1) @@ -118,6 +124,98 @@ is_ancestor (const struct stat *sb, cons return false; } +#if USE_XATTR +static void +copy_xattr_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); + va_end (ap); + if (len 0) +{ + buffer = xmalloc (len + 1); + va_start (ap, fmt); + vsnprintf (buffer, len + 1, fmt, ap); + va_end (ap); + error (0, err, %s, buffer); + free (buffer); +} +} + +static const char * +copy_xattr_quote (struct error_context *ctx, const char *str) +{ + return xstrdup (quote (str)); +} + +static void +copy_xattr_free (struct error_context *ctx, const char *str) +{ + free ((void *) str); +} + +struct copy_xattr_context { + struct error_context ctx; + struct cp_options *x; +}; + +static int +copy_xattr_filter (const char *name, struct error_context *ctx) +{ + struct copy_xattr_context *copy_ctx = (struct copy_xattr_context *) ctx; + int action; + + /* We handle POSIX ACLs separately. */ + if (!strcmp(name, system.posix_acl_access) + || !strcmp(name, system.posix_acl_default)) +return 0; + + action = attr_copy_action(name, ctx); + return (action != ATTR_ACTION_SKIP + (!copy_ctx-x-preserve_mode + || action != ATTR_ACTION_PERMISSIONS)); +} +#endif /* USE_XATTR */ + +static bool +copy_xattrs (const char *src_path, int
Re: coreutils and xattr
On Sunday 20 April 2008, Mike Frysinger wrote: On Sunday 20 April 2008, Jim Meyering wrote: Mike Frysinger [EMAIL PROTECTED] wrote: has work on merging Andreas' patch just stalled ? that and the big nasty i18n patch are about the only thing i carry in Gentoo anymore as everything else has been merged ... I haven't looked at any xattr-related changes for a long time. Do you know if there are other variants of that patch (probably), and if so, how they differ? so we know we're talking about the same thing, i think you're referring to the patch as you cited in an old e-mail and found here: http://www.suse.de/~agruen/coreutils/5.91/ the patch has been updated in opensuse since (i'm attaching the latest one i can find from their coreutils-6.9-43 version). the only thing i have in Gentoo beyond this patch is to add AC_ARG_ENABLE(xattr) support. hmm, you probably want one that applies nicely ;) here is the Gentoo version which applies to 6.11 -mike signature.asc Description: This is a digitally signed message part. --- coreutils-6.11/configure.ac +++ coreutils-6.11/configure.ac @@ -249,6 +249,9 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES]) +# Extended attribute copying. +AC_FUNC_XATTR + AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT_VERSION([0.15]) --- coreutils-6.11/m4/xattr.m4 +++ coreutils-6.11/m4/xattr.m4 @@ -0,0 +1,44 @@ +# 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_ARG_ENABLE(xattr, + [ --disable-xattr turn off support for extended attributes], + use_xattr=$enableval, use_xattr=yes) + + if test $use_xattr = yes; then +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, + [test $ac_cv_search_attr_copy_file = none required || LIB_XATTR=$ac_cv_search_attr_copy_file]) +AC_SUBST(LIB_XATTR) +AC_CHECK_FUNCS(attr_copy_file) +LIBS=$xattr_saved_LIBS + fi +]) --- coreutils-6.11/src/copy.c +++ coreutils-6.11/src/copy.c @@ -53,6 +53,12 @@ #include areadlink.h #include yesno.h +#if USE_XATTR +# include stdarg.h +# include attr/error_context.h +# include attr/libattr.h +#endif + #ifndef HAVE_FCHOWN # define HAVE_FCHOWN false # define fchown(fd, uid, gid) (-1) @@ -118,6 +124,98 @@ is_ancestor (const struct stat *sb, cons return false; } +#if USE_XATTR +static void +copy_xattr_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); + va_end (ap); + if (len 0) +{ + buffer = xmalloc (len + 1); + va_start (ap, fmt); + vsnprintf (buffer, len + 1, fmt, ap); + va_end (ap); + error (0, err, %s, buffer); + free (buffer); +} +} + +static const char * +copy_xattr_quote (struct error_context *ctx, const char *str) +{ + return xstrdup (quote (str)); +} + +static void +copy_xattr_free (struct error_context *ctx, const char *str) +{ + free ((void *) str); +} + +struct copy_xattr_context { + struct error_context ctx; + struct cp_options *x; +}; + +static int +copy_xattr_filter (const char *name, struct error_context *ctx) +{ + struct copy_xattr_context *copy_ctx = (struct copy_xattr_context *) ctx; + int action; + + /* We handle POSIX ACLs separately. */ + if (!strcmp(name, system.posix_acl_access) + || !strcmp(name, system.posix_acl_default)) +return 0; + + action = attr_copy_action(name, ctx); + return (action != ATTR_ACTION_SKIP + (!copy_ctx-x-preserve_mode + || action != ATTR_ACTION_PERMISSIONS)); +} +#endif /* USE_XATTR */ + +static bool +copy_xattrs (const char *src_path, int
Re: coreutils and xattr
Mike Frysinger [EMAIL PROTECTED] wrote: On Sunday 20 April 2008, Mike Frysinger wrote: On Sunday 20 April 2008, Jim Meyering wrote: Mike Frysinger [EMAIL PROTECTED] wrote: has work on merging Andreas' patch just stalled ? that and the big nasty i18n patch are about the only thing i carry in Gentoo anymore as everything else has been merged ... I haven't looked at any xattr-related changes for a long time. Do you know if there are other variants of that patch (probably), and if so, how they differ? so we know we're talking about the same thing, i think you're referring to the patch as you cited in an old e-mail and found here: http://www.suse.de/~agruen/coreutils/5.91/ the patch has been updated in opensuse since (i'm attaching the latest one i can find from their coreutils-6.9-43 version). the only thing i have in Gentoo beyond this patch is to add AC_ARG_ENABLE(xattr) support. hmm, you probably want one that applies nicely ;) Thank you. That's a good first step. here is the Gentoo version which applies to 6.11 Hmmm... I applied the patch and tried to build/compile. No go: copy.c: In function 'copy_xattr_filter': copy.c:191: warning: implicit declaration of function 'attr_copy_action' copy.c:192: error: 'ATTR_ACTION_SKIP' undeclared (first use in this function) copy.c:192: error: (Each undeclared identifier is reported only once copy.c:192: error: for each function it appears in.) copy.c:194: error: 'ATTR_ACTION_PERMISSIONS' undeclared (first use in this function) So maybe another patch is required? Would you like to help? Things that would expedite this: - ChangeLog entries - as many tests as possible, but even just one or two would be a good start. even some simple demonstrations with textual suggestions for what to check for in the way of results or effects. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
coreutils and xattr
has work on merging Andreas' patch just stalled ? that and the big nasty i18n patch are about the only thing i carry in Gentoo anymore as everything else has been merged ... -mike signature.asc Description: This is a digitally signed message part. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils