This commit is contained in:
Kamil Dudka 2010-12-22 15:07:38 +01:00
parent eb93a8c671
commit 0c0242b3c5
3 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,50 @@
From bad2f36467d1f606eb418542a23949743708304e Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 22 Dec 2010 15:03:48 +0100
Subject: [PATCH] walk_tree: do not follow symlink to directory with -h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
reported by Jean-Pierre André at https://bugzilla.redhat.com/660613
---
libmisc/walk_tree.c | 3 ++-
test/attr.test | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
index b82a301..e237e85 100644
--- a/libmisc/walk_tree.c
+++ b/libmisc/walk_tree.c
@@ -60,7 +60,8 @@ static int walk_tree_rec(const char *path, int walk_flags,
void *), void *arg, int depth)
{
int follow_symlinks = (walk_flags & WALK_TREE_LOGICAL) ||
- (!(walk_flags & WALK_TREE_PHYSICAL) &&
+ ((walk_flags & WALK_TREE_DEREFERENCE) &&
+ !(walk_flags & WALK_TREE_PHYSICAL) &&
depth == 0);
int have_dir_stat = 0, flags = walk_flags, err;
struct entry_handle dir;
diff --git a/test/attr.test b/test/attr.test
index 10f10d0..a3e472d 100644
--- a/test/attr.test
+++ b/test/attr.test
@@ -221,6 +221,14 @@ Attributes of symlinks vs. the files pointed to
$ rm f
+Attributes of symlinks vs. the files pointed to in a directory
+
+ $ mkdir src
+ $ touch src/target
+ $ setfattr -n user.color -v blue src/target
+ $ ln -s src symlink
+ $ getfattr -n user.color -h symlink 2>/dev/null
+
Tests for file name that contain special characters
$ touch "f "
--
1.7.3.3

View File

@ -0,0 +1,61 @@
From c3fa3829e494c1875416058bb8d448a89f9e5e55 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 22 Dec 2010 14:13:27 +0100
Subject: [PATCH] getfattr: return non-zero exit code on failure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
reported by Jean-Pierre André at https://bugzilla.redhat.com/660619
---
getfattr/getfattr.c | 7 ++++---
test/attr.test | 4 ++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
index 7ced700..d8a7bc5 100644
--- a/getfattr/getfattr.c
+++ b/getfattr/getfattr.c
@@ -355,6 +355,7 @@ int do_print(const char *path, const struct stat *stat, int walk_flags,
void *unused)
{
int header_printed = 0;
+ int err = 0;
if (walk_flags & WALK_TREE_FAILED) {
fprintf(stderr, "%s: %s: %s\n", progname, xquote(path, "\n\r"),
@@ -363,13 +364,13 @@ int do_print(const char *path, const struct stat *stat, int walk_flags,
}
if (opt_name)
- print_attribute(path, opt_name, &header_printed);
+ err = print_attribute(path, opt_name, &header_printed);
else
- list_attributes(path, &header_printed);
+ err = list_attributes(path, &header_printed);
if (header_printed)
puts("");
- return 0;
+ return err;
}
void help(void)
diff --git a/test/attr.test b/test/attr.test
index e8f134c..10f10d0 100644
--- a/test/attr.test
+++ b/test/attr.test
@@ -22,6 +22,10 @@ Try various valid and invalid names
> user.name
>
+ $ setfattr -x user.name f
+ $ sh -c 'getfattr -n user.name f && echo zero exit code'
+ > f: user.name: No such attribute
+
$ setfattr -n user.n -v value f
$ rm f
--
1.7.3.3

View File

@ -27,6 +27,12 @@ Patch5: attr-2.4.44-bz587516.patch
# getfattr: encode NULs properly with --encoding=text (#650539)
Patch6: attr-2.4.44-bz650539.patch
# getfattr: return non-zero exit code on failure (#660619)
Patch7: attr-2.4.44-bz660619.patch
# walk_tree: do not follow symlink to directory with -h (#660613)
Patch8: attr-2.4.44-bz660613.patch
License: GPLv2+
URL: http://oss.sgi.com/projects/xfs/
Group: System Environment/Base
@ -78,6 +84,8 @@ you'll also want to install attr.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
# test-suite helper script
install -m0755 %{SOURCE2} test/
@ -158,6 +166,8 @@ rm -rf $RPM_BUILD_ROOT
* Wed Dec 22 2010 Kamil Dudka <kdudka@redhat.com> 2.2.44-6
- setfattr.1: document supported encodings of values (#587516)
- getfattr: encode NULs properly with --encoding=text (#650539)
- getfattr: return non-zero exit code on failure (#660619)
- walk_tree: do not follow symlink to directory with -h (#660613)
* Tue May 25 2010 Kamil Dudka <kdudka@redhat.com> 2.2.44-5
- let attr depend on the same version of libattr (#595689)