Bug#408617: [Buildd-tools-devel] Bug#408617: listmount segfaults

Roger Leigh rleigh at whinlatter.ukfsn.org
Sat Jan 27 14:08:50 CET 2007


tags 408617 + patch pending
thanks

Reinhard Tartler <siretart at tauware.de> writes:

> I'm using schroot on ubuntu feisty (unmodified source package 1.0.4-1),
> and get a segfault from schroot-listmounts every time I'm using schroot.
>
> I'm attaching the stacktraces obtained by apport. Please note that
> ubuntu already uses glibc 2.5, which can be found in debian/experimental
> as well. 
>
> Please tell me how I can give better diagnostics.

Those are just fine, thanks.  The following patch should fix the bug,
introduced while fixing #401180.

However, this should only be triggered if the path does not exist.  In
the trace

  Core was generated by `/usr/lib/schroot/schroot-listmounts -m
  /var/lib/schroot/mount/feisty-067979f7-c'

the UUID is truncated, and that's not right.  Could you possibly take
a look at that.  It's invoked by do_umount_all() in
/etc/schroot/setup.d/10mount.  i.e. 'do_umount_all
"$CHROOT_MOUNT_LOCATION"', where $CHROOT_MOUNT_LOCATION should be the
full path to the chroot, but in your case looks funny.  Just adding a
line to echo this variable to stdout should be sufficient to check.


Index: schroot/schroot-listmounts-main.cc
===================================================================
--- schroot/schroot-listmounts-main.cc	(revision 1066)
+++ schroot/schroot-listmounts-main.cc	(working copy)
@@ -55,6 +55,8 @@
   emap init_errors[] =
     {
       // TRANSLATORS: %1% = file
+      emap(main::FIND,  N_("Failed to find '%1%'")),
+      // TRANSLATORS: %1% = file
       emap(main::OPEN,  N_("Failed to open '%1%'")),
       // TRANSLATORS: %1% = file
       emap(main::CLOSE, N_("Failed to close '%1%'"))
@@ -91,6 +93,9 @@
 
   // NOTE: This is a non-standard GNU extension.
   char *rpath = realpath(to_find.c_str(), NULL);
+  if (rpath == 0)
+    throw error(to_find, FIND, strerror(errno));
+
   to_find = rpath;
   free(rpath);
   rpath = 0;
Index: schroot/schroot-listmounts-main.h
===================================================================
--- schroot/schroot-listmounts-main.h	(revision 1066)
+++ schroot/schroot-listmounts-main.h	(working copy)
@@ -37,6 +37,7 @@
     /// Error codes.
     enum error_code
       {
+	FIND, ///< Failed to find file.
 	OPEN, ///< Failed to open file.
 	CLOSE ///< Failed to close file.
       };


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20070127/91081f06/attachment.pgp


More information about the Buildd-tools-devel mailing list