Skip to content

Conversation

@TomJo2000
Copy link
Member

CC: @Biswa96
This PR will prevent failure modes such as the one in https://github.com/termux/termux-packages/actions/runs/19025073645 by skipping the version checks past version validation for version arrays on all but index 0, since that is the git diff, version compare, and sequential revision increase/proper revision reset checks only need to be run once.

I'd like to additionally request @truboxl for review regarding the recent on-device issues with the linter.
This branch doesn't contain fixes for on-device usage in its initial state, however I plan to add these later today after concluding on-device testing of the linter.

@TomJo2000 TomJo2000 requested review from Biswa96 and truboxl November 3, 2025 06:44
@robertkirkman
Copy link
Member

robertkirkman commented Nov 3, 2025

using termux-apt on-device, I can't reproduce the exact error that truboxl saw invalid regular expression, maybe truboxl can explain how to reproduce that, but I can report the first error I have encountered testing lint-packages.sh on-device, which is this:

================================================================

Package: cabal-install

Layout: PASS
Package name 'cabal-install': PASS
End of line check: PASS
File permission check: PASS
Indentation check: FAILED
packages/cabal-install/build.sh:29:			 ghc-options: -fexternal-interpreter -pgmi=$(command -v termux-ghc-iserv)
packages/cabal-install/build.sh:36:			 flags: +no-cmm
Mixed indentation

================================================================

A problem has been found in 'packages/cabal-install/build.sh'.
Checked 0 packages before the first error was detected.

================================================================

which is reproducible by the command scripts/lint-packages.sh packages/cabal-install/build.sh in termux-apt, but is not reproducible inside the termux-package-builder, so there must be some difference between how they each evaluate packages/cabal-install/build.sh.

@TomJo2000
Copy link
Member Author

Is your on-device clone of the repo up to date?
Because the current linter version passes all packages on my PC, but I am seeing that mixed indentation so what's going on with that.

@robertkirkman
Copy link
Member

Is your on-device clone of the repo up to date?

yes.

Because the current linter version passes all packages on my PC, but I am seeing that mixed indentation so what's going on with that.

It appears that for some reason, lint-packages.sh can detect the mixed indentation of cabal-install when run on-device, but cannot detect it when run inside termux-package-builder. I am not sure what the root cause of that would be.

cat <<-EOF >>cabal.project.local
package *
ghc-options: -fexternal-interpreter -pgmi=$(command -v termux-ghc-iserv)
EOF

@TomJo2000
Copy link
Member Author

It's probably regex related.
Ugh, that's a pain in the ass but I need to debug that anyway.

@TomJo2000
Copy link
Member Author

Actually it's a sequencing error.
Because both of these mixed indentation lines are in a heredoc, the heredoc logic hits continue before the mixed indentation check is ever run on the line.

# make sure it's a heredoc, not a herestring
if [[ "$line" != *'<<<'* ]]; then
# Skip this check in entirely within heredocs
[[ "$line" =~ $heredoc_regex ]] && {
heredoc_terminator="${BASH_REMATCH[1]}"
}
[[ -n ${heredoc_terminator} && "$line" == [[:space:]]*"${heredoc_terminator//[\'\"]}" ]] && {
heredoc_terminator=''
}
(( ${#heredoc_terminator} )) && continue
fi

So we just need to move this block up above the heredoc check.

# check for mixed indentation
[[ "$line" =~ ^($'\t'+ +| +$'\t'+) ]] && {
issues[0]='Mixed indentation'
bad_lines[i]="${pkg_script}:${i}:$line"
}

@TomJo2000
Copy link
Member Author

Judging from the comment on the heredoc block, this was intentional behavior, however it seems to be unintended as far as expectations are concerned.

@TomJo2000 TomJo2000 force-pushed the linter-optimize-array-version-handling branch from 34285ba to 7666aca Compare November 3, 2025 09:16
@TomJo2000 TomJo2000 force-pushed the linter-optimize-array-version-handling branch from 7666aca to 6e4ed53 Compare November 5, 2025 06:53
@TomJo2000 TomJo2000 force-pushed the linter-optimize-array-version-handling branch from 6e4ed53 to dc0c6d8 Compare November 5, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants