[buildd-tools-devel] Bug#691694: Bug#691694: schroot: /var/lib/schroot/ cannot be a symlink

Roger Leigh rleigh at codelibre.net
Mon Oct 29 09:48:09 UTC 2012


On Sun, Oct 28, 2012 at 07:52:24PM +0100, Jakub Wilk wrote:
> An (unintended, I hope) consequence of symlinks mount point
> canonicalisation is that /var/lib/schroot cannot be a symlink
> anymore. In my setup, /var/lib/chroot was a symlink to
> /srv/chroots/meta. This made schroot mount devices in very wrong
> places:
> 
> I: 10mount: /home on /srv/chroots/meta/mount/unstable-i386-2f2404c2-8d99-46a1-b686-8c4f16565f13/srv/chroots/meta/mount/unstable-i386-2f2404c2-8d99-46a1-b686-8c4f16565f13/home type none (rw,bind)

This is indeed unintended, and is due to this logic
from bin/schroot-mount/schroot-mount-main.cc:

  if (directory.size() < opts->mountpoint.size() ||
      directory.substr(0,opts->mountpoint.size()) != opts->mountpoint)
    directory = opts->mountpoint + directory;

We compare the normalised path to the mount directory before
prepending it.  We need to normalise the mount directory as
well to take into account making it a symlink as you have done
here; currently the code makes the (bad) assumption that this
will not contain symlinks.  The solution is just to add a second
realpath(3) call before the comparison to normalise that path
as well.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800



More information about the Buildd-tools-devel mailing list