Package: schroot
Version: 1.1.6-1
Severity: normal
Tags: patch
First, the new mount helper is great. I've finally had a chance to play
with it. However, I noticed that unlike the original 10mount "do_mount"
function, it does not create target mount point directories, which
results in:
I: Executing '/bin/mount -v -t none -o rw,bind /scratch
/var/lib/schroot/mount/edgy-4bbec1fc-044d-4ec0-9613-c783e4c04f5f/scratch'
mount: mount point
/var/lib/schroot/mount/edgy-4bbec1fc-044d-4ec0-9613-c783e4c04f5f/scratch does
not exist
(This used to work when I used a modified 10mount that just made extra
calls to do_mount.)
I've attempted a boosty solution, which is attached (though it requires
that libboost-filesystem-dev be added to the Build-Depends). Note this is my
first use of boost -- pardon any ugliness. ;)
--
Kees Cook @outflux.net
--- schroot-1.1.6.orig/configure.ac
+++ schroot-1.1.6/configure.ac
@@ -277,6 +277,17 @@
AC_MSG_FAILURE([libboost_regex (Boost C++ Libraries) is not installed, but is required by schroot])])
LDFLAGS="${saved_ldflags}"
+AC_MSG_CHECKING([for boost::filesystem in -lboost_filesystem])
+saved_ldflags="${LDFLAGS}"
+LDFLAGS="${LDFLAGS} -lboost_filesystem"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/filesystem.hpp>],
+ [boost::filesystem::is_directory("/")])],
+ [AC_MSG_RESULT([yes])
+ BOOST_LIBS="${BOOST_LIBS} -lboost_filesystem"],
+ [AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([libboost_filesystem (Boost C++ Libraries) is not installed, but is required by schroot])])
+LDFLAGS="${saved_ldflags}"
+
AC_SUBST([BOOST_LIBS])
AC_MSG_CHECKING([__gnu_cxx::stdio_filebuf construction semantics])
--- schroot-1.1.6.orig/bin/schroot-mount/schroot-mount-main.cc
+++ schroot-1.1.6/bin/schroot-mount/schroot-mount-main.cc
@@ -35,6 +35,7 @@
#include <unistd.h>
#include <boost/format.hpp>
+#include <boost/filesystem.hpp>
#include <mntent.h>
@@ -104,6 +105,34 @@
std::string directory(opts->mountpoint + entry.directory);
+ if ( !boost::filesystem::is_directory(directory) )
+ {
+ sbuild::log_debug(sbuild::DEBUG_INFO)
+ << boost::format("Creating '%1%' in '%2%'")
+ % entry.directory
+ % opts->mountpoint
+ << std::endl;
+
+ if (!opts->dry_run)
+ {
+ try
+ {
+ boost::filesystem::create_directory(directory);
+ }
+ catch (std::exception const& e)
+ {
+ sbuild::log_exception_error(e);
+ exit(EXIT_FAILURE);
+ }
+ catch (...)
+ {
+ sbuild::log_error()
+ << _("An unknown exception occurred") << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
+
sbuild::log_debug(sbuild::DEBUG_INFO)
<< boost::format("Mounting '%1%' on '%2%'")
% entry.filesystem_name