[pacman-dev] [PATCH 2/3] log invalid conf settings as an error

Eli Schwartz eschwartz at archlinux.org
Sun May 10 08:22:04 UTC 2020

On 5/10/20 4:09 AM, Allan McRae wrote:
> On 10/5/20 2:32 pm, Eli Schwartz wrote:
>> This is not a warning, _parse_options() returns failure without even
>> parsing further lines and the attempted pacman/pacman-conf program
>> execution immediately aborts. Warnings are for when e.g. later on if we
>> don't recognize a setting at all, we skip over it and have enough
>> confidence in this to continue executing the program.
>> The current implementation results in pacman-conf aborting with:
>> warning: config file /etc/pacman.conf, line 60: invalid value for 'ParallelDownloads' : '2.5'
>> error parsing '/etc/pacman.conf'
>> or pacman -Syu aborting with the entirely more cryptic:
>> warning: config file /etc/pacman.conf, line 59: invalid value for 'ParallelDownloads' : '2.5'
>> and this isn't just a problem for the newly added ParallelDownloads
>> setting, either, you could get the same problem if you specified a
>> broken XferCommand, but that's harder as it's more accepting of input
>> and you probably don't hit this except with unbalanced quotes.
> Is this the fix we want?  I think it would be better to get to the end
> of parsing the conf file spitting errors as we go so that all issues are
> printed before exiting.
> Allan

Maybe? All I have done thus far is change the log level. To collect
multiple errors I guess we'd need to stop aborting in ini.c:parse_ini
the first time one callback returns an error.

It's currently documented with:

@note Parsing will immediately stop if the callback returns non-zero.

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20200510/3baff41d/attachment.sig>

More information about the pacman-dev mailing list