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

Ivan Shapovalov intelfx at intelfx.name
Wed Mar 9 03:33:14 PST 2016


On 2016-03-09 at 13:18 +0300, Pavel Emelyanov wrote:
> 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_?

Can't something break if an executable is moved to a different prefix?

(I agree that my patch is way too overcomplicated. If simply force-
setting $PATH to something like /sbin:/bin:/usr/sbin:/usr/bin is OK,
then I'll happily drop this patch and do that instead.)

--
Ivan Shapovalov / intelfx /

> 
> > 
> > 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
> > 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openvz.org/pipermail/criu/attachments/20160309/22ccbde2/attachment.sig>


More information about the CRIU mailing list