Bug 1077817

Summary: virt-builder error: "syntax error at line 3: syntax error"
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, mbooth, ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-22 17:12:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Richard W.M. Jones 2014-03-18 16:00:14 UTC
Description of problem:

If you have a malformed /etc/virt-builder/repos.d/.. file,
then virt-builder spits out this error:

syntax error at line 3: syntax error

This should say that the error comes from virt-builder, and what
file is concerned, ie:

virt-builder: /etc/virt-builder/repos.d/foo.conf: syntax error at line 3: syntax error [ignored]

Currently the syntax error appears to be ignored, which seems
to be a good thing.

Also it'd be good to be able to comment out repos files (which
is what I was trying to do when I encountered this error).

Version-Release number of selected component (if applicable):

virt-builder 1.25.45

Comment 1 Pino Toscano 2014-03-20 18:51:42 UTC
(In reply to Richard W.M. Jones from comment #0)
> Description of problem:
> 
> If you have a malformed /etc/virt-builder/repos.d/.. file,
> then virt-builder spits out this error:
> 
> syntax error at line 3: syntax error
> 
> This should say that the error comes from virt-builder, and what
> file is concerned, ie:
> 
> virt-builder: /etc/virt-builder/repos.d/foo.conf: syntax error at line 3:
> syntax error [ignored]

This is (mostly) now done with the following commits:
https://github.com/libguestfs/libguestfs/commit/c871ed6b50e8e7fbfc2bd6cab2ceeaacd8449d71
https://github.com/libguestfs/libguestfs/commit/15f04f21b9acb6ab5b48bceb0898d5c5955647a5
https://github.com/libguestfs/libguestfs/commit/7c70429e2ed8652e865b6e4cc0cb77d54b775295
(all of them in libguestfs >= 1.25.46)

The only thing left is the [ignored] part, which is not yet shown.

> Also it'd be good to be able to comment out repos files (which
> is what I was trying to do when I encountered this error).

There are two override ways:
a) an already existing one: the group name ("[foo") in a "more local" .conf will take precedence over groups in other files
b) a newly introduced one: the file name of a "more local" .conf file will take precedence over any other .conf file (so you can put e.g. ~/.config/virt-builder/repos.d/foo.conf to override some existing foo.conf)

(b) has been implemented with commit
https://github.com/libguestfs/libguestfs/commit/e589b6e82336dec3abb6e2b1aea31313b7ec5172
which is part of libguestfs >= 1.25.47

Also, with commit
https://github.com/libguestfs/libguestfs/commit/603ad40c5ac034f22f3f2f682755a871d9e84267
(which is in libguestfs >= 1.25.47) files with no sections (so including empty files) are now properly handled as such.

Comment 2 Pino Toscano 2014-04-22 17:12:26 UTC
https://github.com/libguestfs/libguestfs/commit/e7c746854b27754807d3a61902c25325b18d525d
https://github.com/libguestfs/libguestfs/commit/4f5dc4afdc56483a29044d9d5498b5c764bcbc6a
add the [ignored] suffix for parsing errors of .conf files, available in libguestfs >= 1.27.7.

Thus, all the issues and notes in this bug have been fixed/addressed, so can be closed now.