context: Forbid --filesystem=/

Making it an equivalent of --filesystem=host would be misleading,
because it wouldn't do what you'd think it does: host mounts some host
system directories in their usual places, but others below /run/host.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 02094b4f39)
This commit is contained in:
Simon McVittie
2020-08-27 15:58:47 +01:00
committed by Alexander Larsson
parent 7eeefa43b1
commit ceea3cefad
2 changed files with 14 additions and 0 deletions

View File

@@ -802,6 +802,17 @@ flatpak_context_parse_filesystem (const char *filesystem_and_mode,
else
break;
}
if (filesystem[0] == '/' && filesystem[1] == '\0')
{
/* We don't allow --filesystem=/ as equivalent to host, because
* it doesn't do what you'd think: --filesystem=host mounts some
* host directories in /run/host, not in the root. */
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
_("--filesystem=/ is not available, "
"use --filesystem=host for a similar result"));
return FALSE;
}
}
if (g_strv_contains (flatpak_context_special_filesystems, filesystem) ||

View File

@@ -241,11 +241,14 @@ typedef struct
static const NotFilesystem not_filesystems[] =
{
{ "", G_OPTION_ERROR_FAILED },
{ "homework", G_OPTION_ERROR_FAILED },
{ "xdg-download/foo/bar/..", G_OPTION_ERROR_BAD_VALUE },
{ "xdg-download/../foo/bar", G_OPTION_ERROR_BAD_VALUE },
{ "xdg-download/foo/../bar", G_OPTION_ERROR_BAD_VALUE },
{ "xdg-run", G_OPTION_ERROR_FAILED },
{ "/", G_OPTION_ERROR_BAD_VALUE },
{ "/////././././././//////", G_OPTION_ERROR_BAD_VALUE },
};
typedef struct