Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: pkg: line 142: syntax error in expression (error token is "8 9 11 12 13 14 16") #10778

Closed
USLTD opened this issue May 22, 2022 · 14 comments · Fixed by #10783
Closed

[Bug]: pkg: line 142: syntax error in expression (error token is "8 9 11 12 13 14 16") #10778

USLTD opened this issue May 22, 2022 · 14 comments · Fixed by #10783
Labels
bug report Something is not working properly

Comments

@USLTD
Copy link
Contributor

USLTD commented May 22, 2022

Problem description

When I try to use pkg it shows following error:

Checking availability of current mirror: bad
Testing the available mirrors:
[*] https://mirror.mwt.me/termux/main: ok
[*] https://termux.sahilister.in/apt/termux-main: ok
[*] https://plug-mirror.rcac.purdue.edu/termux/termux-main: ok
[*] https://termux.mentality.rip/termux-main: ok
[*] https://grimler.se/termux-packages-24: ok
[*] https://termux.librehat.com/apt/termux-main: bad
[*] https://termux.astra.in.ua/apt/termux-main: ok
[*] https://packages-cf.termux.org/apt/termux-main: ok
[*] https://dl.kcubeterm.com/termux-main: ok
/data/data/com.termux/files/usr/bin/pkg: line 142: 7
8
9
11
12
13
14
16: syntax error in expression (error token is "8
9
11
12
13
14
16")

What steps will reproduce the bug?

When mirrors aren't updated running pkg upgrade or pkg install [something] or pkg update. I haven't tested anything else.

What is the expected behavior?

To complete job without error

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PID=6266
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://dl.kcubeterm.com/termux-main/ stable main
# root-repo (sources.list.d/root.list)
deb https://packages.termux.org/apt/termux-root root stable
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/24 termux extras
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
Android version:
11
Kernel build information:
Linux localhost 4.14.186-g759c88b6c5dc #1 SMP PREEMPT Wed Jan 12 11:21:08 WIB 2022 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
Redmi Note 8 Pro
@USLTD USLTD added the bug report Something is not working properly label May 22, 2022
@zairullahdev
Copy link

use apt instead pkg, maybe the developer typo at writing script

@agnostic-apollo
Copy link
Member

@Maxython
Copy link
Member

IFS not being restored. Will fix it.

f1a83c5#diff-926df3194e5f727be3fefbac2278032a4b2331fa147ddb70c3898602a23765a4R198

#10486

Ok, I see. I will fix it.

@agnostic-apollo
Copy link
Member

I have to make other changes, will do it myself, no worries.

@USLTD
Copy link
Contributor Author

USLTD commented May 22, 2022

use apt instead pkg, maybe the developer typo at writing script

I am using apt as replacement for now, it's just that I kinda like pkg's automatic mirror management.

@Maxython
Copy link
Member

I have to make other changes, will do it myself, no worries.

Yes, but also need to fix another error in pkg. This is related to the TERMUX_MAIN_PACKAGE_FORMAT value.

@agnostic-apollo
Copy link
Member

I assume that's for people who updated from very old termux-tools version whose login script didn't export the variable. Variable can be expanded with ${TERMUX_MAIN_PACKAGE_FORMAT-} to prevent error and can default to debian. Although, now priority needs to be given to TERMUX_APP_PACKAGE_MANAGER (apt/pacman) anyways.

@zairullahdev
Copy link

So we can close now?

@USLTD
Copy link
Contributor Author

USLTD commented May 22, 2022

So we can close now?

Yes.

@USLTD USLTD closed this as completed May 22, 2022
agnostic-apollo added a commit to agnostic-apollo/termux-packages that referenced this issue May 22, 2022
…anagers and fix broken script

Previously, the commands for the package managers were defined in a single array making code hard to read for which command would be executed for which case since reader would have to count indexes of the array for each command to understand the code. Now case statements are used to simply the code.

Moreover, the `IFS` was not restored after setting it to `|`, which resulted in the `/data/data/com.termux/files/usr/bin/pkg: line 142: syntax error in expression (error token is...` error. That is fixed too since it won't be used anymore.

Closes termux#10778
agnostic-apollo added a commit to agnostic-apollo/termux-packages that referenced this issue May 22, 2022
…anagers and fix broken script

Previously, the commands for the package managers were defined in a single array making code hard to read for which command would be executed for which case since reader would have to count indexes of the array for each command to understand the code. Now case statements are used to simply the code.

Moreover, the `IFS` was not restored after setting it to `|`, which resulted in the `/data/data/com.termux/files/usr/bin/pkg: line 142: syntax error in expression (error token is...` error. That is fixed too since it won't be used anymore.

Closes termux#10778
@agnostic-apollo
Copy link
Member

This is currently not fixed. The termux-tools v0.180 will be released soon with the fix, will notify when it is.

agnostic-apollo added a commit to agnostic-apollo/termux-packages that referenced this issue May 22, 2022
…anagers and fix broken script

Previously, the commands for the package managers were defined in a single array making code hard to read for which command would be executed for which case since reader would have to count indexes of the array for each command to understand the code. Now case statements are used to simply the code.

Moreover, the `IFS` was not restored after setting it to `|`, which resulted in the `/data/data/com.termux/files/usr/bin/pkg: line 142: syntax error in expression (error token is...` error. That is fixed too since it won't be used anymore.

Closes termux#10778
agnostic-apollo added a commit to agnostic-apollo/termux-packages that referenced this issue May 22, 2022
…anagers and fix broken script

Previously, the commands for the package managers were defined in a single array making code hard to read for which command would be executed for which case since reader would have to count indexes of the array for each command to understand the code. Now case statements are used to simply the code.

Moreover, the `IFS` was not restored after setting it to `|`, which resulted in the `/data/data/com.termux/files/usr/bin/pkg: line 142: syntax error in expression (error token is...` error. That is fixed too since it won't be used anymore.

Closes termux#10778
agnostic-apollo added a commit to agnostic-apollo/termux-packages that referenced this issue May 23, 2022
…anagers and fix broken script

Previously, the commands for the package managers were defined in a single array making code hard to read for which command would be executed for which case since reader would have to count indexes of the array for each command to understand the code. Now case statements are used to simply the code.

Moreover, the `IFS` was not restored after setting it to `|`, which resulted in the `/data/data/com.termux/files/usr/bin/pkg: line 142: syntax error in expression (error token is...` error. That is fixed too since it won't be used anymore.

Closes termux#10778
@agnostic-apollo
Copy link
Member

The termux-tools v0.180 is out on default repository and will be available on other mirrors when they sync. Users can switch to default repo with termux-change-repo and can update to it with apt update; apt install termux-tools

https://packages.termux.org/apt/termux-main/pool/main/t/termux-tools/

@kumkee
Copy link

kumkee commented Oct 25, 2022

The termux-tools v0.180 is out on default repository and will be available on other mirrors when they sync. Users can switch to default repo with termux-change-repo and can update to it with apt update; apt install termux-tools

https://packages.termux.org/apt/termux-main/pool/main/t/termux-tools/

I can't use this solution. When I try apt update I encounter this bug. Over there, the solution was to pkg update which leads to this bug.

How do I come out of the dead loop, please?

@kumkee
Copy link

kumkee commented Oct 25, 2022

https://github.com/termux/termux-app#google-play-store-deprecated

https://github.com/termux/termux-app#installation

Mine is the latest version 0.118.0 and was installed from F-Droid in April or May.
pkg used to work back then.

When I apk update

Something wicked happened resolving 'termux.sahilister.in:https' (7 - No address associated with hostname)

How do I manually change the mirror address?

Sorry. I just found out from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something is not working properly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants