aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJason Zaman <jason@perfinion.com>2014-06-24 23:07:08 +0400
committerAnthony G. Basile <blueness@gentoo.org>2014-06-24 17:50:07 -0400
commit18586b8eef2dee0f432d7f57b642fa177aebc788 (patch)
tree7b22e234cb025afe7e1aaeaad51104fd062e41ec /misc
parentmisc/install-xattr: chdir to OLDPWD if we are wrapped by __PORTAGE_HELPER_PATH (diff)
downloadelfix-18586b8eef2dee0f432d7f57b642fa177aebc788.tar.gz
elfix-18586b8eef2dee0f432d7f57b642fa177aebc788.tar.bz2
elfix-18586b8eef2dee0f432d7f57b642fa177aebc788.zip
Correctly determine dst path if src is in a dir
There is a mismatch between how install and install-xattr determines the destination path. When running `install src/a dst/' the correct output is `dst/a'. install-xattr was incorrectly joining the paths so thought the output was `dst/src/a' which did not exist. A test case has been added to the test script too. Signed-off-by: Jason Zaman <jason@perfinion.com> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/install-xattr/checkcopyattrs.sh11
-rw-r--r--misc/install-xattr/install-xattr.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/misc/install-xattr/checkcopyattrs.sh b/misc/install-xattr/checkcopyattrs.sh
index 2e8f30f..0249013 100755
--- a/misc/install-xattr/checkcopyattrs.sh
+++ b/misc/install-xattr/checkcopyattrs.sh
@@ -2,7 +2,7 @@
set -e
touch a b c
-mkdir -p d e
+mkdir -p d e f
setfattr -n user.foo -v "bar" a
setfattr -n user.bas -v "x" a
setfattr -n user.pax.flags -v "mr" a
@@ -27,6 +27,15 @@ setfattr -n user.pax.flags -v "r" c
[ "$(getfattr --only-values -n user.pax.flags d/b)" == "p" ]
[ "$(getfattr --only-values -n user.pax.flags d/c)" == "r" ]
+# This tests if the src file was inside a directory
+# the correct dst location should be f/a. NOT f/d/a.
+./install-xattr d/a f
+
+[ -x f/a ]
+[ ! -x f/d/a ]
+[ "$(getfattr --only-values -n user.foo f/a)" == "bar" ]
+[ "$(getfattr --only-values -n user.bas f/a)" == "x" ]
+
./install-xattr -t e a b c
[ "$(getfattr --only-values -n user.foo e/a)" == "bar" ]
diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 3d70b5e..f2157fd 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -382,7 +382,7 @@ main(int argc, char* argv[])
if (S_ISDIR(s.st_mode))
continue;
- path = path_join(target, argv[i]);
+ path = path_join(target, basename(argv[i]));
copyxattr(argv[i], path);
free(path);
}