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