FS#41412 - {pyalpm} can't parse comments comments on the same lines as keys in pacman.conf
Attached to Project:
Arch Linux
Opened by Nishant Rodrigues (nishantjr) - Thursday, 31 July 2014, 15:26 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 26 March 2018, 19:03 GMT
Opened by Nishant Rodrigues (nishantjr) - Thursday, 31 July 2014, 15:26 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 26 March 2018, 19:03 GMT
|
Details
Description: namcap can't parse comments comments on the
same lines as keys in pacman.conf
Additional info: - Version: 3.2.5-2 Steps to reproduce: Add section like to pacman.conf: [quarry] # Ruby gems Server = http://pkgbuild.com/~anatolik/quarry/x86_64/ Run: namcap PKGBUILD on any PKGBUILD Namcap exist with message: Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.4/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3.4/site-packages/namcap.py", line 32, in <module> import Namcap.depends File "/usr/lib/python3.4/site-packages/Namcap/__init__.py", line 20, in <module> from . import util, rules File "/usr/lib/python3.4/site-packages/Namcap/rules/__init__.py", line 24, in <module> from . import ( File "/usr/lib/python3.4/site-packages/Namcap/rules/kdeprograms.py", line 22, in <module> import Namcap.depends File "/usr/lib/python3.4/site-packages/Namcap/depends.py", line 30, in <module> from Namcap import package File "/usr/lib/python3.4/site-packages/Namcap/package.py", line 34, in <module> pyalpm_handle = pycman.config.init_with_config('/etc/pacman.conf') File "/usr/lib/python3.4/site-packages/pycman/config.py", line 269, in init_with_config config = PacmanConfig(conf = configpath) File "/usr/lib/python3.4/site-packages/pycman/config.py", line 161, in __init__ self.load_from_file(conf) File "/usr/lib/python3.4/site-packages/pycman/config.py", line 166, in load_from_file for section, key, value in pacman_conf_enumerator(filename): File "/usr/lib/python3.4/site-packages/pycman/config.py", line 120, in pacman_conf_enumerator raise InvalidSyntax(f.name, 'invalid key for repository configuration', line) pycman.config.InvalidSyntax: unable to parse /etc/pacman.conf, invalid key for repository configuration: '[quarry] # Ruby gems' |
This task depends upon
Closed by Eli Schwartz (eschwartz)
Monday, 26 March 2018, 19:03 GMT
Reason for closing: Won't fix
Additional comments about closing: pacman 5.1 in git does not allow comments on the same lines as keys. So maybe pyalpm was just prescient. :p
Monday, 26 March 2018, 19:03 GMT
Reason for closing: Won't fix
Additional comments about closing: pacman 5.1 in git does not allow comments on the same lines as keys. So maybe pyalpm was just prescient. :p
diff --git a/usr/lib/python3.4/site-packages/pycman/config.py b/x
index 28924a2..9bc8b32 100644
--- a/usr/lib/python3.4/site-packages/pycman/config.py
+++ b/config.py
@@ -94,10 +94,8 @@ def pacman_conf_enumerator(path):
filestack.pop()
continue
- line = line.strip()
+ line = line.split('#')[0].strip()
if len(line) == 0: continue
- if line[0] == '#':
- continue
if line[0] == '[' and line[-1] == ']':
current_section = line[1:-1]
continue
warning: config file /etc/pacman.conf, line 12: directive '[quarry] # Ruby gems' in section 'options' not recognized.
warning: config file /etc/pacman.conf, line 14: directive 'Server' in section 'options' not recognized.
Since pacman does not support it, there should be no expectation that pyalpm supports it.
[ownstuff] # mingw32-64 packages
This is the pacman output:
[root@boron johannes]# pacman -Syu
:: Synchronizing package databases...
core is up to date
extra 1600.6 KiB 39.1M/s 00:00 [####################################################################] 100%
community 4.2 MiB 96.3M/s 00:00 [####################################################################] 100%
multilib is up to date
ownstuff is up to date
Only pyalpm has a problem with it on my system.
FS#48702but you need the git version to see it. So at the time this bug was reported it would've been valid to change pyalpm, but then pacman changed and this bug became invalid.https://git.archlinux.org/pacman.git/commit/?id=8a19c4a78251c5e34ecf508a65d943ca2dc833c7