[Bug]: Missed detection of bad ebuild syntax (URL in global scope)
Is there an existing issue for this?
- [x] I have searched the existing issues
Current Behavior
$ git rev-parse HEAD
54fd3650e550eee4bcdbb6b3683c1e2fa326b859
$ pkgcheck scan
gentoo -- updating git cache: commit date: 2025-01-16
app-containers/lxc-templates
VariableOrderWrong: version 3.0.4: variable LICENSE should occur before KEYWORDS
VariableOrderWrong: version 3.0.4_p20240917: variable LICENSE should occur before KEYWORDS
VariableOrderWrong: version 3.0.4_p20240917: variable S should occur before SLOT
The ebuild has a top-level URL ("https://..."):
[...]
MY_COMMIT="da14466ce09afa3b39adb2b324be20084b776eb7"
https://github.com/lxc/lxc-templates/archive/da14466ce09afa3b39adb2b324be20084b776eb7.zip
DESCRIPTION="Old style template scripts for LXC"
HOMEPAGE="https://linuxcontainers.org/ https://github.com/lxc/lxc-templates"
SRC_URI="https://github.com/lxc/lxc-templates/archive/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
When running ebuild ... clean install, I see:
* lxc-templates-3.0.4_p20240917.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ]
/home/sam/git/gentoo/app-containers/lxc-templates/lxc-templates-3.0.4_p20240917.ebuild: line 9: https://github.com/lxc/lxc-templates/archive/da14466ce09afa3b39adb2b324be20084b776eb7.zip: No such file or directory
/home/sam/git/gentoo/app-containers/lxc-templates/lxc-templates-3.0.4_p20240917.ebuild: line 9: https://github.com/lxc/lxc-templates/archive/da14466ce09afa3b39adb2b324be20084b776eb7.zip: No such file or directory
>>> Unpacking source...
* The following distfiles lack detached signatures:
* lxc-templates-3.0.4_p20240917.tar.gz
* ERROR: app-containers/lxc-templates-3.0.4_p20240917::gentoo failed (unpack phase):
* Unsigned distfiles found
Expected Behavior
pkgcheck to detect it somehow (it's not quite a SourcingError though...)
pkgcheck version
pkgcheck 0.10.33
pkgcore version
pkgcore 0.12.28
Reminds me a bit of https://github.com/pkgcore/pkgcheck/issues/481 but the cause is quite different there (see mgorny's analysis).
pkgcraft catches this as follows:
ERROR invalid pkg: app-containers/lxc-templates-3.0.4_p20240917::/home/leio/gentoo/gentoo: line 9: https://github.com/lxc/lxc-templates/archive/da14466ce09afa3b39adb2b324be20084b776eb7.zip: restricted: cannot specify `/' in command names
pkgcraft catches this as follows:
ERROR invalid pkg: app-containers/lxc-templates-3.0.4_p20240917::/home/leio/gentoo/gentoo: line 9: https://github.com/lxc/lxc-templates/archive/da14466ce09afa3b39adb2b324be20084b776eb7.zip: restricted: cannot specify `/' in command names
There are lots of potential bash issues that pkgcraft catches during metadata generation compared to pkgcore or portage because both of those don't bail on a command failures during sourcing except if the last line fails due bash's default error handling design.
For example, check out the shared test data repo from pkgcraft and run pkgcheck in the Metadata/MetadataError package directory.
For pkgcheck, the output will be an explosion of mishandled errors, sandbox issues, and outright ignored failures and then compare it to pkgcruft after making sure to wipe the repo's package metadata in metadata/md5-cache/* between runs because pkgcore will still generate package metadata for ebuilds with sandbox issues and other ignored errors. Also note most of this isn't fixable for pkgcheck in a reasonable fashion because it relies on vanilla bash and its working assumptions.