util-linux/libmount
Filipe Brandenburger 727c689908 libmount: Preserve empty string value in optstr parsing
Recent mount (since the switch to libmount in v2.22) drops the '=' in
mount options that are set to an empty value.  For example, the command
line below will be affected:

  # mount -o rw,myopt='' -t tmpfs tmpfs /mnt/tmp

Fix that by preserving an empty string in the options passed to the
mount(2) syscall when they are present on the command line.

Add test cases to ensure empty string handling is working as expected
and in order to prevent regressions in the future.

Also tested manually by stracing mount commands (on a kernel which
accepts a special extra option, for testing purposes.)

Before this commit:

  # strace -e mount ./mount -t tmpfs -o rw,myopt='' tmpfs /mnt/tmp
  mount("tmpfs", "/mnt/tmp", "tmpfs", MS_MGC_VAL, "myarg") = -1 EINVAL (Invalid argument)

After this commit:

  # strace -e mount ./mount -t tmpfs -o rw,myopt='' tmpfs /mnt/tmp
  mount("tmpfs", "/mnt/tmp", "tmpfs", MS_MGC_VAL, "myopt=") = 0

All test cases pass, including newly added test cases.  Also checked
them with valgrind using:

  $ tests/run.sh --memcheck libmount/optstr

Fixes #332.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2016-08-10 13:59:52 -07:00
..
docs libmount: add mnt_fs_set_priority() 2016-02-23 01:19:49 +01:00
python misc: Fix various typos 2016-05-31 23:40:21 +02:00
src libmount: Preserve empty string value in optstr parsing 2016-08-10 13:59:52 -07:00
COPYING COPYING: fix grammar of referring phrase, and indicate location better 2013-10-08 15:38:39 +02:00
Makemodule.am build-sys: add pylibmount 2013-08-19 14:57:21 +02:00
mount.pc.in build-sys: use top-level directory for libmount rather than shlibs/mount 2011-06-09 21:59:52 +02:00