On Tue, Aug 08, 2017 at 06:57:46PM +0200, Pino Toscano wrote:
TBH, since both parse_os_release and parse_lsb_release are rewritten
in OCaml, I'd try a better approach for them: add an helper function
that read such kind of files (ignoring empty lines, and those starting
with '#'), split them in lines, and map the lines into (key, value)
pairs, also un-quoting the value. It would not map 1:1 the C
implementations, but in OCaml it would be so much easier than in C
(and that is basically what I'd have liked to do in the first place
when implementing parse_os_release, but it'd have been so much memory
waste).
Just a comment on this: I wanted this patch series to remain quite
close to the original code -- ie. easy to review, also fewer new bugs.
However I agree we certainly should improve functions like this,
although perhaps not in this series?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/