Bug 117687 - [patch] fstab(5) format cannot handle spaces
Summary: [patch] fstab(5) format cannot handle spaces
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.3-PRERELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Stefan Farfeleder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-30 19:20 UTC by Martin Kammerhofer
Modified: 2015-01-17 08:56 UTC (History)
0 users

See Also:
bugmeister: mfc-stable10?
bugmeister: mfc-stable9?
bugmeister: mfc-stable8?


Attachments
file.diff (2.23 KB, patch)
2007-10-30 19:20 UTC, Martin Kammerhofer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Kammerhofer 2007-10-30 19:20:00 UTC
Fields in /etc/fstab are separated with spaces and/or TAB characters.
No quoting/escaping mechanism is defined, therefore fields cannot
contain embedded SP or TAB characters.  This is very rarely a problem
but can become a nuisance in dual boot configurations where access to
NTFS and/or VFAT partitions is needed.

The first fstab(5) field (special device name) can contain embedded
spaces when GEOM_LABEL is used.  It is not unusual to name logical
partitions like e.g. "BART'S PICTURES" or "MY MOVIES".  Using
glabel(8) these would result in special devices named like
/dev/msdosfs/BART\'S\ PICTURES and /dev/ntfs/MY\ MOVIES.

Since path names can contain spaces there is obviously a possibility
that a mount point directory's path contains white space.

When all setup/configuration is done manually, one can work around the
cases above by restricting oneself to disk labels and mount paths
without white space.  However why impose that restriction when it can
be lifted trivially with five added lines of code?  And what about the
cases where /etc/fstab is auto-generated by say an installer program
or the auto-configuration script of a live CD/DVD?

Compatibility note: Escaping space as \040 is compatible with Linux's
fstab(5).  Backward compatibility should be no problem, except for the
extremely unlikely case of an existing /etc/fstab which contains a
*literal* pattern of \^C, \M-C, \M^C or \577 (cf. vis(3)).

Fix: Patch below is against RELENG_6 but differences to -current are
minimal.  Manpage patch also removes references to block devices.
They are gone for about 8 years now.
Comment 1 Gavin Atkinson freebsd_committer freebsd_triage 2008-06-21 20:15:17 UTC
See also PRs 37569 and 55539 for other solutions to this issue.
Comment 2 Stefan Farfeleder freebsd_committer freebsd_triage 2012-10-11 12:46:42 UTC
State Changed
From-To: open->patched

Grab and mark patched in head. 


Comment 3 Stefan Farfeleder freebsd_committer freebsd_triage 2012-10-11 12:46:42 UTC
Responsible Changed
From-To: freebsd-bugs->stefanf

Grab and mark patched in head.
Comment 4 Stefan Farfeleder freebsd_committer freebsd_triage 2015-01-17 08:56:38 UTC
Fixed in 9, 10 and head.