.PKGINFO parser not robust enough for special characters in optdepends
The parsing of optdepends
strings in .PKGINFO is special, as right hand side of the :
basically any characters (also =
) may exist.
With the following example:
cat .PKGINFO
# Generated by makepkg 6.0.1
# using fakeroot version 1.29
pkgname = nvchecker
pkgbase = nvchecker
pkgver = 2.9-2
pkgdesc = New version checker for software releases
url = https://github.com/lilydjwg/nvchecker
builddate = 1657971560
packager = Chih-Hsuan Yen <yan12125@archlinux.org>
size = 378128
arch = any
license = MIT
depend = python
depend = python-tomli
depend = python-structlog
depend = python-appdirs
depend = python-tornado
depend = python-pycurl
optdepend = pyalpm: for using "sort_version_key = vercmp" in configuration files and the alpm source
optdepend = python-awesomeversion: for using "sort_version_key = awesomeversion" in configuration files
optdepend = python-lxml: for the htmlparser source
optdepend = python-packaging: for the pypi source
optdepend = git: support for git repositories
optdepend = python-gobject: for nvchecker-notify
optdepend = libnotify: for nvchecker-notify
makedepend = git
makedepend = python-docutils
makedepend = python-setuptools
makedepend = python-pygments
checkdepend = python-pytest
checkdepend = python-pytest-asyncio
checkdepend = python-pytest-httpbin
checkdepend = python-flaky
checkdepend = pyalpm
checkdepend = python-awesomeversion
checkdepend = python-lxml
checkdepend = git
We get
repod-file package inspect /mnt/mirror/community/os/x86_64/nvchecker-2.9-2-any.pkg.tar.zst
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/repod/files/pkginfo.py", line 192, in from_file
key, value = [x.strip() for x in line.strip().split(" = ", 2)]
ValueError: too many values to unpack (expected 2)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/repod-file", line 8, in <module>
sys.exit(repod_file())
File "/usr/lib/python3.10/site-packages/repod/cli/cli.py", line 189, in repod_file
repod_file_package(args=args)
File "/usr/lib/python3.10/site-packages/repod/cli/cli.py", line 33, in repod_file_package
model = asyncio.run(
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/lib/python3.10/site-packages/repod/files/package.py", line 115, in from_file
pkginfo=PkgInfo.from_file(
File "/usr/lib/python3.10/site-packages/repod/files/pkginfo.py", line 195, in from_file
raise RepoManagementFileError(
repod.errors.RepoManagementFileError: An error occurred while trying to parse the .PKGINFO line optdepend = pyalpm: for using "sort_version_key = vercmp" in configuration files and the alpm source
too many values to unpack (expected 2)