diff --git a/gdb/cli/cli-option.c b/gdb/cli/cli-option.c
index 10a59449f7c..34ac1642b84 100644
--- a/gdb/cli/cli-option.c
+++ b/gdb/cli/cli-option.c
@@ -832,10 +832,10 @@ append_val_type_str (std::string &help, const option_def &opt,
       help += "NUMBER|#RRGGBB";
       break;
     case var_string:
-      help += "STRING";
+      help += " STRING";
       break;
     case var_filename:
-      help += "FILENAME";
+      help += " FILENAME";
       break;
     default:
       break;
diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
index e1ad61e6470..a1ca39eab11 100644
--- a/gdb/testsuite/gdb.base/options.exp
+++ b/gdb/testsuite/gdb.base/options.exp
@@ -1162,3 +1162,9 @@ test-thread-apply
 
 # Basic "info threads" integration tests.
 test-info-threads
+
+# There was a bug where the "metasyntactic variable" was glued to the
+# option.
+gdb_test "help maintenance test-options unknown-is-operand" \
+    "-string STRING.*-filename FILENAME.*" \
+    "option help has spaces"
