Comment 6 for bug 1070008

Revision history for this message
Roger Leigh (rleigh) wrote :

We do in fact already take steps to ensure we don't call this when using LVM snapshots to avoid the exact issue that you've reported. However, it looks like in your case this is not working. As you can see, set_mount_device should be called for all chroot types /except/ lvm-snapshot (where the dynamic_cast<> will fail)...

sbuild::chroot_block_device_base::set_device():

  /// @todo: This may not be appropriate for derived classes such as
  /// lvm_snapshot, since re-setting the device could overwrite the
  /// mount device.
  chroot_facet_mountable::ptr pmnt
    (get_facet<chroot_facet_mountable>());
#ifdef SBUILD_FEATURE_LVMSNAP
  if (!dynamic_cast<chroot_lvm_snapshot *>(this))
#endif
    pmnt->set_mount_device(this->device);

and preprocessed:

void
chroot_block_device_base::set_device (std::string const& device)
{
  if (!is_absname(device))
    throw error(device, DEVICE_ABS);

  this->device = device;

  chroot_facet_mountable::ptr pmnt
    (get_facet<chroot_facet_mountable>());

  if (!dynamic_cast<chroot_lvm_snapshot *>(this))

    pmnt->set_mount_device(this->device);
}