[pacman-dev] libmakepkg/lint_config: fix lint_variable actually running the PKGBUILD lint
diff mbox

Message ID 20180904191754.19540-1-eschwartz@archlinux.org
State Accepted, archived
Headers show

Commit Message

Eli Schwartz Sept. 4, 2018, 7:17 p.m. UTC
Due to a copy-paste error when initially implementing this, it actually
uses a duplicate function name, usually resulting in lint_pkgbuild
overwriting the function definition.

Then the PKGBUILD lint gets run twice, one time before the PKGBUILD is
even sourced -- to potentially surprising results, like erroring out on
a pre-existing shell definition that doesn't match our expectations.

Seen in the wild with lint_config triggering an error for
'declare -x arch="foo"'

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 scripts/libmakepkg/lint_config/variable.sh.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Allan McRae Sept. 19, 2018, 12:54 a.m. UTC | #1
On 5/9/18 5:17 am, Eli Schwartz wrote:
> Due to a copy-paste error when initially implementing this, it actually
> uses a duplicate function name, usually resulting in lint_pkgbuild
> overwriting the function definition.
> 
> Then the PKGBUILD lint gets run twice, one time before the PKGBUILD is
> even sourced -- to potentially surprising results, like erroring out on
> a pre-existing shell definition that doesn't match our expectations.
> 
> Seen in the wild with lint_config triggering an error for
> 'declare -x arch="foo"'
> 
> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
> ---

Ack.

Patch
diff mbox

diff --git a/scripts/libmakepkg/lint_config/variable.sh.in b/scripts/libmakepkg/lint_config/variable.sh.in
index 14bd0e05..55ed6d6d 100644
--- a/scripts/libmakepkg/lint_config/variable.sh.in
+++ b/scripts/libmakepkg/lint_config/variable.sh.in
@@ -25,10 +25,10 @@  LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
 source "$LIBRARY/util/message.sh"
 
-lint_config_functions+=('lint_variable')
+lint_config_functions+=('lint_config_variables')
 
 
-lint_variable() {
+lint_config_variables() {
 	local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
 	             DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
 	             COMPRESSLRZ COMPRESSLZO COMPRESSZ)