这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@TomJo2000
Copy link
Member

and get some performance improvements by removing the grep and sed calls from the success path and replacing them with =~, ==, and case as appropriate.

I used a profile to identify the hottest parts of the script and it turns out that was grep and sed.

In my local testing this has yielded a ~450% performance increase for running a full linter sweep (./scripts/lint-packages.sh, e.g. linting all packages).

~4m10s before this PR.
~53s after.

The hottest part now is dirname, but that's spread out over 8000+ calls, so that's not worth optimizing further.

Here's the linter report of anyone's interested.
Nothing is hogging the script's time particularly badly so I'm happy to call it here for optimizations now.

Top 20 cummulatively longest commands:
  percent    spent_us  cmd                                                   calls    spentPerCall  topCaller
---------  ----------  --------------------------------------------------  -------  --------------  ------------------
  9.70636   9_729_790  dirname "$package_script"                              8031       1211.53    lint_package
  8.25967   8_279_609  git -P diff --name-only "${base_commit}".. -- "$..     2677       3092.87    check_version
  5.77337   5_787_305  awk { print $2 }                                       2677       2161.86    lint_package
  4.96211   4_974_082  bash -n "$package_script" 2>&1                         2677       1858.08    lint_package
  4.39207   4_402_673  [[ "$line" =~ $heredoc_regex ]]                       84615         52.0318  check_indentation
  3.30592   3_313_900  $IFS=\n read -r line                                  87722         37.7773  check_indentation
  3.26143   3_269_303  dpkg --validate-pkgname "${pkg_name}" &> /dev/null     3069       1065.27    check_package_name
  3.19036   3_198_065  $[[ "$line" =~ ^(\t+ +| +\t+) ]]                      83038         38.5133  check_indentation
  2.89003   2_897_002  echo "PASS"                                           38629         74.9955  lint_package
  2.884     2_890_964  dpkg --validate-version "${TERMUX_PKG_VERSION}"        2677       1079.93    check_version
  2.8811    2_888_058  [[ -n ${heredoc_terminator} && "$line" == [[:spa..    84615         34.1317  check_indentation
  2.67614   2_682_598  [[ "$line" == *=(* ]]                                 83038         32.3057  check_indentation
  2.65864   2_665_055  [[ "$line" != *<<<* ]]                                84653         31.4821  check_indentation
  2.64141   2_647_784  [[ "$in_array" == 0 && "$line" == " "* ]]             83038         31.8864  check_indentation
  2.60735   2_613_647  [[ "$line" == *) ]]                                   83038         31.4753  check_indentation
  2.59709   2_603_362  (( ${#heredoc_terminator} ))                          84615         30.7671  check_indentation
  2.58759   2_593_831  ((i++))                                               84653         30.6407  check_indentation
  2.45196   2_457_876  stat -c "%A" "$package_script"                         2677        918.146   lint_package
  1.28151   1_284_603  basename "$(dirname "$package_script")"                2677        479.867   lint_package
  1.20898   1_211_900  syntax_errors=$(bash -n "$package_script" 2>&1)        2677        452.708   lint_package

I used this profiler I found on StackOverflow.
https://github.com/Kamilcuk/L_bash_profile

@TomJo2000 TomJo2000 force-pushed the linter-evaluate-version-change branch from e6cd26c to aaf7e40 Compare October 6, 2025 03:31
@TomJo2000
Copy link
Member Author

As @Biswa96 has made me aware of, the version check fails if there is no refs/remotes/origin/master for it to get a baseline commit from.
The latest commit adds a WIP fix for this by attempting to fetch that ref if it's missing, and otherwise skipping the rest of the check.

I'm too tired to test this fix fully right now.
But I already have the concern that if git fetch fails it will be called repeatedly, which would be very undesirable.
I'll look at it after I've gotten some sleep.
Easiest solution would probably be fetching outside the main loop so it's only ever called once.

@robertkirkman
Copy link
Member

I tested this version, it seems to work great:

tacokoneko@CORSAIR ~/code/termux/termux-packages-codelldb $ git remote remove origin
tacokoneko@CORSAIR ~/code/termux/termux-packages-codelldb $ git branch -d master
Deleted branch master (was 025ec8c6dc).
tacokoneko@CORSAIR ~/code/termux/termux-packages-codelldb $ scripts/run-docker.sh scripts/lint-packages.sh 
Running container 'codelldb-termux-package-builder' from image 'ghcr.io/termux/package-builder'...
================================================================

Package: 0verkill

Layout: PASS
Package name '0verkill': PASS
End of line check: PASS
File permission check: PASS
Indentation check: PASS
Syntax check: PASS
Trailing whitespace check: PASS
TERMUX_PKG_HOMEPAGE: PASS
TERMUX_PKG_DESCRIPTION: PASS
TERMUX_PKG_LICENSE: PASS
TERMUX_PKG_MAINTAINER: PASS
TERMUX_PKG_API_LEVEL: PASS
TERMUX_PKG_VERSION: PARTIAL PASS (can't check version change)
TERMUX_PKG_REVISION: PASS
TERMUX_PKG_SRCURL: PASS
TERMUX_PKG_SHA256: PASS
TERMUX_PKG_BUILD_IN_SRC: PASS

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

Package: 2048-c

Layout: PASS
Package name '2048-c': PASS
End of line check: PASS
File permission check: PASS
Indentation check: PASS
Syntax check: PASS
Trailing whitespace check: PASS
TERMUX_PKG_HOMEPAGE: PASS
TERMUX_PKG_DESCRIPTION: PASS
TERMUX_PKG_LICENSE: PASS
TERMUX_PKG_MAINTAINER: PASS
TERMUX_PKG_API_LEVEL: PASS
TERMUX_PKG_VERSION: PARTIAL PASS (can't check version change)
TERMUX_PKG_REVISION: PASS

It doesn't seem to take very long to run each check, but if this is also about optimizing the linter, then you're probably right that it would be more optimal to move the git fetch check outside of the loop so it runs only once.

@TomJo2000 TomJo2000 force-pushed the linter-evaluate-version-change branch from b378b88 to 9d2f699 Compare October 9, 2025 17:25
@TomJo2000
Copy link
Member Author

I tested this version, it seems to work great:

[...]

It doesn't seem to take very long to run each check, but if this is also about optimizing the linter, then you're probably right that it would be more optimal to move the git fetch check outside of the loop so it runs only once.

I've moved it to above the function declaration with a comment explaining that we'll need it in the check.
That way it only ever runs once, and only if the ref is missing.

@robertkirkman
Copy link
Member

I tested this a bit, but I encountered a little bit of a strange problem,

it seems like it might have encountered another edge case and compared with the wrong master branch, or something like that.

scripts/run-docker.sh scripts/lint-packages.sh shows Version of 'apt-file' has not been incremented... even though the branch I'm on is relatively up-to-date and doesn't have anything changed in its apt-file package.

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

Package: apt-file

Layout: PASS
Package name 'apt-file': PASS
End of line check: PASS
File permission check: PASS
Indentation check: PASS
Syntax check: PASS
Trailing whitespace check: PASS
TERMUX_PKG_HOMEPAGE: PASS
TERMUX_PKG_DESCRIPTION: PASS
TERMUX_PKG_LICENSE: PASS
TERMUX_PKG_MAINTAINER: PASS
TERMUX_PKG_API_LEVEL: PASS
TERMUX_PKG_VERSION: FAILED

Version of 'apt-file' has not been incremented.
Either 'TERMUX_PKG_VERSION' or 'TERMUX_PKG_REVISION'
need to be modified in the build.sh when changing a package build.

TERMUX_PKG_SRCURL: NON-HTTPS (acceptable)
TERMUX_PKG_SHA256: PASS
TERMUX_PKG_BUILD_IN_SRC: PASS
TERMUX_PKG_PLATFORM_INDEPENDENT: PASS

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

A problem has been found in 'packages/apt-file/build.sh'.
Checked 50 packages before the first error was detected.

================================================================
tacokoneko@CORSAIR ~/code/termux/termux-packages-jdk25 $ git status
On branch openjdk-25
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   scripts/lint-packages.sh
	modified:   scripts/run-docker.sh

no changes added to commit (use "git add" and/or "git commit -a")
tacokoneko@CORSAIR ~/code/termux/termux-packages-jdk25 $ 

If you want to reproduce this yourself and take a closer look at it, I might be able to provide some commands which would exactly reproduce this problem on your computer too, let me know if you would like that.

@TomJo2000
Copy link
Member Author

TomJo2000 commented Oct 14, 2025

That latest linter failure doesn't make any sense.
I added a commit specifically to fix the linter error with perl since it was the only package using a commit SHA as a version number.
https://github.com/termux/termux-packages/actions/runs/18510327351/job/52749485884?pr=26786#step:5:33

Oh... because the old version for ${TERMUX_PKG_VERSION[1]} is invalid for dpkg --compare-versions it fails the check.
So I need to catch that.

@TomJo2000 TomJo2000 force-pushed the linter-evaluate-version-change branch from e66e6b2 to 5044dca Compare October 14, 2025 21:36
@TomJo2000
Copy link
Member Author

I don't know if this fixed the git fetch issue yet, but check_version is now array capable.

@TomJo2000 TomJo2000 force-pushed the linter-evaluate-version-change branch from 5044dca to d208782 Compare October 15, 2025 00:45
Comment on lines +210 to +231
local new_revision="${version_new##*-}" old_revision="${version_old##*-}"

# If the version hasn't changed the revision must be incremented by 1
# A decrease or no increase would have been caught above.
# But we want to additionally enforce sequential increase.
if [[ "${version_new%-*}" == "${version_old%-*}" && "$new_revision" != "$((old_revision + 1))" ]]; then
(( error++ )) # Not incremented sequentially
printf '%s\n' "FAILED " \
"TERMUX_PKG_REVISION should be incremented sequentially" \
"when a package is rebuilt with no new upstream release." \
"" \
"Got : ${version_old} -> ${version_new}" \
"Expected: ${version_old} -> ${version}-$((old_revision + 1))"
continue
# If that check passed the TERMUX_PKG_VERSION must have changed,
# in which case TERMUX_PKG_REVISION should be reset to 0.
# This check isn't useful past the first index when $TERMUX_PKG_VERSION is an array
# since the main version of such a package may remain unchanged when another is changed.
elif [[ "${version_new%-*}" != "${version_old%-*}" && "$new_revision" != "0" && "$i" == 0 ]]; then
(( error++ )) # Not reset
printf '%s\n' \
"FAILED - $version_old -> $version_new" \
"" \
"TERMUX_PKG_VERSION was bumped but TERMUX_PKG_REVISION wasn't reset." \
"Please remove the 'TERMUX_PKG_REVISION=${new_revision}' line." \
""
continue
fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a check for $TERMUX_PKG_REVISION being properly reset or incremented.

@TomJo2000 TomJo2000 force-pushed the linter-evaluate-version-change branch from fc9f4c6 to 2cc1c87 Compare October 15, 2025 03:17
@TomJo2000
Copy link
Member Author

TomJo2000 commented Oct 15, 2025

I finally figured out that git fetch issue.
We're just gonna count commits instead.

In other news.

Here's the linter report of anyone's interested. Nothing is hogging the script's time particularly badly so I'm happy to call it here for optimizations now.

Top 20 cummulatively longest commands:
  percent    spent_us  cmd                                                   calls    spentPerCall  topCaller
---------  ----------  --------------------------------------------------  -------  --------------  ------------------
  9.70636   9_729_790  dirname "$package_script"                              8031       1211.53    lint_package
  8.25967   8_279_609  git -P diff --name-only "${base_commit}".. -- "$..     2677       3092.87    check_version
  5.77337   5_787_305  awk { print $2 }                                       2677       2161.86    lint_package

Replacing that awk with a read -r _ last2octet _ shaved off another 8% just now.
That's another ~3.7 seconds on a full run.
Almost 1.38ms per package being linted.
I'm really just doing the optimizations for fun at this point.

This puts the total speedup for a full linter sweep at about 575% at this point.

Copy link
Member

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not having any more errors for me, and I think it is probably more reliable than the previous versions of this function.

Copy link
Member

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, I performed another test just to check what would happen. This time I performed this test:

rm -rf termux-packages
docker container kill termux-package-builder
docker container rm termux-package-builder
git clone https://github.com/termux/termux-packages.git
cd termux-packages
curl https://patch-diff.githubusercontent.com/raw/termux/termux-packages/pull/26786.diff | git apply -v
git apply -v << 'EOF'
--- a/packages/grep/build.sh
+++ b/packages/grep/build.sh
@@ -18,3 +18,7 @@ gl_cv_func_setlocale_works=yes
 "
 # Avoid automagic dependency on libiconv
 TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" am_cv_func_iconv=no"
+
+termux_step_pre_configure() {
+	echo "test"
+}
EOF
scripts/run-docker.sh scripts/lint-packages.sh packages/grep/build.sh

and this result happened:

Package: grep

Layout: PASS
Package name 'grep': PASS
End of line check: PASS
File permission check: PASS
Indentation check: PASS
Syntax check: PASS
Trailing whitespace check: PASS
TERMUX_PKG_HOMEPAGE: PASS
TERMUX_PKG_DESCRIPTION: PASS
TERMUX_PKG_LICENSE: PASS
TERMUX_PKG_MAINTAINER: PASS
TERMUX_PKG_API_LEVEL: PASS
TERMUX_PKG_VERSION: PASS - 3.12 (not modified in this branch)
TERMUX_PKG_REVISION: PASS
TERMUX_PKG_SRCURL: PASS
TERMUX_PKG_SHA256: PASS
TERMUX_PKG_ESSENTIAL: PASS

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

Checked 1 packages.
Everything seems ok.

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

Is this the expected behavior, or should grep fail the linter check because of having build.sh modified without version or revision also being modified?

@TomJo2000
Copy link
Member Author

Wait, I performed another test just to check what would happen. This time I performed this test:
[...]
Is this the expected behavior, or should grep fail the linter check because of having build.sh modified without version or revision also being modified?

That is not what should happen.
The reason why it's not seeing uncommitted changes is because it was using a commit range.
This mistake is also present in the current version on master, and I didn't catch it during the refactor.

commit_diff="$(git log --patch "${base_commit}.." -- "$package_dir")"
# If the diff is empty there's no commit modifying that package on this branch, which is a PASS.
[[ -z "$commit_diff" ]] && return
grep -q \
-e '^+TERMUX_PKG_REVISION=' \
-e '^+TERMUX_PKG_VERSION=' \
-e '\[no version check\]' <<< "$commit_diff" \
|| return 1
}

The fix should be as simple as removing the .. so that it does a difference from ${base_commit} to the index, which includes staged and unstaged changes.
Whereas ${base_commit}.. is a commit range from the base commit to the HEAD commit, and thus omits the uncommitted index.

@TomJo2000 TomJo2000 force-pushed the linter-evaluate-version-change branch from 377fa8d to bb06339 Compare October 18, 2025 15:28
Copy link
Member

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I think it's really working

@TomJo2000
Copy link
Member Author

This should be good to go then, so let's get this merged and if we missed something else I'm sure we'll hear about it.

@TomJo2000 TomJo2000 merged commit fc08224 into termux:master Oct 18, 2025
11 checks passed
@TomJo2000 TomJo2000 deleted the linter-evaluate-version-change branch October 19, 2025 13:25
@truboxl
Copy link
Contributor

truboxl commented Oct 31, 2025

Why is No Version Check removed?

@robertkirkman
Copy link
Member

Why is No Version Check removed?

The idea seems to be that if the version check lint step is robust enough, then there should be no reason to turn it off, so turning it off should not be supported. However I could be wrong, @TomJo2000 do you think there is any case remaining where turning off the version check would still be necessary?

@TomJo2000
Copy link
Member Author

Why is No Version Check removed?

The idea seems to be that if the version check lint step is robust enough, then there should be no reason to turn it off, so turning it off should not be supported. However I could be wrong, @TomJo2000 do you think there is any case remaining where turning off the version check would still be necessary?

Not that I'm aware of.
Having the option would probably be a good idea.
But I have tried to make the version check as robust as possible so this shouldn't ever be necessary.

@truboxl
Copy link
Contributor

truboxl commented Oct 31, 2025

Forks of the repo shouldnt care about checking version to be able to build packages on CI.
Minor changes to build scripts also shouldnt demand revbumping.

This did not happen when the lint-packages.sh was just a simple format checker for build.sh. Now I dont think its a linter anymore.

@robertkirkman
Copy link
Member

This did not happen when the lint-packages.sh was just a simple format checker for build.sh. Now I dont think its a linter anymore.

personally, I do agree and my personal opinion has always been that many of the things the lint-packages.sh does are too strict from a certain perspective, even before this, but it seemed that Tomjo2000 has wanted it to be stricter and has been making it stricter, and I don't know what the official limit on the scope of lint-packages.sh should be, so I just went along with what Tomjo2000 wanted to do.

@robertkirkman
Copy link
Member

Forks of the repo shouldnt care about checking version to be able to build packages on CI.

At a certain point I asked Tomjo2000 about this, and I asked something like "can the version check be just turned off if it is detected that lint-packages.sh is running in a fork?", but I believe I remember Tomjo2000 saying that they would strongly prefer it to be enabled in all cases, so instead of continuing to disagree, I helped to test for and resolve all currently-known errors involving the lint-packages.sh running in a fork.

@TomJo2000
Copy link
Member Author

lint-packages.sh is the first line of quality control for contributions to this repository.
If it fails the linter checks we know it's not up to the standards laid out in https://github.com/termux/termux-packages/wiki/Coding-guideline#script-formatting and
https://github.com/termux/termux-packages/blob/master/CONTRIBUTING.md#submitting-pull-requests

To what extent that should have to concern forks is something we can have a discussion about.
The linter has definitely gotten stricter than it was previously, the main intention behind that is to catch more things in the CI that we'd otherwise need to point out in a review.
I aim to provide descriptive and actionable error messages for linter failures.

The linter isn't there to beat contributors or forks over the head with unreasonable code style standards, it's there to catch issues early and ensure the established standards are being consistently applied.
It's not here to make policy, just verify it is being adequately applied.

@truboxl
Copy link
Contributor

truboxl commented Oct 31, 2025

As far as I concern the linter should not demand changing package versions if the changes are not submitted to this repo or minor/chore in nature.

This https://github.com/termux/termux-packages/blob/master/CONTRIBUTING.md#rebuilding-package-with-no-version-change should be rewritten to take account those scenarios.

@truboxl
Copy link
Contributor

truboxl commented Oct 31, 2025

Running lint-packages.sh on device get blasted with these errors. I do not get how these can get approved.

Indentation check: ./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)
./scripts/lint-packages.sh: line 87: [[: invalid regular expression `[^\(/%#]<{2}-?\s*(['"]?(\w*(\\.)?)*['"]?)': trailing backslash (\)

@TomJo2000
Copy link
Member Author

Not getting any of that locally.
And I've had no reports of this issue either.

What are you running this on?

@truboxl
Copy link
Contributor

truboxl commented Oct 31, 2025

Like I said, clone the repo and run ./scripts/lint-packages.sh on device inside Termux app.

@TomJo2000
Copy link
Member Author

If you did mention that above I did not catch that, sorry, I will be getting to the bottom of that as soon as I can.

@robertkirkman
Copy link
Member

robertkirkman commented Oct 31, 2025

Like I said, clone the repo and run ./scripts/lint-packages.sh on device inside Termux app.

lint-packages.sh depends on dpkg (which is one of the things I referred to that I've always thought I would prefer it didn't but it was there for a long time so I never really complained about that), so I've always assumed that meant it was only ever intended to be run inside of the termux-package-builder container or in GitHub Actions and never anywhere else.

For example it wouldn't work on termux-pacman unless dpkg were installed manually, and it won't run outside of the termux-package-builder container on my Gentoo computer either unless I have dpkg installed, which I don't really prefer to have installed in Gentoo.

@TomJo2000
Copy link
Member Author

I can add a codepath for vercmp, that's the pacman one.
But this is the Termux package linter not the "run anywhere with anything" package linter.
And I don't love the idea of multiple parallel version comparison implementations as part of the core logic, they're liable to disagree.

Say for example dpkg says 1.0.0~alpha.1 is less than 1.0.0~beta.1, but vercmp says they're equal, or something like that.
It's not worth the headache in my opinion.

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.

3 participants