Richard W.M. Jones
2015-Nov-10 12:28 UTC
[Libguestfs] [PATCH] daemon: lvm: Change the separator character to ':'.
The separator character (currently comma) was picked arbitrarily to allow us to parse the output of commands like 'lvs' for APIs such as 'lvs-full'. Unfortunately the choice of comma conflicts with the 'lvs -o modules' column, since the list of modules is separated by commas, breaking our parser. Change the separator to another arbitrary character (colon) which hopefully is not used by any column. --- generator/daemon.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/daemon.ml b/generator/daemon.ml index a950c17..13ef350 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -561,7 +561,7 @@ cleanup_free_mountable (mountable_t *mountable) pr " fprintf (stderr, \"%%s: failed: string finished early, around token %%s\\n\", __func__, \"%s\");\n" name; pr " return -1;\n"; pr " }\n"; - pr " p = strchrnul (tok, ',');\n"; + pr " p = strchrnul (tok, ':');\n"; pr " if (*p) next = p+1; else next = NULL;\n"; pr " *p = '\\0';\n"; (match coltype with @@ -631,7 +631,7 @@ cleanup_free_mountable (mountable_t *mountable) pr " r = command (&out, &err,\n"; pr " \"lvm\", \"%ss\",\n" typ; pr " \"-o\", lvm_%s_cols, \"--unbuffered\", \"--noheadings\",\n" typ; - pr " \"--nosuffix\", \"--separator\", \",\", \"--units\", \"b\", NULL);\n"; + pr " \"--nosuffix\", \"--separator\", \":\", \"--units\", \"b\", NULL);\n"; pr " if (r == -1) {\n"; pr " reply_with_error (\"%%s\", err);\n"; pr " free (out);\n"; -- 2.5.0
Possibly Parallel Threads
- [PATCH] daemon: lvm: change the separator character to '\r'
- [PATCH 4/5] daemon: lvm: list PVs/VGs/LVs with --foreign
- [PATCH] static const char *str -> static const char str
- [PATCH] guestfish: Enable grouping in string lists
- [FOR REVIEW ONLY] guestfish: Enable grouping in string lists