Re: [PATCH v2] virconf: Handle conf file without ending newline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/21/2016 11:15 AM, Cole Robinson wrote:
> $ echo -n 'log_level=1' > ~/.config/libvirt/libvirtd.conf
> $ libvirtd --timeout=10
> 2014-10-10 10:30:56.394+0000: 6626: info : libvirt version: 1.1.3.6, package: 1.fc20 (Fedora Project, 2014-09-08-17:50:42, buildvm-05.phx2.fedoraproject.org)
> 2014-10-10 10:30:56.394+0000: 6626: error : main:1261 : Can't load config file: configuration file syntax error: /home/rjones/.config/libvirt/libvirtd.conf:1: expecting a value: /home/rjones/.config/libvirt/libvirtd.conf
> 
> Rather than try to fix this in the depths of the parser, just catch
> the case when a config file doesn't end in a newline, and manually
> append a newline to the content before parsing
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1151409
> ---
> v2:
>     Properly NULL deliminate string (thanks pkrempa)
>     Hey, there's a virconf test suite. Add a new test case
> 

Also needs this diff to fix syntax-check:

diff --git a/cfg.mk b/cfg.mk
index 16da2b3..09ff9fa 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1179,7 +1179,7 @@ exclude_file_name_regexp--sc_prohibit_close = \

(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/virfile\.c|src/libvirt-stream\.c|tests/vir.+mock\.c)$$)

 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
-  (^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff$$)
+
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff|tests/confdata/no-newline\.conf$$)

 _src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon)
 exclude_file_name_regexp--sc_prohibit_fork_wrappers = \

- Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]