Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#47924 - [namcap] [pyalpm] namcap could not parse included configs

Attached to Project: Arch Linux
Opened by Evgeniy Alexeev (arcan1s) - Thursday, 28 January 2016, 13:24 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 26 February 2018, 04:32 GMT
Task Type Bug Report
Category Arch Projects
Status Assigned
Assigned To Rémy Oudompheng (remyoudompheng)
Jelle van der Waa (jelly)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No



I have the following pacman.conf:

Where pacaur.conf contains common pacman settings for several configurations. According to the pacman man page my syntax is correct and include statement may be used not only to include server url (as usually it is used). Moreover I don't have any problems when works with pacman in usual way. But running namcap says:

pycman.config.InvalidSyntax: unable to parse /etc/pacman.conf, statement outside of a section: 'Include = /etc/pacaur.conf'

Additional info:
* nacmap-3.2.6-1
* /etc/pacman.conf:

Steps to reproduce:
1. Split /etc/pacman.conf to two (or more files).
2. Set Include = /path/to/another/pacman/config at the beginning of /etc/pacman.conf
3. Run namcap, e.g. namcap -h
This task depends upon

Comment by Michael (MST) - Thursday, 23 June 2016, 18:35 GMT
Is this still an issue with pyalpm-8.0? Looking at the git history [1] I think there were no relevant changes in pycman/ since this was opened, but I can not reproduce it.
For example running 'namcap -h' using the following pacman.conf works just fine. (original /etc/pacman.conf copied to /etc/pacman.conf.bak and disabled the [community] repo)

Include = /etc/pacman.conf.bak

Include = /etc/pacman.d/mirrorlist

Comment by Evgeniy Alexeev (arcan1s) - Thursday, 23 June 2016, 19:01 GMT
it is a bit strange, because I'm still able to reproduce the exception. I have just copied the original pacman configuration from package to pacman.conf.bak, created pacman.conf mentioned by you and got the same stacktrace. Namcap is 3.2.7-1 and pyalpm is 0.8-1.

In other hand at the moment I'm not sure is this a bug of namcap or a feature of pacman, because man page describes Include option inside OPTIONS section and it is not mentioned that Include may be used outside of any section.
Comment by Michael (MST) - Thursday, 23 June 2016, 19:35 GMT
Yes it's indeed a bit strange, if I look at the pyalpm sources [1] (lines 86 - 106) I would expect to get the error. So I'm wondering why it works on my machine...

Comment by Eli Schwartz (eschwartz) - Monday, 26 February 2018, 04:32 GMT
@arcan1s, since the very first pacman.conf manpage the Include keyword has been documented as:

Include = path::
Include another config file. This file can include repositories or
general configuration options.

I think this indicates clearly that the included file can mix and match [reponame] and [options] content -- so this is definitively something that should work. If it is allowed to redefine the section context, it is by extension allowed to exist outside of a section.

@remy, @jelle,

I can reliably get the following to crash for me:

python -c "import pyalpm; c = pycman.config.PacmanConfig(conf='/etc/pacman.conf')"

However, it only does so when I move my Include'd file (in this case /etc/pacman.d/nocustom.conf which contains all the settings which don't relate to custom repositories) to *above* the first [options] section.

Given that it itself begins with [options] and pacman (as well as pacman-conf) is fine with this, pyalpm should be handling this as well.

Note that as far as pacman is concerned, the Include statements are parsed and inlined into the configuration file, which is then parsed as a unified config file. See for example the generated config file output by `pacman-conf` (or pacconf if you have pacutils but not pacman-git).

So I think that this section over here should be run later on:

Or really, this should be run before anything else: