Package: mount Version: 2.13.1.1-1 Severity: important Tags: patch Hi, I'm setting this as important since it breaks deboostrap/d-i under (though rare) conditions. Patch attached. The problem occurs like this:
mkdir -p target/etc cat <<EOF >target/etc/fstab # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 LABEL=root / ext3 defaults,errors=remount-ro 0 1 LABEL=var /var ext3 defaults 0 2 EOF debootstrap sid target/ http://ftp2.de.debian.org/debian What happens is that deboostrap at one point runs: chroot /target mount -t proc proc /proc Since there's no /etc/mtab in the target yet it tries to create one with with "/" as entry. However since we have a labeled mount for "/" libblkid is called to figure out the device node but it can't. Therefore it returns zero which lets my_addmntent barf. The attached patch simply pampers over this failure since there isn't much that we can do about it - and it doesn't hurt much since we can add "/" to /etc/mtab at the next boot. -- Guido
>From 698ebf467906b7677add6259474a10dcea59c933 Mon Sep 17 00:00:00 2001 From: Guido Guenther <[EMAIL PROTECTED]> Date: Fri, 27 Jun 2008 19:17:58 +0200 Subject: [PATCH] create_mtab: Don't segfault when the fsname cannot be determined this can haben when /root a labeled mount and blkid cannot dertermine the label. E.g. just after d-i doing a debootstrap wich calls: mount -t proc proc /proc If /target/etc/fstab has a labeled mount we would otherwise segfault here. --- mount/mount.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mount/mount.c b/mount/mount.c index 63df235..eb9cf01 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -556,10 +556,12 @@ create_mtab (void) { mnt.mnt_freq = mnt.mnt_passno = 0; my_free(extra_opts); - if (my_addmntent (mfp, &mnt) == 1) { - int errsv = errno; - die (EX_FILEIO, _("mount: error writing %s: %s"), - MOUNTED, strerror (errsv)); + if (mnt.mnt_fsname) { + if (my_addmntent (mfp, &mnt) == 1) { + int errsv = errno; + die (EX_FILEIO, _("mount: error writing %s: %s"), + MOUNTED, strerror (errsv)); + } } } if (fchmod (fileno (mfp->mntent_fp), 0644) < 0) -- 1.5.5.1