SHA256
1
0
forked from pool/attr
OBS User unknown 2009-01-09 00:27:12 +00:00 committed by Git OBS Bridge
parent 3a4d300ef1
commit 18db48f664
12 changed files with 667 additions and 1091 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f28213f4942e86b3640707e367b367b0870d893d5707d38f2b34adae87673d5d
size 102133

View File

@ -0,0 +1,83 @@
Subject: [PATCH] attr: add make test target and use make to run tests
The tests are difficult to run. So, this patch adds a Make target that
sets up the path and runs *.test files in the test/ directory.
ext specific tests can be ran from the test directory by running
`make ext`
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
Makefile | 6 +++++-
test/Makefile | 22 +++++++++++++---------
test/README | 4 ++++
3 files changed, 22 insertions(+), 10 deletions(-)
Index: attr-2.4.43/test/README
===================================================================
--- attr-2.4.43.orig/test/README
+++ attr-2.4.43/test/README
@@ -1,3 +1,7 @@
+Run `make test` in the root source tree to build the tree and run
+FS-independent tests.
+
+Run `cd test; make ext` to run ext specific tests.
Andreas Gruenbacher's tests for the ext2 filesystem extended attributes
support. Most of these tests should work for any filesystem type, and
Index: attr-2.4.43/test/Makefile
===================================================================
--- attr-2.4.43.orig/test/Makefile
+++ attr-2.4.43/test/Makefile
@@ -1,16 +1,20 @@
#
-# Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
+# Copyright (c) 2008 Novell, Inc.
#
-TOPDIR = ..
-include $(TOPDIR)/include/builddefs
+TEST = $(wildcard *.test)
+EXT = $(wildcard ext/*.test)
-# ensure we pick these up in the source tarball
-LSRCFILES = attr.test run README
+PATH := $(abspath ../getfattr/):$(abspath ../setfattr):$(abspath ../chattr):$(PATH)
-default:
+all: $(TEST)
+ext: $(EXT)
-include $(BUILDRULES)
+$(TEST):
+ @echo "*** $@ ***"; perl run $@
-install:
-install-dev install-lib:
+$(EXT):
+ @echo "EXT specific tests"; @echo "*** $@ ***"; perl run $@
+
+.PHONY: $(TEST) $(EXT) default
+.NOTPARALLEL:
Index: attr-2.4.43/Makefile
===================================================================
--- attr-2.4.43.orig/Makefile
+++ attr-2.4.43/Makefile
@@ -17,7 +17,7 @@ LDIRT = config.log .dep config.status co
Logs/* built .census install.* install-dev.* install-lib.* *.gz
SUBDIRS = include libmisc libattr attr getfattr setfattr \
- examples test m4 man doc po debian build
+ examples m4 man doc po debian build
default: $(CONFIGURE)
ifeq ($(HAVE_BUILDDEFS), no)
@@ -62,3 +62,7 @@ install-dev install-lib: default
realclean distclean: clean
rm -f $(LDIRT) $(CONFIGURE)
rm -rf autom4te.cache Logs
+
+.PHONY: test
+test: default
+ $(MAKE) -C test/

View File

@ -0,0 +1,78 @@
Subject: attr: Fix WALK_TREE_RECURSIVE for the WALK_TREE_DEREFERENCE case
NOTE: This fix was already added to the attr tree
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-cmds/attr/libmisc/walk_tree.c
[295] $ mkdir -p 1/sub -- ok
[296] $ mkdir 1/link -- ok
[297] $ touch 1/link/link-file -- ok
[298] $ touch 1/sub/sub-file -- ok
[299] $ ln -s `pwd`/1/link 1/sub/link -- ok
[300] $ setfattr -n "user.a" 1 -- ok
[301] $ setfattr -n "user.a" 1/link/link-file -- ok
[302] $ setfattr -n "user.a" 1/link -- ok
[303] $ setfattr -n "user.a" 1/sub/sub-file -- ok
[304] $ setfattr -n "user.a" 1/sub -- ok
[305] $ getfattr -P -R 1 -- failed
# file: 1 | # file: 1
user.a | user.a
|
# file: 1/sub | # file: 1/sub
user.a | user.a
|
# file: 1/sub/link | # file: 1/sub/link
user.a | user.a
|
# file: 1/sub/sub-file ? # file: 1/sub/link/link-file
user.a | user.a
|
# file: 1/link ? # file: 1/sub/sub-file
user.a | user.a
|
# file: 1/link/link-file ? # file: 1/link
user.a | user.a
|
~ ? # file: 1/link/link-file
~ ? user.a
~ ?
[324] $ getfattr -R -P 1/sub -- failed
# file: 1/sub | # file: 1/sub
user.a | user.a
|
# file: 1/sub/link | # file: 1/sub/link
user.a | user.a
|
# file: 1/sub/sub-file ? # file: 1/sub/link/link-file
user.a | user.a
|
~ ? # file: 1/sub/sub-file
~ ? user.a
~ ?
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
libmisc/walk_tree.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: acl-2.2.47/libmisc/walk_tree.c
===================================================================
--- acl-2.2.47.orig/libmisc/walk_tree.c
+++ acl-2.2.47/libmisc/walk_tree.c
@@ -93,8 +93,15 @@ static int walk_tree_rec(const char *pat
have_dir_stat = 1;
}
err = func(path, &st, flags, arg);
+
+ /*
+ * Recurse if WALK_TREE_RECURSIVE and the path is:
+ * a dir not from a symlink
+ * a link and follow_symlinks
+ */
if ((flags & WALK_TREE_RECURSIVE) &&
- (S_ISDIR(st.st_mode) || (S_ISLNK(st.st_mode) && follow_symlinks))) {
+ (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode)) ||
+ ((flags & WALK_TREE_SYMLINK) && follow_symlinks)) {
struct dirent *entry;
/*

View File

@ -1,640 +1,213 @@
Index: attr-2.4.39/doc/CHANGES
Subject: [PATCH] attr: move ext2/3 tests into seperate test file.
Some of these tests are fs specific and don't work under newer ext3
disks. Move into a seperate directory and file.
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
test/attr.test | 91 +++++++++++++++++++++++++------------------------------
test/ext/fs.test | 68 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 111 insertions(+), 48 deletions(-)
Index: attr-2.4.43/test/attr.test
===================================================================
--- attr-2.4.39.orig/doc/CHANGES
+++ attr-2.4.39/doc/CHANGES
@@ -1,3 +1,13 @@
+attr-2.4.40 (?)
+ - In some cases, gcc does not link in functions from libmisc.a
+ unless libmisc is specifief before the dynamic libraries on
+ the command line.
+ - Rip out nftw tree walking, it is broken and hopeless to fix.
+ The replacement walk_tree() function does exactly what we
+ want, and is much simpler to use.
+ - Add a test case for tree walking.
+ - For some reason, test/attr.test broke.
+
attr-2.4.39 (11 September 2007)
- Fix symlink handling with getfattr, thanks to Utako Usaka.
--- attr-2.4.43.orig/test/attr.test
+++ attr-2.4.43/test/attr.test
@@ -1,8 +1,4 @@
-Tests for extended attributes on ext2/ext3 file systems. The initial
-size checks and the file size checks are ext2/ext3 specific. The
-other setfattr/getfattr operations are designed to cover all special
-cases in the ext27ext3 kernel patches, but they should work on other
-filesystems as well.
+Tests for extended attributes on file systems.
Index: attr-2.4.39/getfattr/Makefile
===================================================================
--- attr-2.4.39.orig/getfattr/Makefile
+++ attr-2.4.39/getfattr/Makefile
@@ -8,8 +8,8 @@ include $(TOPDIR)/include/builddefs
LTCOMMAND = getfattr
CFILES = getfattr.c
Execute this test using the `run' script in this directory:
-LLDLIBS = $(LIBATTR) $(LIBMISC)
-LTDEPENDENCIES = $(LIBATTR) $(LIBMISC)
+LLDLIBS = $(LIBMISC) $(LIBATTR)
+LTDEPENDENCIES = $(LIBMISC) $(LIBATTR)
default: $(LTCOMMAND)
Index: attr-2.4.39/getfattr/getfattr.c
===================================================================
--- attr-2.4.39.orig/getfattr/getfattr.c
+++ attr-2.4.39/getfattr/getfattr.c
@@ -28,11 +28,11 @@
#include <ctype.h>
#include <getopt.h>
#include <regex.h>
-#include <ftw.h>
#include <locale.h>
#include <attr/xattr.h>
#include "config.h"
+#include "walk_tree.h"
#include "misc.h"
#define CMD_LINE_OPTIONS "n:de:m:hRLP"
@@ -54,11 +54,8 @@ struct option long_options[] = {
{ NULL, 0, 0, 0 }
};
-int opt_recursive; /* recurse into sub-directories? */
-int opt_walk_logical; /* always follow symbolic links */
-int opt_walk_physical; /* never follow symbolic links */
+int walk_flags = WALK_TREE_DEREFERENCE;
int opt_dump; /* dump attribute values (or only list the names) */
-int opt_deref = 1; /* dereference symbolic links */
char *opt_name; /* dump named attributes */
char *opt_name_pattern = "^user\\."; /* include only matching names */
char *opt_encoding; /* encode values automatically (NULL), or as "text",
@@ -84,12 +81,14 @@ static const char *xquote(const char *st
int do_getxattr(const char *path, const char *name, void *value, size_t size)
{
- return (opt_deref ? getxattr : lgetxattr)(path, name, value, size);
+ return ((walk_flags & WALK_TREE_DEREFERENCE) ?
+ getxattr : lgetxattr)(path, name, value, size);
}
int do_listxattr(const char *path, char *list, size_t size)
{
- return (opt_deref ? listxattr : llistxattr)(path, list, size);
+ return ((walk_flags & WALK_TREE_DEREFERENCE) ?
+ listxattr : llistxattr)(path, list, size);
}
const char *strerror_ea(int err)
@@ -347,21 +346,19 @@ int list_attributes(const char *path, in
return 0;
}
-int do_print(const char *path, const struct stat *stat,
- int flag, struct FTW *ftw)
+int do_print(const char *path, const struct stat *stat, int walk_flags, void *unused)
{
- int saved_errno = errno;
int header_printed = 0;
- /*
- * Process the target of a symbolic link, and traverse the
- * link, only if doing a logical walk, or if the symbolic link
- * was specified on the command line. Always skip symbolic
- * links if doing a physical walk.
- */
+ if (walk_flags & WALK_TREE_FAILED) {
+ fprintf(stderr, "%s: %s: %s\n", progname, xquote(path), strerror(errno));
+ return 1;
+ }
- if (S_ISLNK(stat->st_mode) &&
- (opt_walk_physical || (ftw->level > 0 && !opt_walk_logical)))
+ if ((walk_flags & WALK_TREE_SYMLINK) &&
+ (walk_flags & WALK_TREE_DEREFERENCE) &&
+ ((walk_flags & WALK_TREE_PHYSICAL) ||
+ !(walk_flags & (WALK_TREE_TOPLEVEL | WALK_TREE_LOGICAL))))
return 0;
if (opt_name)
@@ -371,21 +368,6 @@ int do_print(const char *path, const str
if (header_printed)
puts("");
-
- if (flag == FTW_DNR && opt_recursive) {
- /* Item is a directory which can't be read. */
- fprintf(stderr, "%s: %s: %s\n", progname, xquote(path),
- strerror(saved_errno));
- return 0;
- }
-
- /*
- * We also get here in non-recursive mode. In that case,
- * return something != 0 to abort nftw.
- */
-
- if (!opt_recursive)
- return 1;
return 0;
}
@@ -410,39 +392,6 @@ void help(void)
" --help this help text\n"));
}
-char *resolve_symlinks(const char *file)
-{
- static char buffer[4096];
- struct stat stat;
- char *path = NULL;
-
- if (lstat(file, &stat) == -1)
- return path;
-
- if (S_ISLNK(stat.st_mode) && !opt_walk_physical)
- path = realpath(file, buffer);
- else
- path = (char *)file; /* not a symlink, use given path */
-
- return path;
-}
-
-int walk_tree(const char *file)
-{
- const char *p;
-
- if ((p = resolve_symlinks(file)) == NULL) {
- fprintf(stderr, "%s: %s: %s\n", progname,
- xquote(file), strerror(errno));
- return 1;
- } else if (nftw(p, do_print, 0, opt_walk_logical? 0 : FTW_PHYS) < 0) {
- fprintf(stderr, "%s: %s: %s\n", progname, xquote(file),
- strerror(errno));
- return 1;
- }
- return 0;
-}
-
int main(int argc, char *argv[])
{
int opt;
@@ -478,7 +427,7 @@ int main(int argc, char *argv[])
return 0;
case 'h': /* do not dereference symlinks */
- opt_deref = 0;
+ walk_flags &= ~WALK_TREE_DEREFERENCE;
break;
case 'n': /* get named attribute */
@@ -497,17 +446,17 @@ int main(int argc, char *argv[])
break;
case 'L':
- opt_walk_logical = 1;
- opt_walk_physical = 0;
+ walk_flags |= WALK_TREE_LOGICAL;
+ walk_flags &= ~WALK_TREE_PHYSICAL;
break;
case 'P':
- opt_walk_logical = 0;
- opt_walk_physical = 1;
+ walk_flags |= WALK_TREE_PHYSICAL;
+ walk_flags &= ~WALK_TREE_LOGICAL;
break;
case 'R':
- opt_recursive = 1;
+ walk_flags |= WALK_TREE_RECURSIVE;
break;
case 'V':
@@ -531,7 +480,8 @@ int main(int argc, char *argv[])
}
while (optind < argc) {
- had_errors += walk_tree(argv[optind]);
+ had_errors += walk_tree(argv[optind], walk_flags, 0,
+ do_print, NULL);
optind++;
}
Index: attr-2.4.39/libmisc/Makefile
===================================================================
--- attr-2.4.39.orig/libmisc/Makefile
+++ attr-2.4.39/libmisc/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/include/builddefs
LTLIBRARY = libmisc.la
LTLDFLAGS =
-CFILES = quote.c unquote.c high_water_alloc.c next_line.c
+CFILES = quote.c unquote.c high_water_alloc.c next_line.c walk_tree.c
default: $(LTLIBRARY)
install install-dev install-lib:
Index: attr-2.4.39/setfattr/Makefile
===================================================================
--- attr-2.4.39.orig/setfattr/Makefile
+++ attr-2.4.39/setfattr/Makefile
@@ -8,8 +8,8 @@ include $(TOPDIR)/include/builddefs
LTCOMMAND = setfattr
CFILES = setfattr.c
-LLDLIBS = $(LIBATTR) $(LIBMISC)
-LTDEPENDENCIES = $(LIBATTR) $(LIBMISC)
+LLDLIBS = $(LIBMISC) $(LIBATTR)
+LTDEPENDENCIES = $(LIBMISC) $(LIBATTR)
default: $(LTCOMMAND)
Index: attr-2.4.39/test/attr.test
===================================================================
--- attr-2.4.39.orig/test/attr.test
+++ attr-2.4.39/test/attr.test
@@ -10,6 +10,9 @@ Execute this test using the `run' script
Try various valid and invalid names
+ $ mkdir d
+ $ cd d
+
$ touch f
$ setfattr -n user -v value f
> setfattr: f: Operation not supported
@@ -29,8 +32,8 @@ Try various valid and invalid names
Size checks, for an ext2/ext3 file system with a block size of 4K
$ touch f
- $ setfattr -n user.name -v 4040+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
- $ setfattr -n user.name -v 4041++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
+ $ setfattr -n user.name -v 4040++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
+ $ setfattr -n user.name -v 4041+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
> setfattr: f: No space left on device
@@ -29,14 +25,6 @@ Try various valid and invalid names
$ setfattr -n user.n -v value f
$ rm f
@@ -86,13 +89,6 @@ Value encodings
> user.name3=0s3vrO
>
- $ getfattr -d -e text f
- > # file: f
- > user.name="º¾"
- > user.name2="Þ­¾ï"
- > user.name3="ÞúÎ"
- >
-Size checks, for an ext2/ext3 file system with a block size of 4K
-
- $ touch f
- $ setfattr -n user.name -v 4040++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
- $ setfattr -n user.name -v 4041+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
- > setfattr: f: No space left on device
-
$ rm f
- $ rm f
Everything with one file
@@ -105,7 +101,7 @@ Everything with one file
$ setfattr -n user.short -v value f
$ setfattr -n user.novalue-yet f
$ ls -s f
- > 4 f
+ > 4 f
$ getfattr -d f
> # file: f
@@ -143,7 +139,7 @@ Everything with one file
$ setfattr -x user.novalue-yet f
$ getfattr -d f
$ ls -s f
- > 0 f
+ > 0 f
$ rm f
Editing values
@@ -147,17 +135,30 @@ Test extended attribute block sharing
@@ -152,15 +148,15 @@ Test extended attribute block sharing
$ touch f g h
$ setfattr -n user.novalue f g h
$ ls -s f g h
- > 4 f
- > 4 g
- > 4 h
+ > 4 f
+ > 4 g
+ > 4 h
- $ ls -s f g h
- > 4 f
- > 4 g
- > 4 h
-
+ $ getfattr f g h
+ > # file: f
+ > user.novalue
+ >
+ > # file: g
+ > user.novalue
+ >
+ > # file: h
+ > user.novalue
+ >
+
$ setfattr -n user.name -v value f
$ ls -s f g h
- > 4 f
- > 4 g
- > 4 h
+ > 4 f
+ > 4 g
+ > 4 h
- $ ls -s f g h
- > 4 f
- > 4 g
- > 4 h
-
+ $ getfattr f g h
+ > # file: f
+ > user.name
+ > user.novalue
+ >
+ > # file: g
+ > user.novalue
+ >
+ > # file: h
+ > user.novalue
+ >
+
$ getfattr -d f g h
> # file: f
@@ -176,15 +172,15 @@ Test extended attribute block sharing
> user.name="value"
@@ -169,38 +170,32 @@ Test extended attribute block sharing
> # file: h
> user.novalue
>
-
+
$ setfattr -n user.name -v value g
$ ls -s f g h
- > 4 f
- > 4 g
- > 4 h
- $ ls -s f g h
- > 4 f
- > 4 g
- > 4 h
-
- $ setfattr -x user.novalue h
- $ ls -s f g h
- > 4 f
- > 4 g
- > 0 h
-
- $ getfattr -d f g h
+ $ getfattr f g h
> # file: f
- > user.name="value"
+ > user.name
> user.novalue
>
> # file: g
- > user.name="value"
+ > user.name
> user.novalue
>
-
- $ setfattr -n user.name -v other-value g
- $ setfattr -n user.name -v value g
- $ setfattr -x user.name f g
- $ setfattr -x user.novalue f g
- $ ls -s f g h
- > 0 f
- > 0 g
- > 0 h
-
+ > # file: h
+ > user.novalue
+ >
+
+ $ setfattr -x user.novalue h
+ $ getfattr f g h
+ > # file: f
+ > user.name
+ > user.novalue
+ >
+ > # file: g
+ > user.name
+ > user.novalue
+ >
+
$ rm f g h
Attributes of symlinks vs. the files pointed to
Index: attr-2.4.43/test/ext/fs.test
===================================================================
--- /dev/null
+++ attr-2.4.43/test/ext/fs.test
@@ -0,0 +1,68 @@
+Tests for extended attributes on ext2/ext3 file systems. The initial
+size checks and the file size checks are ext2/ext3 specific. The
+other setfattr/getfattr operations are designed to cover all special
+cases in the ext27ext3 kernel patches, but they should work on other
+filesystems as well.
+
+Size checks, for an ext2/ext3 file system with a block size of 4K
+
+ $ touch f
+ $ setfattr -n user.name -v 4040++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
+ $ setfattr -n user.name -v 4041+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f
+ > setfattr: f: No space left on device
+
+ $ rm f
+
+
+Test extended attribute block sharing
+
+ $ touch f g h
+ $ setfattr -n user.novalue f g h
+ $ ls -s f g h
+ > 4 f
+ > 4 g
+ > 4 h
$ setfattr -x user.novalue h
$ ls -s f g h
- > 4 f
- > 4 g
- > 0 h
+
+ $ setfattr -n user.name -v value f
+ $ ls -s f g h
+ > 4 f
+ > 4 g
+ > 4 h
+
+ $ getfattr -d f g h
+ > # file: f
+ > user.name="value"
+ > user.novalue
+ >
+ > # file: g
+ > user.novalue
+ >
+ > # file: h
+ > user.novalue
+ >
+
+ $ setfattr -n user.name -v value g
+ $ ls -s f g h
+ > 4 f
+ > 4 g
+ > 4 h
+
+ $ setfattr -x user.novalue h
+ $ ls -s f g h
+ > 4 f
+ > 4 g
+ > 0 h
$ getfattr -d f g h
> # file: f
@@ -201,9 +197,9 @@ Test extended attribute block sharing
$ setfattr -x user.name f g
$ setfattr -x user.novalue f g
$ ls -s f g h
- > 0 f
- > 0 g
- > 0 h
+
+ $ setfattr -n user.name -v other-value g
+ $ setfattr -n user.name -v value g
+ $ setfattr -x user.name f g
+ $ setfattr -x user.novalue f g
+ $ ls -s f g h
+ > 0 f
+ > 0 g
+ > 0 h
$ rm f g h
@@ -260,6 +256,5 @@ Tests for attribute names that contains
$ setfattr -x "user.special\\007" f
$ rm f
-Some POSIX ACL tests...
-
- $ touch f
+ $ cd ..
+ $ rm -rf d
Index: attr-2.4.39/include/walk_tree.h
===================================================================
--- /dev/null
+++ attr-2.4.39/include/walk_tree.h
@@ -0,0 +1,19 @@
+#ifndef __WALK_TREE_H
+#define __WALK_TREE_H
+
+#define WALK_TREE_RECURSIVE 0x1
+#define WALK_TREE_PHYSICAL 0x2
+#define WALK_TREE_LOGICAL 0x4
+#define WALK_TREE_DEREFERENCE 0x8
+ $ rm f g h
+
+#define WALK_TREE_TOPLEVEL 0x100
+#define WALK_TREE_SYMLINK 0x200
+#define WALK_TREE_FAILED 0x400
+
+struct stat;
+
+extern int walk_tree(const char *path, int walk_flags, unsigned int num,
+ int (*func)(const char *, const struct stat *, int,
+ void *), void *arg);
+
+#endif
Index: attr-2.4.39/libmisc/walk_tree.c
===================================================================
--- /dev/null
+++ attr-2.4.39/libmisc/walk_tree.c
@@ -0,0 +1,188 @@
+/*
+ File: walk_tree.c
+
+ Copyright (C) 2007 Andreas Gruenbacher <a.gruenbacher@computer.org>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <dirent.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include "walk_tree.h"
+
+struct entry_handle {
+ struct entry_handle *prev, *next;
+ struct stat st;
+ DIR *stream;
+ off_t pos;
+};
+
+struct entry_handle head = {
+ .next = &head,
+ .prev = &head,
+ /* The other fields are unused. */
+};
+struct entry_handle *closed = &head;
+unsigned int num_dir_handles;
+
+static int walk_tree_rec(const char *path, int walk_flags,
+ int (*func)(const char *, const struct stat *, int,
+ void *), void *arg, int depth)
+{
+ int (*xstat)(const char *, struct stat *) = lstat;
+ int flags = walk_flags, err;
+ struct entry_handle dir;
+
+ /*
+ * If (walk_flags & WALK_TREE_PHYSICAL), do not traverse symlinks.
+ * If (walk_flags & WALK_TREE_LOGICAL), traverse all symlinks.
+ * Otherwise, traverse only top-level symlinks.
+ */
+ if (depth == 0)
+ flags |= WALK_TREE_TOPLEVEL;
+
+follow_symlink:
+ if (xstat(path, &dir.st) != 0)
+ return func(path, NULL, flags | WALK_TREE_FAILED, arg);
+ if (S_ISLNK(dir.st.st_mode)) {
+ flags |= WALK_TREE_SYMLINK;
+ if (flags & WALK_TREE_DEREFERENCE) {
+ xstat = stat;
+ goto follow_symlink;
+ }
+ }
+ err = func(path, &dir.st, flags, arg);
+ if ((flags & WALK_TREE_RECURSIVE) &&
+ (S_ISDIR(dir.st.st_mode) || (S_ISLNK(dir.st.st_mode))) &&
+ (!(flags & WALK_TREE_PHYSICAL) || !(flags & WALK_TREE_SYMLINK)) &&
+ (flags & (WALK_TREE_LOGICAL | WALK_TREE_TOPLEVEL))) {
+ struct entry_handle *i;
+ struct dirent *entry;
+
+ /* Check if we have already visited this directory. */
+ for (i = head.next; i != &head; i = i->next)
+ if (i->st.st_dev == dir.st.st_dev &&
+ i->st.st_ino == dir.st.st_ino)
+ return err;
+
+ if (num_dir_handles == 0 && closed->prev != &head) {
+close_another_dir:
+ /* Close the topmost directory handle still open. */
+ closed = closed->prev;
+ closed->pos = telldir(closed->stream);
+ closedir(closed->stream);
+ closed->stream = NULL;
+ num_dir_handles++;
+ }
+
+ dir.stream = opendir(path);
+ if (!dir.stream) {
+ if (errno == ENFILE && closed->prev != &head) {
+ /* Ran out of file descriptors. */
+ num_dir_handles = 0;
+ goto close_another_dir;
+ }
+
+ /*
+ * PATH may be a symlink to a regular file, or a dead
+ * symlink which we didn't follow above.
+ */
+ if (errno != ENOTDIR && errno != ENOENT)
+ err += func(path, &dir.st,
+ flags | WALK_TREE_FAILED, arg);
+ return err;
+ }
+
+ /* Insert into the list of handles. */
+ dir.next = head.next;
+ dir.prev = &head;
+ dir.prev->next = &dir;
+ dir.next->prev = &dir;
+ num_dir_handles--;
+
+ while ((entry = readdir(dir.stream)) != NULL) {
+ char *path_end;
+
+ if (!strcmp(entry->d_name, ".") ||
+ !strcmp(entry->d_name, ".."))
+ continue;
+ path_end = strchr(path, 0);
+ if ((path_end - path) + strlen(entry->d_name) + 1 >=
+ FILENAME_MAX) {
+ errno = ENAMETOOLONG;
+ err += func(path, NULL,
+ flags | WALK_TREE_FAILED, arg);
+ continue;
+ }
+ *path_end++ = '/';
+ strcpy(path_end, entry->d_name);
+ err += walk_tree_rec(path, walk_flags, func, arg,
+ depth + 1);
+ *--path_end = 0;
+ if (!dir.stream) {
+ /* Reopen the directory handle. */
+ dir.stream = opendir(path);
+ if (!dir.stream)
+ return err + func(path, &dir.st, flags |
+ WALK_TREE_FAILED, arg);
+ seekdir(dir.stream, dir.pos);
+
+ closed = closed->next;
+ num_dir_handles--;
+ }
+ }
+
+ if (closedir(dir.stream) != 0)
+ err += func(path, &dir.st, flags | WALK_TREE_FAILED,
+ arg);
+
+ /* Remove from the list of handles. */
+ dir.prev->next = dir.next;
+ dir.next->prev = dir.prev;
+ num_dir_handles++;
+ }
+ return err;
+}
+
+int walk_tree(const char *path, int walk_flags, unsigned int num,
+ int (*func)(const char *, const struct stat *, int, void *),
+ void *arg)
+{
+ char path_copy[FILENAME_MAX];
+
+ num_dir_handles = num;
+ if (num_dir_handles < 1) {
+ struct rlimit rlimit;
+
+ num_dir_handles = 1;
+ if (getrlimit(RLIMIT_NOFILE, &rlimit) == 0 &&
+ rlimit.rlim_cur >= 2)
+ num_dir_handles = rlimit.rlim_cur / 2;
+ }
+ if (strlen(path) >= FILENAME_MAX) {
+ errno = ENAMETOOLONG;
+ return func(path, NULL, WALK_TREE_FAILED, arg);
+ }
+ strcpy(path_copy, path);
+ return walk_tree_rec(path_copy, walk_flags, func, arg, 0);
+}
Index: attr-2.4.39/test/getfattr.test
===================================================================
--- /dev/null
+++ attr-2.4.39/test/getfattr.test
@@ -0,0 +1,52 @@
+ $ mkdir d
+ $ cd d
+
+ $ touch f
+ $ setfattr -n user.test -v test f
+ $ ln -s f l
+
+This case should be obvious:
+ $ getfattr -d f
+ > # file: f
+ > user.test="test"
+ >
+
+If a symlink is explicitly specified on the command line, follow it
+(-H behavior):
+ $ getfattr -d l
+ > # file: l
+ > user.test="test"
+ >
+
+Unless we are explicitly told not to dereference symlinks:
+ $ getfattr -hd l
+
+When walking a tree, it does not make sense to follow symlinks. We should
+only see f's attributes here -- that's a bug:
+ $ getfattr -Rd .
+ > # file: f
+ > user.test="test"
+ >
+
+This case works as expected:
+ $ getfattr -Rhd .
+ > # file: f
+ > user.test="test"
+ >
+
+In these two cases, getfattr should dereference the symlink passed on the
+command line, but not l. This doesn't work correctly, either; it's the same
+bug:
+ $ ln -s . here
+ $ getfattr -Rd here
+ > # file: here/f
+ > user.test="test"
+ >
+
+ $ getfattr -Rhd here
+ > # file: here/f
+ > user.test="test"
+ >
+
+ $ cd ..
+ $ rm -rf d

View File

@ -0,0 +1,134 @@
Subject: [PATCH] attr: Tests for path recursion with -L -P -R
Add tests against patches from Andreas to fix up walk_tree.c.
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
test/attr.test | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 116 insertions(+)
Index: attr-2.4.43/test/attr.test
===================================================================
--- attr-2.4.43.orig/test/attr.test
+++ attr-2.4.43/test/attr.test
@@ -253,3 +253,119 @@ Tests for attribute names that contains
$ cd ..
$ rm -rf d
+
+Tests for proper path recursion reported by Tony Ernst <tee@sgi.com> bnc#457660
+
+ $ mkdir -p 1/2/3
+ $ setfattr -n "user.9" 1
+ $ setfattr -n "user.a" 1
+ $ setfattr -n "user.9" 1/2
+ $ setfattr -n "user.a" 1/2
+ $ setfattr -n "user.9" 1/2/3
+ $ setfattr -n "user.a" 1/2/3
+
+ $ getfattr -h -L -R -m '.' -e hex 1
+ > # file: 1
+ > user.9
+ > user.a
+ >
+ > # file: 1/2
+ > user.9
+ > user.a
+ >
+ > # file: 1/2/3
+ > user.9
+ > user.a
+ >
+
+ $ getfattr -h -P -R -m '.' -e hex 1/2
+ > # file: 1/2
+ > user.9
+ > user.a
+ >
+ > # file: 1/2/3
+ > user.9
+ > user.a
+ >
+
+ $ rm -R 1
+
+Test for proper recursion of directory structures with -L -P -R
+
+ $ mkdir -p 1/sub
+ $ mkdir 1/link
+ $ touch 1/link/link-file
+ $ touch 1/sub/sub-file
+ $ ln -s `pwd`/1/link 1/sub/link
+ $ setfattr -n "user.a" 1
+ $ setfattr -n "user.a" 1/link/link-file
+ $ setfattr -n "user.a" 1/link
+ $ setfattr -n "user.a" 1/sub/sub-file
+ $ setfattr -n "user.a" 1/sub
+ $ getfattr -P -R 1
+ > # file: 1
+ > user.a
+ >
+ > # file: 1/sub
+ > user.a
+ >
+ > # file: 1/sub/link
+ > user.a
+ >
+ > # file: 1/sub/sub-file
+ > user.a
+ >
+ > # file: 1/link
+ > user.a
+ >
+ > # file: 1/link/link-file
+ > user.a
+ >
+ $ getfattr -R -P 1/sub
+ > # file: 1/sub
+ > user.a
+ >
+ > # file: 1/sub/link
+ > user.a
+ >
+ > # file: 1/sub/sub-file
+ > user.a
+ >
+ $ getfattr -L -R 1
+ > # file: 1
+ > user.a
+ >
+ > # file: 1/sub
+ > user.a
+ >
+ > # file: 1/sub/link
+ > user.a
+ >
+ > # file: 1/sub/link/link-file
+ > user.a
+ >
+ > # file: 1/sub/sub-file
+ > user.a
+ >
+ > # file: 1/link
+ > user.a
+ >
+ > # file: 1/link/link-file
+ > user.a
+ >
+ $ getfattr -R 1/sub/link
+ > # file: 1/sub/link
+ > user.a
+ >
+ > # file: 1/sub/link/link-file
+ > user.a
+ >
+ $ getfattr -L -R 1/sub/link
+ > # file: 1/sub/link
+ > user.a
+ >
+ > # file: 1/sub/link/link-file
+ > user.a
+ >
+
+ $ rm -R 1

View File

@ -0,0 +1,149 @@
Subject: [PATCH] attr: various improvements for test/run
First move process_test to avoid a warning:
main::process_test() called too early to check prototype at ./run line 47.
main::process_test() called too early to check prototype at ./run line 60.
Create two ENV variables TUSER and TGROUP to get the user/group
running the test.
Add a | test line that is similar to > but is interpreted as a regular
expression.
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
test/run | 99 ++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 51 insertions(+), 48 deletions(-)
Index: acl-2.2.47/test/run
===================================================================
--- acl-2.2.47.orig/test/run
+++ acl-2.2.47/test/run
@@ -25,26 +25,69 @@ if (isatty(fileno(STDOUT))) {
$FAILED = "\033[31m\033[1m" . $FAILED . "\033[m";
}
+$ENV{"TUSER"} = getpwuid($>);
+$ENV{"TGROUP"} = getgrgid($));
+
sub exec_test($$);
-my ($prog, $in, $out) = ([], [], []);
+my ($prog, $in, $out, $outmatch) = ([], [], [], []);
my $line_number = 0;
my $prog_line;
my ($tests, $failed) = (0,0);
+sub process_test($$$$$) {
+ my ($prog, $prog_line, $in, $out, $outmatch) = @_;
+
+ return unless @$prog;
+
+ my $p = [ @$prog ];
+ print "[$prog_line] \$ ", join(' ',
+ map { s/\s/\\$&/g; $_ } @$p), " -- ";
+ my $result = exec_test($prog, $in);
+ my $good = 1;
+ my $nmax = (@$outmatch > @$result) ? @$outmatch : @$result;
+ for (my $n=0; $n < $nmax; $n++) {
+ if (!defined($outmatch->[$n]) || !defined($result->[$n]) ||
+ $result->[$n] !~ /($outmatch->[$n])/) {
+ $good = 0;
+ }
+ }
+ $tests++;
+ $failed++ unless $good;
+ print $good ? $OK : $FAILED, "\n";
+ if (!$good) {
+ for (my $n=0; $n < $nmax; $n++) {
+ my $l = defined($out->[$n]) ? $out->[$n] : "~";
+ chomp $l;
+ my $r = defined($result->[$n]) ? $result->[$n] : "~";
+ chomp $r;
+ print sprintf("%-37s %s %-39s\n", $l, $l eq $r ? "|" : "?", $r);
+ }
+ } elsif ($opt_v) {
+ print join('', @$result);
+ }
+}
+
+
+
for (;;) {
my $line = <>; $line_number++;
if (defined $line) {
# Substitute %VAR and %{VAR} with environment variables.
- $line =~ s[%(?:(\w+)|\{(\w+)\})][$ENV{"$1$2"}]eg;
+ $line =~ s[%\{(\w+)\}][$ENV{"$1"}]eg;
+ $line =~ s[%(\w+)][$ENV{"$1"}]eg;
}
if (defined $line) {
if ($line =~ s/^\s*< ?//) {
push @$in, $line;
- } elsif ($line =~ s/^\s*> ?//) {
+ } elsif ($line =~ s/^\s*> ?//) { # explicit matching
+ push @$outmatch, "^(\Q$line\E)\$";
+ push @$out, $line;
+ } elsif ($line =~ s/^\s*\| ?//) { # regex case
+ push @$outmatch, $line;
push @$out, $line;
} else {
- process_test($prog, $prog_line, $in, $out);
+ process_test($prog, $prog_line, $in, $out, $outmatch);
$prog = [];
$prog_line = 0;
@@ -55,9 +98,10 @@ for (;;) {
$prog_line = $line_number;
$in = [];
$out = [];
+ $outmatch = [];
}
} else {
- process_test($prog, $prog_line, $in, $out);
+ process_test($prog, $prog_line, $in, $out, $outmatch);
last;
}
}
@@ -75,39 +119,6 @@ print $status, "\n";
exit $failed ? 1 : 0;
-sub process_test($$$$) {
- my ($prog, $prog_line, $in, $out) = @_;
-
- return unless @$prog;
-
- my $p = [ @$prog ];
- print "[$prog_line] \$ ", join(' ',
- map { s/\s/\\$&/g; $_ } @$p), " -- ";
- my $result = exec_test($prog, $in);
- my $good = 1;
- my $nmax = (@$out > @$result) ? @$out : @$result;
- for (my $n=0; $n < $nmax; $n++) {
- if (!defined($out->[$n]) || !defined($result->[$n]) ||
- $out->[$n] ne $result->[$n]) {
- $good = 0;
- }
- }
- $tests++;
- $failed++ unless $good;
- print $good ? $OK : $FAILED, "\n";
- if (!$good) {
- for (my $n=0; $n < $nmax; $n++) {
- my $l = defined($out->[$n]) ? $out->[$n] : "~";
- chomp $l;
- my $r = defined($result->[$n]) ? $result->[$n] : "~";
- chomp $r;
- print sprintf("%-37s %s %-39s\n", $l, $l eq $r ? "|" : "?", $r);
- }
- } elsif ($opt_v) {
- print join('', @$result);
- }
-}
-
sub su($) {
my ($user) = @_;

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 6 14:09:13 PST 2009 - bphilips@suse.de
- Fix tests and add make target
- Version bump to get fix for getfattr -P bnc#457660
-------------------------------------------------------------------
Wed Dec 10 12:34:56 CET 2008 - olh@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package attr (Version 2.4.39)
# spec file for package attr (Version 2.4.43)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -22,14 +22,16 @@ Name: attr
Group: System/Filesystems
AutoReqProv: on
Summary: Commands for Manipulating Extended Attributes
Version: 2.4.39
Release: 67
Source: %{name}-%{version}.src.tar.bz2
Version: 2.4.43
Release: 1
Source: %{name}_%{version}-1.tar.gz
Source1: xattr.conf
Patch0: builddefs.in.diff
Patch1: xattr_conf.diff
Patch2: remove-ea-conv.diff
Patch3: walk-attr.diff
Patch1: attr-move-ext2-3-tests-into-seperate-test-file.patch
Patch2: attr-various-improvements-for-test-run.patch
Patch3: attr-add-make-test-target-and-use-make-to-run-tests.patch
Patch4: attr-tests-for-path-recursion-with-l-p-r.patch
Patch5: attr-fix-walk_tree_recursive-for-the-walk_tree_dereference-case.patch
Url: ftp://oss.sgi.com/projects/xfs/cmd_tars
BuildRoot: %{_tmppath}/%{name}-%{version}-build
License: GPL v2 or later
@ -102,6 +104,8 @@ Authors:
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
export OPTIMIZER="$RPM_OPT_FLAGS -fPIC"
@ -186,6 +190,9 @@ rm -rf $RPM_BUILD_ROOT
%config %{_sysconfdir}/xattr.conf
%changelog
* Tue Jan 06 2009 bphilips@suse.de
- Fix tests and add make target
- Version bump to get fix for getfattr -P bnc#457660
* Wed Dec 10 2008 olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
(bnc#437293)
@ -199,7 +206,7 @@ rm -rf $RPM_BUILD_ROOT
* Sat Oct 27 2007 agruen@suse.de
- Don't exhaust the number of file descriptors in the path walking
code, and make sure each directory is only visited once.
* Fri Oct 26 2007 agruen@suse.de
* Thu Oct 25 2007 agruen@suse.de
- A large jump to the current upstream version 2.4.39.
- Fix the upstream path walking code.
- Remove the ea-conv script; this is not relevant anymore since
@ -255,11 +262,11 @@ rm -rf $RPM_BUILD_ROOT
* Thu Jan 01 2004 agruen@suse.de
- Update to version 2.4.12. Bug fix in directory tree walking
code.
* Wed Oct 22 2003 kukuk@suse.de
* Tue Oct 21 2003 kukuk@suse.de
- Fix provides/requires for update case
* Thu Aug 28 2003 agruen@suse.de
- Fix a bug with error handling while walking directory trees.
* Thu Aug 28 2003 ro@suse.de
* Wed Aug 27 2003 ro@suse.de
- fix patch-depth in specfile
* Tue Aug 26 2003 agruen@suse.de
- Fix SIGSEGV if the quote function.
@ -274,7 +281,7 @@ rm -rf $RPM_BUILD_ROOT
- Update to 2.4.2
* Sun Apr 06 2003 agruen@suse.de
- Update to 2.4.1.
* Thu Feb 27 2003 agruen@suse.de
* Wed Feb 26 2003 agruen@suse.de
- Fix broken attr_copy_check_permissions() function.
* Wed Feb 26 2003 agruen@suse.de
- Update to attr-2.4.0 which has our patches integrated.
@ -311,7 +318,7 @@ rm -rf $RPM_BUILD_ROOT
- Change the documentation path in builddefs.in instead of in
configure.in.
- Update to version 2.0.9
* Thu Jun 20 2002 lmuelle@suse.de
* Wed Jun 19 2002 lmuelle@suse.de
- Remove DESTDIR patch, use DIST_ROOT of package instead
- Update to version 2.0.8
* Wed Jun 12 2002 ro@suse.de

3
attr_2.4.43-1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d358b233b3e2ad235e63fd8697e337006fc7506844e424b0d9dd7a24affec5bf
size 116991

View File

@ -1,7 +1,11 @@
Index: attr-2.4.39/include/builddefs.in
---
include/builddefs.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: attr-2.4.43/include/builddefs.in
===================================================================
--- attr-2.4.39.orig/include/builddefs.in
+++ attr-2.4.39/include/builddefs.in
--- attr-2.4.43.orig/include/builddefs.in
+++ attr-2.4.43/include/builddefs.in
@@ -33,7 +33,7 @@ PKG_LIB_DIR = @libdir@@libdirsuffix@
PKG_DEVLIB_DIR = @libexecdir@@libdirsuffix@
PKG_INC_DIR = @includedir@/attr

View File

@ -1,177 +0,0 @@
Index: attr-2.4.39/doc/Makefile
===================================================================
--- attr-2.4.39.orig/doc/Makefile
+++ attr-2.4.39/doc/Makefile
@@ -5,8 +5,6 @@
TOPDIR = ..
include $(TOPDIR)/include/builddefs
-SUBDIRS = ea-conv
-
LSRCFILES = INSTALL PORTING CHANGES COPYING
LDIRT = *.gz
Index: attr-2.4.39/doc/ea-conv/Makefile
===================================================================
--- attr-2.4.39.orig/doc/ea-conv/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved.
-#
-
-TOPDIR = ../..
-include $(TOPDIR)/include/builddefs
-
-LSRCFILES = README ea-conv
-
-include $(BUILDRULES)
-
-install: default
- $(INSTALL) -m 755 -d $(PKG_DOC_DIR)/ea-conv
- $(INSTALL) -m 644 README $(PKG_DOC_DIR)/ea-conv
- $(INSTALL) -m 755 ea-conv $(PKG_DOC_DIR)/ea-conv
-
-default install-dev install-lib:
Index: attr-2.4.39/doc/ea-conv/README
===================================================================
--- attr-2.4.39.orig/doc/ea-conv/README
+++ /dev/null
@@ -1,13 +0,0 @@
-ea-conv -- convert between aget and getfattr format
-
-This script converts between the extended attribute text formats of
-getfattr and its predecessor, aget. To get all attributes with aget
-and convert the result to getfattr format, use the following command:
-
- aget -Rds -e hex . | ea-conv -
-
-To get all attributes with getfattr and convert the result to aget
-format, use the following command:
-
- getfattr -Rd -m - -e hex . | ea-conv -
-
Index: attr-2.4.39/doc/ea-conv/ea-conv
===================================================================
--- attr-2.4.39.orig/doc/ea-conv/ea-conv
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use FileHandle;
-
-sub convert_acl($)
-{
- my ($value) = @_;
-
- local $_ = $value;
-
- die "ACL value must be hex encoded\n" unless (s/^0x//);
- s/\s//g;
-
- my ($x4, $x8) = ('([0-9A-Fa-f]{4})', '([0-9A-Fa-f]{8})');
-
- if (s/^01000000//) {
- my $new_value = '0x02000000 ';
- while ($_ ne '') {
- if (s/^(0100|0400|1000|2000)$x4//) {
- $new_value .= "$1$2ffffffff ";
- } elsif (s/^(0200|0800)$x4$x8//) {
- $new_value .= "$1$2$3 ";
- } else {
- die "ACL format not recognized\n"
- }
- }
- return $new_value;
- } elsif (s/^02000000//) {
- my $new_value = '0x01000000 ';
- while ($_ ne '') {
- if (s/^(0100|0400|1000|2000)$x4$x8//) {
- $new_value .= "$1$2 ";
- } elsif (s/^(0200|0800)$x4$x8//) {
- $new_value .= "$1$2$3 ";
- } else {
- die "ACL format not recognized\n"
- }
- }
- return $new_value;
- } else {
- die "ACL format not recognized\n"
- }
-}
-
-sub check_name($) {
- my ($name) = @_;
- if ($name =~ m[^[^A-Za-z]]) {
- print STDERR "Renaming attribute `user.$name' to `X$name'.\n";
- return "X$name";
- }
- return $name;
-}
-
-sub convert($) {
- my ($file) = @_;
-
- eval {
- while (<$file>) {
- m[^(#.*)?$] ||
- s[^system\.posix_acl_access=(0x02.*)]
- ['$acl=' . convert_acl($1)]e ||
- s[^system\.posix_acl_default=(0x02.*)]
- ['$defacl=' . convert_acl($1)]e ||
- s[^user\.([^=]*)][check_name($1)]e ||
-
- s[^\$acl=(0x01.*)]
- ['system.posix_acl_access=' .
- convert_acl($1)]e ||
- s[^\$defacl=(0x01.*)]
- ['system.posix_acl_default=' .
- convert_acl($1)]e ||
- s[^([A-Za-z][^=]*)][user.$1] ||
-
- die "Input format error\n";
-
- print;
- }
- };
- if ($@) {
- chomp $@;
- print STDERR "$@ in line $..\n";
- }
- return (not $@);
-}
-
-unless (@ARGV) {
- printf STDERR <<EOF;
-$0 -- convert between aget and getfattr format
-
-This script converts between the extended attribute text formats of
-getfattr and its predecessor, aget. To get all attributes with aget
-and convert the result to getfattr format, use the following command:
-
- aget -Rds -e hex . | $0 -
-
-To get all attributes with getfattr and convert the result to aget
-format, use the following command:
-
- getfattr -Rd -m - -e hex . | $0 -
-
-EOF
- exit 1;
-}
-
-my $good = 1;
-foreach my $arg (@ARGV) {
- my $fh = ($arg eq '-') ? *STDIN : new FileHandle($arg);
-
- unless ($fh) {
- print STDERR "$0: $arg: $!\n";
- next;
- }
-
- $good = 0 unless convert $fh;
-
- $fh->close unless ($arg eq '-');
-}
-exit (not $good);

View File

@ -1,281 +0,0 @@
Index: attr-2.4.39/libattr/Makefile
===================================================================
--- attr-2.4.39.orig/libattr/Makefile
+++ attr-2.4.39/libattr/Makefile
@@ -12,7 +12,7 @@ LT_CURRENT = 2
LT_REVISION = 0
LT_AGE = 1
-CFILES = libattr.c attr_copy_fd.c attr_copy_file.c attr_copy_check.c
+CFILES = libattr.c attr_copy_fd.c attr_copy_file.c attr_copy_check.c attr_copy_action.c
HFILES = libattr.h
ifeq ($(PKG_PLATFORM),linux)
Index: attr-2.4.39/libattr/attr_copy_action.c
===================================================================
--- /dev/null
+++ attr-2.4.39/libattr/attr_copy_action.c
@@ -0,0 +1,163 @@
+/* Copyright (C) 2006 Andreas Gruenbacher <agruen@suse.de>, SuSE Linux AG.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <alloca.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <fnmatch.h>
+
+#include "attr/libattr.h"
+#define ERROR_CONTEXT_MACROS
+#include "error_context.h"
+
+#define ATTR_CONF "/etc/xattr.conf"
+
+struct attr_action {
+ struct attr_action *next;
+ char *pattern;
+ int action;
+};
+
+static struct attr_action *attr_actions;
+
+static void
+free_attr_actions(void)
+{
+ struct attr_action *tmp;
+
+ while (attr_actions) {
+ tmp = attr_actions->next;
+ free(attr_actions->pattern);
+ free(attr_actions);
+ attr_actions = tmp;
+ }
+}
+
+static int
+attr_parse_attr_conf(struct error_context *ctx)
+{
+ char *text, *t;
+ size_t size_guess = 4096, len;
+ FILE *file;
+ char *pattern = NULL;
+ struct attr_action *new;
+ int action;
+
+ if (attr_actions)
+ return 0;
+
+repeat:
+ text = malloc(size_guess + 1);
+ if (!text)
+ goto fail;
+
+ if ((file = fopen(ATTR_CONF, "r")) == NULL) {
+ if (errno == ENOENT)
+ return 0;
+ goto fail;
+ }
+ len = fread(text, 1, size_guess, file);
+ if (ferror(file))
+ goto fail;
+ if (!feof(file)) {
+ fclose(file);
+ file = NULL;
+ free(text);
+ size_guess *= 2;
+ goto repeat;
+ }
+ fclose(file);
+ file = NULL;
+
+ text[len] = 0;
+ t = text;
+ for (;;) {
+ t += strspn(t, " \t\n");
+ len = strcspn(t, " \t\n#");
+ if (t[len] == '#') {
+ if (len)
+ goto parse_error;
+ t += strcspn(t, "\n");
+ continue;
+ } else if (t[len] == 0)
+ break;
+ else if (t[len] == '\n')
+ goto parse_error;
+ pattern = strndup(t, len);
+ if (!pattern)
+ goto fail;
+ t += len;
+
+ t += strspn(t, " \t");
+ len = strcspn(t, " \t\n#");
+ if (len == 4 && !strncmp(t, "skip", 4))
+ action = ATTR_ACTION_SKIP;
+ else if (len == 11 && !strncmp(t, "permissions", 11))
+ action = ATTR_ACTION_PERMISSIONS;
+ else
+ goto parse_error;
+ t += len;
+ t += strspn(t, " \t");
+ if (*t != '#' && *t != '\n')
+ goto parse_error;
+
+ new = malloc(sizeof(struct attr_action));
+ if (!new)
+ goto parse_error;
+ new->next = attr_actions;
+ new->pattern = pattern;
+ new->action = action;
+ attr_actions = new;
+
+ t += strcspn(t, "\n");
+ }
+ return 0;
+
+parse_error:
+ errno = EINVAL;
+
+fail:
+ {
+ const char *q = quote (ctx, ATTR_CONF);
+ error (ctx, "%s", q);
+ quote_free (ctx, q);
+ }
+
+ free(pattern);
+ if (file)
+ fclose(file);
+ free(text);
+ free_attr_actions();
+ return -1;
+}
+
+int
+attr_copy_action(const char *name, struct error_context *ctx)
+{
+ struct attr_action *action = attr_actions;
+
+ if (!attr_parse_attr_conf(ctx)) {
+ for (action = attr_actions; action; action = action->next) {
+ if (!fnmatch(action->pattern, name, 0))
+ return action->action;
+ }
+ }
+ return 0;
+}
Index: attr-2.4.39/libattr/attr_copy_fd.c
===================================================================
--- attr-2.4.39.orig/libattr/attr_copy_fd.c
+++ attr-2.4.39/libattr/attr_copy_fd.c
@@ -119,7 +119,7 @@ attr_copy_fd(const char *src_path, int s
quote_free (ctx, qname);
quote_free (ctx, qpath);
ret = -1;
- continue; /* may not have permission to access */
+ continue;
}
value = (char *) realloc (old_value = value, size);
if (size != 0 && value == NULL) {
@@ -136,6 +136,7 @@ attr_copy_fd(const char *src_path, int s
quote_free (ctx, qname);
quote_free (ctx, qpath);
ret = -1;
+ continue;
}
if (fsetxattr (dst_fd, name, value, size, 0) != 0) {
if (errno == ENOTSUP)
Index: attr-2.4.39/libattr/attr_copy_file.c
===================================================================
--- attr-2.4.39.orig/libattr/attr_copy_file.c
+++ attr-2.4.39/libattr/attr_copy_file.c
@@ -117,7 +117,7 @@ attr_copy_file(const char *src_path, con
quote_free (ctx, qname);
quote_free (ctx, qpath);
ret = -1;
- continue; /* may not have permission to access */
+ continue;
}
value = (char *) realloc (old_value = value, size);
if (size != 0 && value == NULL) {
@@ -134,6 +134,7 @@ attr_copy_file(const char *src_path, con
quote_free (ctx, qname);
quote_free (ctx, qpath);
ret = -1;
+ continue;
}
if (lsetxattr (dst_path, name, value, size, 0) != 0) {
if (errno == ENOTSUP)
Index: attr-2.4.39/libattr/attr_copy_check.c
===================================================================
--- attr-2.4.39.orig/libattr/attr_copy_check.c
+++ attr-2.4.39/libattr/attr_copy_check.c
@@ -23,32 +23,6 @@
int
attr_copy_check_permissions(const char *name, struct error_context *ctx)
{
- /* Skip POSIX ACLs. */
- if (strncmp(name, "system.posix_acl_", 17) == 0 &&
- (strcmp(name+17, "access") == 0 ||
- strcmp(name+17, "default") == 0))
- return 0;
-
- /* Skip permissions attributes which are used on IRIX, and
- hence are part of the XFS ondisk format (incl. ACLs).
- Also skip SGI DMF attributes as they are inappropriate
- targets for copying over as well. */
- if (strncmp(name, "trusted.SGI_", 12) == 0 &&
- (strcmp(name+12, "ACL_DEFAULT") == 0 ||
- strcmp(name+12, "ACL_FILE") == 0 ||
- strcmp(name+12, "CAP_FILE") == 0 ||
- strcmp(name+12, "MAC_FILE") == 0 ||
- strncmp(name+12, "DMI_", 4) == 0))
- return 0;
-
- /* The xfsroot namespace mirrored attributes, some of which
- are also also available via the system.* and trusted.*
- namespaces. To avoid the problems this would cause,
- we skip xfsroot altogether.
- Note: xfsroot namespace has now been removed from XFS. */
- if (strncmp(name, "xfsroot.", 8) == 0)
- return 0;
-
- return 1;
+ return attr_copy_action(name, ctx) == 0;
}
Index: attr-2.4.39/include/libattr.h
===================================================================
--- attr-2.4.39.orig/include/libattr.h
+++ attr-2.4.39/include/libattr.h
@@ -14,9 +14,14 @@ extern int attr_copy_fd (const char *, i
int (*) (const char *, struct error_context *),
struct error_context *);
-/* The default check function used by attr_copy_{fd,file}. */
+/* Keep this function for backwards compatibility. */
extern int attr_copy_check_permissions(const char *, struct error_context *);
+#define ATTR_ACTION_SKIP 1
+#define ATTR_ACTION_PERMISSIONS 2
+
+extern int attr_copy_action(const char *, struct error_context *);
+
#ifdef __cplusplus
}
#endif