]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: add missing utab options after helper call
authorKarel Zak <kzak@redhat.com>
Wed, 29 Nov 2023 11:37:52 +0000 (12:37 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 29 Nov 2023 12:34:23 +0000 (13:34 +0100)
commit477401f0de404aafbc7630f70c2f8b1d670e32f8
treea8a5a4c8a8d2ff1813bf82ba068f417309e9c49b
parent722e4d47a9a21f09a6a719a0f510f29f12497ce5
libmount: add missing utab options after helper call

libmount is able to add missing entry to /run/mount/utab after
external /sbin/mouht.<type> helper execution. This is not enough, it's
possible that the helper write proper entry to the utab, but there is
missing some options expected by libmount (usually because the options
are irrelevant fro the helper.

Reproducer:

 Create a stupid mount.foo which writes x-foo=123 to utab:

   # echo -e '#!/bin/bash\n\n/bin/mount -i "$1" "$2" -o x-foo=123' > /sbin/mount.foo
   # chmod +x /sbin/mount.foo

 Run mount which needs to write x-bar=BAR options to utab and executes
 the helper (due to "-t foo", /dev/sdc1 is ext4):

   # mount -t foo /dev/sdc1 /mnt/test -o x-bar=BAR

 old mount:

   # cat /run/mount/utab
   ID=121 SRC=/dev/sdc1 TARGET=/mnt/test ROOT=/ OPTS=x-foo=123

 fixed mount:

   # cat /run/mount/utab
   ID=121 SRC=/dev/sdc1 TARGET=/mnt/test ROOT=/ OPTS=x-foo=123,x-bar=BAR

Fixes: https://github.com/util-linux/util-linux/issues/2554
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab_update.c