[CRIU] [RFC PATCH 01/21] zdtm: zdtm.py: elaborate file copying logic for ns tests

Pavel Emelyanov xemul at virtuozzo.com
Wed Mar 9 02:18:13 PST 2016


On 02/26/2016 01:27 AM, Ivan Shapovalov wrote:
> On 2016-02-25 at 12:01 -0800, Andrew Vagin wrote:
>> On Fri, Feb 19, 2016 at 05:50:24PM +0300, Ivan Shapovalov wrote:
>>>
>>> From: Ivan Shapovalov <intelfx100 at gmail.com>
>>>
>>> When copying files (tests' deps and supplementary binaries) to the
>>> "chroot",
>>> do not blindly copy them using provided pathes (like
>>> "/sbin/iptables").
>>> Instead, walk the path manually and replicate all encountered
>>> symlinks in
>>> the "chroot".
>>>
>>> This helps to support setups like Arch, where /{,s}bin are links to
>>> /usr/bin,
>>> and only /usr/bin is in $PATH.
>> Why is it not enough to call os.path.realpath?
> 
> Consider the following example:
> 
> - /bin, /sbin are symlinks to /usr/bin
> - /usr/bin/iptables is a symlink to xtables-multi
> - $PATH is /usr/bin (just this one directory)
> - test says /sbin/iptables in deps

And we'll copy /sbin/iptables to /sbin/iptables and will get
the binary in test fake root. If the problem is only in $PATH,
maybe it's worth fixing _it_?

> Just realpath will copy /usr/bin/xtables-multi and there will be no
> iptables at all.
> 
> realpath plus naïve symlink will copy /usr/bin/xtables-multi and make
> /sbin/iptables a link to it, and iptables will be missing from $PATH.
> 
> 
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> 



More information about the CRIU mailing list