Subject: Re: trailing / in fstab breaks mount
To: Nino Dehne <TeCeEm@gmx.de>
From: mouss <usebsd@free.fr>
List: tech-userlevel
Date: 06/04/2003 12:22:02
This is because getfsfile() ($ROOT/src/lib/libc/gen/fstab.h) uses "dumb" string
comparison:
     if (!strcmp(_fs_fstab.fs_file, name)))
so "/var" and "/var/" won't match.
The same problem exists in getfsspec().

One way to fix the problem is compare after removing trailing all slashes
from the variables: name, _fs_fstab.fs_file and _fs_fstab.fs_spec.
So instead of using strcmp(), we would use a new function, say pathcmp(),
that compares canonical versions of its arguments.

any opinions?

At 02:31 31/05/2003 +0200, Nino Dehne wrote:

>It turned out I had to 1) remove my trailing slash in fstab:
>
>    /dev/wd0e   /var/   ffs   rw,softdep   0   2
>                    ^
>    /dev/wd0f   /usr/   ffs   rw,softdep   0   2
>
>or add to /etc/rc.conf:
>
>    critical_filesystems_local="/var/"
>    critical_filesystems_remote="/usr/"
>
>The actual problem is not with the rc.d scripts mountcritlocal and 
>mountcritremote I think but rather with mount(8) itself not accepting
>
>    mount /var
>
>if fstab contains
>
>    /dev/wd0e   /var/   ffs   rw,softdep   0   2