>From c44a0221f423c9cc36de85e50b954d1344263540 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 15 Aug 2012 13:10:37 +0200 Subject: [PATCH 1/5] Edit of bootstrap to automatically prepare gnulib - this commit will disappear when *attrat() wrappers becomes gnulib upstream. --- 0001-adding-module-xattr.patch | 172 ++++++++++++++++++++++++++ 0002-adding-module-xattr-at.patch | 247 ++++++++++++++++++++++++++++++++++++++ bootstrap | 11 ++ 3 files changed, 430 insertions(+) create mode 100644 0001-adding-module-xattr.patch create mode 100644 0002-adding-module-xattr-at.patch diff --git a/0001-adding-module-xattr.patch b/0001-adding-module-xattr.patch new file mode 100644 index 0000000..4ab1655 --- /dev/null +++ b/0001-adding-module-xattr.patch @@ -0,0 +1,172 @@ +From b00fff657574e7ca98336af9a35d672d349dc9be Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Mon, 6 Aug 2012 13:15:16 +0200 +Subject: [PATCH 1/2] adding module 'xattr' + +--- + lib/attr-xattr.in.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + m4/attr-xattr-h.m4 | 28 +++++++++++++++++++++++ + modules/xattr-h | 44 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 137 insertions(+) + create mode 100644 lib/attr-xattr.in.h + create mode 100644 m4/attr-xattr-h.m4 + create mode 100644 modules/xattr-h + +diff --git a/lib/attr-xattr.in.h b/lib/attr-xattr.in.h +new file mode 100644 +index 0000000..ae3e28f +--- /dev/null ++++ b/lib/attr-xattr.in.h +@@ -0,0 +1,65 @@ ++#ifndef address@hidden@_ATTR_XATTR_H ++#define address@hidden@_ATTR_XATTR_H ++ ++/* Replacement for platforms that lack it. ++ Copyright (C) 2012 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 3 of the License, 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, see . */ ++ ++#if HAVE_ATTR_XATTR_H ++ ++#include ++#include_next ++ ++#else ++# include ++ ++/* setting */ ++static inline int setxattr (const char *path, const char *name, const void ++ *value, size_t size, int flags) ++{ errno = ENOTSUP; return -1; } ++ ++static inline int lsetxattr (const char *path, const char *name, const void ++ *value, size_t size, int flags) ++{ errno = ENOTSUP; return -1; } ++ ++static inline int fsetxattr (int filedes, const char *name, const void *value, ++ size_t size, int flags) ++{ errno = ENOTSUP; return -1; } ++ ++ ++/* getting */ ++static inline ssize_t getxattr (const char *path, const char *name, void *value, ++ size_t size) ++{ errno = ENOTSUP; return -1; } ++static inline ssize_t lgetxattr (const char *path, const char *name, void ++ *value, size_t size) ++{ errno = ENOTSUP; return -1; } ++static inline ssize_t fgetxattr (int filedes, const char *name, void *value, ++ size_t size) ++{ errno = ENOTSUP; return -1; } ++ ++ ++/* listing */ ++static inline ssize_t listxattr (const char *path, char *list, size_t size) ++{ errno = ENOTSUP; return -1; } ++ ++static inline ssize_t llistxattr (const char *path, char *list, size_t size) ++{ errno = ENOTSUP; return -1; } ++ ++static inline ssize_t flistxattr (int filedes, char *list, size_t size) ++{ errno = ENOTSUP; return -1; } ++ ++#endif /* if HAVE_ATTR_XATTR_H */ ++#endif /* address@hidden@_ATTR_XATTR_H */ +diff --git a/m4/attr-xattr-h.m4 b/m4/attr-xattr-h.m4 +new file mode 100644 +index 0000000..271834b +--- /dev/null ++++ b/m4/attr-xattr-h.m4 +@@ -0,0 +1,28 @@ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++# This file is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# Provide , if necessary ++ ++AC_DEFUN([gl_HEADERS_ATTR_XATTR_H], ++[ ++ AC_ARG_WITH([xattrs], ++ AS_HELP_STRING([--without-xattrs], [don't use linux exteneded atttributes]), ++ [], [with_xattrs=maybe] ++ ) ++ ++ AC_CHECK_HEADERS([attr/xattr.h]) ++ if test "$ac_cv_header_attr_xattr_h" = yes; then ++ AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \ ++ setxattr fsetxattr lsetxattr \ ++ listxattr flistxattr llistxattr, ++ # only when functions are present ++ AC_DEFINE([HAVE_ATTR_XATTR_H], [1], ++ [define to 1 if we have header]) ++ if test "$with_xattrs" != no; then ++ AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) ++ fi ++ ) ++ fi ++]) +diff --git a/modules/xattr-h b/modules/xattr-h +new file mode 100644 +index 0000000..691e7fe +--- /dev/null ++++ b/modules/xattr-h +@@ -0,0 +1,44 @@ ++Description: ++xattr headers for systems that lack them ++ ++Files: ++lib/attr-xattr.in.h ++m4/attr-xattr-h.m4 ++ ++Depends-on: ++errno ++sys_types ++include_next ++ ++configure.ac: ++gl_HEADERS_ATTR_XATTR_H ++ ++Makefile.am: ++lib_SOURCES += attr-xattr.in.h ++BUILT_SOURCES += attr/xattr.h ++attr/xattr.h: attr-xattr.in.h $(top_builddir)/config.status ++ $(AM_V_at)$(MKDIR_P) attr ++ $(AM_V_GEN)rm -f address@hidden $@ && \ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ ++ -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \ ++ < $(srcdir)/attr-xattr.in.h; \ ++ } > address@hidden && \ ++ chmod a-x address@hidden && \ ++ mv address@hidden $@ ++MOSTLYCLEANFILES += attr/xattr.h attr/xattr.h-t ++ ++Include: ++ ++ ++ ++Link: ++ ++License: ++LGPLv2+ ++ ++Maintainer: ++all +-- +1.7.11.2 + diff --git a/0002-adding-module-xattr-at.patch b/0002-adding-module-xattr-at.patch new file mode 100644 index 0000000..07df9e5 --- /dev/null +++ b/0002-adding-module-xattr-at.patch @@ -0,0 +1,247 @@ +From 8c68bbb088bada4179d410a025b3212e6e9679c5 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Mon, 6 Aug 2012 13:16:19 +0200 +Subject: [PATCH 2/2] adding module xattr-at + +--- + lib/xattr-at.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + lib/xattr-at.h | 66 +++++++++++++++++++++++++++++++++ + modules/xattr-at | 36 ++++++++++++++++++ + 3 files changed, 212 insertions(+) + create mode 100644 lib/xattr-at.c + create mode 100644 lib/xattr-at.h + create mode 100644 modules/xattr-at + +diff --git a/lib/xattr-at.c b/lib/xattr-at.c +new file mode 100644 +index 0000000..746578c +--- /dev/null ++++ b/lib/xattr-at.c +@@ -0,0 +1,110 @@ ++/* openat-style fd-relative functions for operating with extended file ++ attributes. ++ ++ Copyright (C) 2012 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 3 of the License, 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, see . */ ++ ++#include ++ ++#include "xattr-at.h" ++#include "openat.h" ++ ++#include ++#include ++#include ++#include ++ ++#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ ++#include "save-cwd.h" ++ ++#include "openat-priv.h" ++ ++/* setxattrat */ ++#define AT_FUNC_NAME setxattrat ++#define AT_FUNC_F1 setxattr ++#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, const void *value \ ++ , size_t size, int flags ++#define AT_FUNC_POST_FILE_ARGS , name, value, size, flags ++#include "at-func.c" ++#undef AT_FUNC_NAME ++#undef AT_FUNC_F1 ++#undef AT_FUNC_POST_FILE_PARAM_DECLS ++#undef AT_FUNC_POST_FILE_ARGS ++ ++/* lsetxattrat */ ++#define AT_FUNC_NAME lsetxattrat ++#define AT_FUNC_F1 lsetxattr ++#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, const void *value \ ++ , size_t size, int flags ++#define AT_FUNC_POST_FILE_ARGS , name, value, size, flags ++#include "at-func.c" ++#undef AT_FUNC_NAME ++#undef AT_FUNC_F1 ++#undef AT_FUNC_POST_FILE_PARAM_DECLS ++#undef AT_FUNC_POST_FILE_ARGS ++ ++/* getxattrat */ ++#define AT_FUNC_NAME getxattrat ++#define AT_FUNC_RESULT ssize_t ++#define AT_FUNC_F1 getxattr ++#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, void *value \ ++ , size_t size ++#define AT_FUNC_POST_FILE_ARGS , name, value, size ++#include "at-func.c" ++#undef AT_FUNC_NAME ++#undef AT_FUNC_F1 ++#undef AT_FUNC_RESULT ++#undef AT_FUNC_POST_FILE_PARAM_DECLS ++#undef AT_FUNC_POST_FILE_ARGS ++ ++/* lgetxattrat */ ++#define AT_FUNC_NAME lgetxattrat ++#define AT_FUNC_RESULT ssize_t ++#define AT_FUNC_F1 lgetxattr ++#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, void *value \ ++ , size_t size ++#define AT_FUNC_POST_FILE_ARGS , name, value, size ++#include "at-func.c" ++#undef AT_FUNC_NAME ++#undef AT_FUNC_F1 ++#undef AT_FUNC_RESULT ++#undef AT_FUNC_POST_FILE_PARAM_DECLS ++#undef AT_FUNC_POST_FILE_ARGS ++ ++/* listxattrat */ ++#define AT_FUNC_NAME listxattrat ++#define AT_FUNC_RESULT ssize_t ++#define AT_FUNC_F1 listxattr ++#define AT_FUNC_POST_FILE_PARAM_DECLS , char *list , size_t size ++#define AT_FUNC_POST_FILE_ARGS , list , size ++#include "at-func.c" ++#undef AT_FUNC_NAME ++#undef AT_FUNC_F1 ++#undef AT_FUNC_RESULT ++#undef AT_FUNC_POST_FILE_PARAM_DECLS ++#undef AT_FUNC_POST_FILE_ARGS ++ ++/* llistxattrat */ ++#define AT_FUNC_NAME llistxattrat ++#define AT_FUNC_RESULT ssize_t ++#define AT_FUNC_F1 llistxattr ++#define AT_FUNC_POST_FILE_PARAM_DECLS , char *list , size_t size ++#define AT_FUNC_POST_FILE_ARGS , list , size ++#include "at-func.c" ++#undef AT_FUNC_NAME ++#undef AT_FUNC_F1 ++#undef AT_FUNC_RESULT ++#undef AT_FUNC_POST_FILE_PARAM_DECLS ++#undef AT_FUNC_POST_FILE_ARGS +diff --git a/lib/xattr-at.h b/lib/xattr-at.h +new file mode 100644 +index 0000000..480b9f3 +--- /dev/null ++++ b/lib/xattr-at.h +@@ -0,0 +1,66 @@ ++#ifndef XATTRS_AT_H ++#define XATTRS_AT_H ++ ++/* Prototypes for openat-style fd-relative functions for operating with ++ extended file attributes. ++ ++ Copyright (C) 2012 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 3 of the License, 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, see . */ ++ ++#include ++#include ++ ++/* These are the dir-fd-relative variants of the functions without the ++ "at" suffix. For example, setxattrat (AT_FDCWD, path, name, value, size, ++ flags &c) is usually equivalent to setxattr (file, name, value, size, ++ flags). For more info use the setxattr(2), getxattr(2) or listxattr(2) ++ manpages. */ ++ ++/* dir-fd-relative setxattr. Operation sets the VALUE of the extended ++ attribute identified by NAME and associated with the given PATH in the ++ filesystem relatively to directory identified by DIR_FD. See the ++ setxattr(2) manpage for the description of all parameters. */ ++int setxattrat (int dir_fd, const char *path, const char *name, ++ const void *value, size_t size, int flags); ++ ++/* dir-fd-relative lsetxattr. This function is just like setxattrat, ++ except when DIR_FD and FILE specify a symlink: lsetxattrat operates on the ++ symlink, while the setxattrat operates on the referent of the symlink. */ ++int lsetxattrat (int dir_fd, const char *path, const char *name, ++ const void *value, size_t size, int flags); ++ ++/* dir-fd-relative getxattr. Operation gets the VALUE of the extended ++ attribute idenfified by NAME and associated with the given PATH in the ++ filesystem relatively to directory identified by DIR_FD. For more info ++ about all parameters see the getxattr(2) manpage. */ ++ssize_t getxattrat (int dir_fd, const char *path, const char *name, ++ void *value, size_t size); ++ ++/* dir-fd-relative lgetxattr. This function is just like getxattrat, ++ except when DIR_FD and FILE specify a symlink: lgetxattrat operates on the ++ symlink, while the getxattrat operates on the referent of the symlink. */ ++ssize_t lgetxattrat (int dir_fd, const char *path, const char *name, ++ void *value, size_t size); ++ ++/* dir-fd-relative listxattr. Obtain the list of extended attrubtes names. For ++ more info see the listxattr(2) manpage. */ ++ssize_t listxattrat (int dir_fd, const char *path, char *list, size_t size); ++ ++/* dir-fd-relative llistxattr. This function is just like listxattrat, ++ except when DIR_FD and FILE specify a symlink: llistxattr operates on the ++ symlink, while the listxattrat operates on the referent of the symlink. */ ++ssize_t llistxattrat (int dir_fd, const char *path, char *list, size_t size); ++ ++#endif /* XATTRS_AT_H */ +diff --git a/modules/xattr-at b/modules/xattr-at +new file mode 100644 +index 0000000..c9aa995 +--- /dev/null ++++ b/modules/xattr-at +@@ -0,0 +1,36 @@ ++Description: ++openat-style fd-relative functions for extended attributes ++ ++Files: ++lib/xattr-at.h ++lib/xattr-at.c ++lib/at-func.c ++ ++Depends-on: ++at-internal ++dosname ++errno ++extensions ++fchdir ++fcntl-h ++openat-die ++openat-h ++save-cwd ++unistd ++sys_types ++xattr-h ++ ++configure.ac: ++AC_CHECK_HEADERS([attr/xattr.h]) ++AC_LIBOBJ([xattr-at]) ++ ++Makefile.am: ++ ++Include: ++"xattr-at.h" ++ ++License: ++LGPLv2+ ++ ++Maintainer: ++all +-- +1.7.11.2 + diff --git a/bootstrap b/bootstrap index 514ba47..5da2c69 100755 --- a/bootstrap +++ b/bootstrap @@ -227,6 +227,13 @@ fi # Translate configuration into internal form. +function apply_xattrs_patches() +{ + pushd $1 + git am ../000* + popd +} + # Parse options. for option @@ -483,6 +490,8 @@ case ${GNULIB_SRCDIR--} in git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" || cleanup_gnulib + apply_xattrs_patches $gnulib_path + trap - 1 2 13 15 fi GNULIB_SRCDIR=$gnulib_path @@ -508,6 +517,8 @@ case ${GNULIB_SRCDIR--} in "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ && git submodule init && git submodule update \ || exit $? + + apply_xattrs_patches $gnulib_path fi fi GNULIB_SRCDIR=$gnulib_path -- 1.7.11.2