https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291027

            Bug ID: 291027
           Summary: mount(8) may produce invalid fstab(5) output
           Product: Base System
           Version: 14.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 265421
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=265421&action=edit
Suggested fix

Background:

fstab(5) expects the first two fields (fs_spec and fs_file i.e. the device and
the mountpoint) to escape spaces and tabs. The contents of these two fields are
decoded using strunvis(3).

Problem:

When calling mount(8) with -p (to print mount information in fstab(5) format),
spaces and tabs in the first two fields are not escaped and can thus not be
distinguished from field separators.

Solution:

Use vis(3) to encode the first two fields when producing output in fstab(5)
format (i.e. when called with -p).

How to reproduce:

  # zfs create 'tank/test with spaces'
  # mount -p
  zroot/test with spaces  /zroot/test with spaces zfs     rw,noatime,nfsv4acls 
  0 0

Expected:

  # zfs create 'tank/test with spaces'
  # mount -p
  tank/test\swith\sspaces /zroot/test\swith\sspaces zfs  rw,noatime,nfsv4acls  
 0 0

Please see the attached diff for a possible fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to