Bug 7868 - devtool: deploy-target follows symlinks when deploying
Summary: devtool: deploy-target follows symlinks when deploying
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 1.8
Hardware: All Multiple
: Medium+ major
Target Milestone: 1.9 M1
Assignee: Paul Eggleton
QA Contact: Costin
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-06-09 15:27 UTC by Paul Eggleton
Modified: 2015-10-15 09:44 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: New (Never tested)
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2015-06-09 15:27:26 UTC
devtool deploy-target uses scp -rp to deploy files to the target. Unfortunately it seems like this has the unfortunate behaviour of following symlinks, with the result that if for example one of the files being deployed is a symlink, you get the target of the symlink (which will probably be a file on the user's host system) deployed instead of the file itself. You can see this with mdadm - /usr/lib/mdadm/ptest/mdadm on the target will be a copy of /sbin/mdadm on the host instead of a symlink to /sbin/mdadm.

Apparently this behaviour of scp is by design, so we'll have to work around it. We could use tar + ssh as described here:

https://smaftoul.wordpress.com/2008/08/13/recursive-scp-and-symlinks/
Comment 1 Paul Eggleton 2015-06-18 11:02:28 UTC
Fix merged to master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2054b29dd7be74d09b53df178ef87c69b15a809e

This is probably a candidate for fido as well.
Comment 2 Costin 2015-10-15 09:44:08 UTC
Hello,

Tested on master with d302c98822efe2cb78a63b620aed1b94b4ed4a68 on Ubuntu 15.04 os.

Steps performed to test it:

1) follow the directions described in YP#8136 to create a recipe and package it
(used this because i had the environment already in place). Besides those directions, I modified the do_install step, by adding a symlink to a file on target:

do_install () {
        # Specify install commands here
        install -d ${D}/${bindir}
        install -m 0755 hellomake ${D}/${bindir}
        ln -s /usr/bin/awk ${D}/${bindir}/myawk
}

2) execute devtool deploy-target test root@test_machine:/home/root/teste
root@intel-core2-32:~/teste/usr/bin# ls -ltr
total 12
-rwxr-xr-x 1 root root 8632 Oct 15  2015 hellomake
lrwxrwxrwx 1 root root   12 May  4 21:42 myawk -> /usr/bin/awk

This proves the symlink was copied instead of the file (awk) that i also have on host machine

Marking as verified.