Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 105641 - sys-apps/util-linux-2.12q-r1 - mount does not add an entry for / to /etc/mtab
Summary: sys-apps/util-linux-2.12q-r1 - mount does not add an entry for / to /etc/mtab
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-11 16:11 UTC by Friedrich Oslage (RETIRED)
Modified: 2005-09-14 18:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
util-linux-2.12q-update_mtab-fixes.patch (util-linux-2.12q-update_mtab-fixes.patch,2.18 KB, patch)
2005-09-14 02:03 UTC, Martin Schlemmer (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich Oslage (RETIRED) gentoo-dev 2005-09-11 16:11:00 UTC
When using mount version 2.12q-r1 / is not listed in /etc/mtab. So neighter the 
mount command shows it, nor df -ah does. Afer replacing mount-2.12q-r1 with 2.
12i it works fine.

Reproducible: Always
Steps to Reproduce:
1. emerge sys-apps/utils-linux-2.12q-r1
2. reboot
3. take a look at $(mount) output

Actual Results:  
/ is not listed in the output of the mount command

Expected Results:  
/ should be listet there

Portage 2.0.52-r1 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r1, 2.6.12-
ck6 i686)
=================================================================
System uname: 2.6.12-ck6 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz
Gentoo Base System version 1.12.0_pre8
dev-lang/python:     2.3.5, 2.4.1-r1
sys-apps/sandbox:    1.2.11
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer -mfpmath=sse,387 -ffast-
math -ftracer -maccumulate-outgoing-args -fforce-addr -falign-functions=4 -
fprefetch-loop-arrays"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/
share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /
usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer -mfpmath=sse,387 -
ffast-math -ftracer -maccumulate-outgoing-args -fforce-addr -falign-functions=4 
-fprefetch-loop-arrays"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
LANG="de_DE@euro"
LINGUAS="de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 X alsa apm avi berkdb bitmap-fonts bzip2 cdr crypt cups divx4linux dvd 
dvdread eds emboss encode fam ffmpeg foomaticdb fortran gdbm gif gnome gpm 
gstreamer gtk gtk2 icc icq imlib java javascript jpeg kde libg++ libwww mad 
mikmod mmx mmx2 mmxext motif mp3 mpeg ncurses nls nptlonly ogg oggvorbis opengl 
oss pam pdflib perl png python qt quicktime readline samba sdl spell sse sse2 
ssl tcpd tiff truetype truetype-fonts type1-fonts vorbis win32codecs xinerama 
xml2 xmms xv zlib linguas_de userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, PORTDIR_OVERLAY
Comment 1 SpanKY gentoo-dev 2005-09-11 21:39:26 UTC
it looks like mount/fstab.c:update_mtab() doesnt properly insert the absent
entry into the double linked list when using remount
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2005-09-13 07:09:27 UTC
Borked patch, fixed in -r2.
Comment 3 SpanKY gentoo-dev 2005-09-13 08:52:08 UTC
i dont think so ... the borked patch you mention is not borked

read the linked list code in fstab.c and you'll see that it is what is
triggering this bug
Comment 4 SpanKY gentoo-dev 2005-09-13 11:32:18 UTC
err, nm, i was confusing -n with -f ... that first hunk is wrong as you changed

however, the bug i mentioned still exists with the double linked list not being
updated properly
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2005-09-14 02:03:39 UTC
Created attachment 68434 [details, diff]
util-linux-2.12q-update_mtab-fixes.patch

Ugh, update_mtab() is one buggy wart.  This fixes a few issues with
update_mtab():
- If it is a remount, and only mnt_opts needs updating, mc->m.mnt_opts is set
to point to instead->mnt_opts, rather than allocating a new string, which would
cause a double free if the caller actually freed the passed mnt_opts, as we
free mc->m.mnt_opts before returning to the caller.
- Mostly the same issue as above.  If mtab does not contain the new entry, then
absent->m is set to point to instead, which would have cause a double free if
absent was inserted properly into the linked list, since we free all elements
of absent before returning to the caller.
- If mtab does not contain the new entry, then only mc0->prev is updated to
point to absent, but not the old mc0->prev's nxt pointer.  Because we then use
the nxt pointers to write the new mtab, absent is not added to the new mtab.
- If mtab is empty, absent->prev should be set to mc0, and not mc0->prev, as it
will be NULL.

I added it to util-linux-2.12q-r2, and did not rev bump, as you said in bug
#105805 that you will do it after you checked the other patches.

Also, it seems that 'mount -f -o remount' works as expected without that other
patch we talked about:

-----
lycan ~ # awk '$2 == "/" { print }' /etc/mtab
lycan ~ # mount -f /
lycan ~ # awk '$2 == "/" { print }' /etc/mtab
/dev/mapper/nsw1p2 / ext3 rw,noatime 0 0
lycan ~ # rm -f /etc/mtab
lycan ~ # awk '$2 == "/" { print }' /etc/mtab
awk: cmd. line:1: fatal: cannot open file `/etc/mtab' for reading (No such file
or directory)
lycan ~ # mount -f -o remount /
lycan ~ # awk '$2 == "/" { print }' /etc/mtab
/dev/mapper/nsw1p2 / ext3 rw,noatime 0 0
lycan ~ #
Comment 6 SpanKY gentoo-dev 2005-09-14 18:49:27 UTC
all should be resolved with 2.12q-r3