Skip to content

Commit d3c5be6

Browse files
committed
UnquotedVariable: fix false positives with unset_command
Caught on sci-biology/hmmer, it was incorrectly reporting for TMPDIR declared with `unset`. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent d62b5f7 commit d3c5be6

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/pkgcheck/checks/codingstyle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,8 @@ class _UnquotedVariablesCheck(Check):
10191019
# Variable is part of a shell assignment, and does not need to be
10201020
# quoted. for example S=${WORKDIR}/${PN} is ok.
10211021
'variable_assignment',
1022+
# Variable is being used in a unset command.
1023+
'unset_command',
10221024
# Variable is part of declaring variables, and does not need to be
10231025
# quoted. for example local TMPDIR is ok.
10241026
'declaration_command',

testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/EbuildUnquotedVariable-0.ebuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ src_prepare() {
4444
local TMPDIR # ok
4545
TMPDIR="$(mktemp --directory --tmpdir=/tmp ${PN}-XXXX)" # ok
4646
export TMPDIR # ok
47+
48+
unset TMPDIR # ok
4749
}

0 commit comments

Comments
 (0)