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 Jelle van der Waa (jelly) - Monday, 03 April 2023, 19:18 GMT
Opened by Evgeniy Alexeev (arcan1s) - Thursday, 28 January 2016, 13:24 GMT
Last edited by Jelle van der Waa (jelly) - Monday, 03 April 2023, 19:18 GMT
|
Details
Description:
I have the following pacman.conf: https://gist.github.com/arcan1s/c3bfce51ad0eb7860bdb 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: https://gist.github.com/arcan1s/c3bfce51ad0eb7860bdb 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
Closed by Jelle van der Waa (jelly)
Monday, 03 April 2023, 19:18 GMT
Reason for closing: Fixed
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p yalpm/-/commit/90941d054f431f5314d170e20 c3c4a209b8bb2b1
Monday, 03 April 2023, 19:18 GMT
Reason for closing: Fixed
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p yalpm/-/commit/90941d054f431f5314d170e20 c3c4a209b8bb2b1
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
[community]
Include = /etc/pacman.d/mirrorlist
[1] https://git.archlinux.org/users/remy/pyalpm.git/log/
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.
[1] https://git.archlinux.org/users/remy/pyalpm.git/tree/pycman/config.py
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: https://git.archlinux.org/pyalpm.git/tree/pycman/config.py#n105
Or really, this should be run before anything else: https://git.archlinux.org/pyalpm.git/tree/pycman/config.py#n105