mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
inspection: Unquote UUID=.. or LABEL=.. before passing to findfs (RHBZ#1335671).
In /etc/fstab the UUID= or LABEL= field may be quoted. Augeas returns the field including the quotes, and we passed this directly to guestfs_findfs_uuid or guestfs_findfs_label. It happens that this works on upstream findfs, although it doesn't work in RHEL 7.2. The correct thing to do is to remove the quotes before passing the UUID or label to these functions. Thanks: Thom Carlin for reporting the bug, Karel Zak for identifying the change in behaviour in util-linux.
This commit is contained in:
@@ -1343,10 +1343,16 @@ check_fstab (guestfs_h *g, struct inspect_fs *fs)
|
||||
continue;
|
||||
|
||||
/* Resolve UUID= and LABEL= to the actual device. */
|
||||
if (STRPREFIX (spec, "UUID="))
|
||||
mountable = guestfs_findfs_uuid (g, &spec[5]);
|
||||
else if (STRPREFIX (spec, "LABEL="))
|
||||
mountable = guestfs_findfs_label (g, &spec[6]);
|
||||
if (STRPREFIX (spec, "UUID=")) {
|
||||
CLEANUP_FREE char *s = guestfs_int_shell_unquote (&spec[5]);
|
||||
if (s == NULL) { perrorf (g, "guestfs_int_shell_unquote"); return -1; }
|
||||
mountable = guestfs_findfs_uuid (g, s);
|
||||
}
|
||||
else if (STRPREFIX (spec, "LABEL=")) {
|
||||
CLEANUP_FREE char *s = guestfs_int_shell_unquote (&spec[6]);
|
||||
if (s == NULL) { perrorf (g, "guestfs_int_shell_unquote"); return -1; }
|
||||
mountable = guestfs_findfs_label (g, s);
|
||||
}
|
||||
/* Ignore "/.swap" (Pardus) and pseudo-devices like "tmpfs". */
|
||||
else if (STREQ (spec, "/dev/root") || (is_bsd && STREQ (mp, "/")))
|
||||
/* Resolve /dev/root to the current device.
|
||||
|
||||
Reference in New Issue
Block a user