From 6d1d9724c5b30c680e5eefe05f5ddf7b15fdc92e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 27 May 2016 00:05:55 -0400 Subject: [PATCH 1/2] builder: Warn about bad module names Putting spaces or slashes in module names is a recipe for cryptic error from one of the many constructed flatpak commandlines. Better warn early on, as soon as we see such a name. --- builder/builder-module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder/builder-module.c b/builder/builder-module.c index 8b0dad02..fffcc8bb 100644 --- a/builder/builder-module.c +++ b/builder/builder-module.c @@ -199,12 +199,16 @@ builder_module_set_property (GObject *object, { BuilderModule *self = BUILDER_MODULE (object); gchar **tmp; + char *p; switch (prop_id) { case PROP_NAME: g_clear_pointer (&self->name, g_free); self->name = g_value_dup_string (value); + if ((p = strchr (self->name, ' ')) || + (p = strchr (self->name, '/'))) + g_printerr ("Module names like '%s' containing '%c' are problematic. Expect errors.\n", self->name, *p); break; case PROP_SUBDIR: From c129fb71555005832f23484b313757c4dec3395c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 27 May 2016 00:42:37 -0400 Subject: [PATCH 2/2] Document restrictions on module names --- doc/flatpak-builder.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/flatpak-builder.xml b/doc/flatpak-builder.xml index eb2858ae..f72ef0b0 100644 --- a/doc/flatpak-builder.xml +++ b/doc/flatpak-builder.xml @@ -282,7 +282,7 @@ (string) - The name of the module, used in e.g. build logs + The name of the module, used in e.g. build logs. The name is also used for constructing filenames and commandline arguments, therefore using spaces or '/' in this string is a bad idea. (boolean)