[libvirt] [PATCH 2/2] qemu: fixing internationalization problem with sched kernel entry.

In qemuGetSchedInfo(), libvirt is trying to parse some field of /proc/*/sched. Some fields are floating point numbers and their separator is always a dot. When you change the locale of the system, you can change the mantissa separator (to a comma separator) of floating point numbers and it affects the parser. This commit introduces the virStrToDoubleSafe() to avoid comma as a separator. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457634 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457481 Signed-off-by: Julio Faracco <jcfaracco@gmail.com> --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ba1dba5..f1b104f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1369,7 +1369,7 @@ qemuGetSchedInfo(unsigned long long *cpuWait, while (*line == ' ') line++; - if (virStrToDouble(line, NULL, &val) < 0) { + if (virStrToDoubleSafe(line, NULL, &val) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unable to parse sched info value '%s'"), line); -- 2.7.4

On 06/14/2017 12:25 PM, Julio Faracco wrote:
In qemuGetSchedInfo(), libvirt is trying to parse some field of /proc/*/sched. Some fields are floating point numbers and their separator is always a dot. When you change the locale of the system, you can change the mantissa separator (to a comma separator) of floating point numbers and it affects the parser.
This commit introduces the virStrToDoubleSafe() to avoid comma as a separator.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457634 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457481
Signed-off-by: Julio Faracco <jcfaracco@gmail.com> --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
FWIW: Since you'll have to post a v2 anyway due to 1/2 NACK, may I suggest checking out the very recent on-list discussion about sending patches using --cover-letter for multiple patch series from the hacking page: https://www.redhat.com/archives/libvir-list/2017-June/msg00638.html and the hacking guidelines: http://libvirt.org/hacking.html Keeping "related" patches threaded is helpful for reviewers and doesn't leave a stray on the list... Tks - John
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ba1dba5..f1b104f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1369,7 +1369,7 @@ qemuGetSchedInfo(unsigned long long *cpuWait, while (*line == ' ') line++;
- if (virStrToDouble(line, NULL, &val) < 0) { + if (virStrToDoubleSafe(line, NULL, &val) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unable to parse sched info value '%s'"), line);
participants (2)
-
John Ferlan
-
Julio Faracco