1 |
commit: 18586b8eef2dee0f432d7f57b642fa177aebc788 |
2 |
Author: Jason Zaman <jason <AT> perfinion <DOT> com> |
3 |
AuthorDate: Tue Jun 24 19:07:08 2014 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 24 21:50:07 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=18586b8e |
7 |
|
8 |
Correctly determine dst path if src is in a dir |
9 |
|
10 |
There is a mismatch between how install and install-xattr determines |
11 |
the destination path. |
12 |
|
13 |
When running `install src/a dst/' the correct output is `dst/a'. |
14 |
|
15 |
install-xattr was incorrectly joining the paths so thought the output |
16 |
was `dst/src/a' which did not exist. |
17 |
|
18 |
A test case has been added to the test script too. |
19 |
|
20 |
Signed-off-by: Jason Zaman <jason <AT> perfinion.com> |
21 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
22 |
|
23 |
--- |
24 |
misc/install-xattr/checkcopyattrs.sh | 11 ++++++++++- |
25 |
misc/install-xattr/install-xattr.c | 2 +- |
26 |
2 files changed, 11 insertions(+), 2 deletions(-) |
27 |
|
28 |
diff --git a/misc/install-xattr/checkcopyattrs.sh b/misc/install-xattr/checkcopyattrs.sh |
29 |
index 2e8f30f..0249013 100755 |
30 |
--- a/misc/install-xattr/checkcopyattrs.sh |
31 |
+++ b/misc/install-xattr/checkcopyattrs.sh |
32 |
@@ -2,7 +2,7 @@ |
33 |
set -e |
34 |
|
35 |
touch a b c |
36 |
-mkdir -p d e |
37 |
+mkdir -p d e f |
38 |
setfattr -n user.foo -v "bar" a |
39 |
setfattr -n user.bas -v "x" a |
40 |
setfattr -n user.pax.flags -v "mr" a |
41 |
@@ -27,6 +27,15 @@ setfattr -n user.pax.flags -v "r" c |
42 |
[ "$(getfattr --only-values -n user.pax.flags d/b)" == "p" ] |
43 |
[ "$(getfattr --only-values -n user.pax.flags d/c)" == "r" ] |
44 |
|
45 |
+# This tests if the src file was inside a directory |
46 |
+# the correct dst location should be f/a. NOT f/d/a. |
47 |
+./install-xattr d/a f |
48 |
+ |
49 |
+[ -x f/a ] |
50 |
+[ ! -x f/d/a ] |
51 |
+[ "$(getfattr --only-values -n user.foo f/a)" == "bar" ] |
52 |
+[ "$(getfattr --only-values -n user.bas f/a)" == "x" ] |
53 |
+ |
54 |
./install-xattr -t e a b c |
55 |
|
56 |
[ "$(getfattr --only-values -n user.foo e/a)" == "bar" ] |
57 |
|
58 |
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c |
59 |
index 3d70b5e..f2157fd 100644 |
60 |
--- a/misc/install-xattr/install-xattr.c |
61 |
+++ b/misc/install-xattr/install-xattr.c |
62 |
@@ -382,7 +382,7 @@ main(int argc, char* argv[]) |
63 |
if (S_ISDIR(s.st_mode)) |
64 |
continue; |
65 |
|
66 |
- path = path_join(target, argv[i]); |
67 |
+ path = path_join(target, basename(argv[i])); |
68 |
copyxattr(argv[i], path); |
69 |
free(path); |
70 |
} |