apk.sh icon indicating copy to clipboard operation
apk.sh copied to clipboard

substring expression < 0 error on macos zsh when patch

Open JaosnHsieh opened this issue 2 years ago • 4 comments

command

./apk.sh patch ./base.apk --arch arm

error

./apk.sh: line 209: -3: substring expression < 0

it's this line if [ ! -f "${FRIDA_SO_XZ::-3}" ]; then in the shell. Not sure how to fix it.

	FRIDA_SO_XZ="$APK_SH_HOME/$GADGET"

	if [ ! -f "${FRIDA_SO_XZ::-3}" ]; then

JaosnHsieh avatar Dec 23 '22 03:12 JaosnHsieh

Got a similar issue here https://github.com/ax/apk.sh/pull/8. macOS with Bash v3.2.57. Try apk.sh v1.0.2 it should be ok with bash 3.x. Maybe this fix this zsh issue also. Let us know.

ax avatar Dec 23 '22 17:12 ax

Try apk.sh v1.0.2 it should be ok with bash 3.x. Maybe this fix this zsh issue also.

Tried both zsh and bash 3.2.57 but same issue.

Farfar avatar Jan 01 '23 16:01 Farfar

Very same error?

ax avatar Jan 02 '23 13:01 ax

You're likely using a more up to date version of bash through homebrew which you can fix by replacing the shebang with

#!/opt/homebrew/bin/bash

if that's the case you're also gonna run into problems with grep which you can solve by installing gnu grep with brew install grep, adding the installed binaries to your PATH and replacing instances of grep with ggrep.

I'm sure there are better ways of solving these problems but this worked for me

Xetera avatar Jul 27 '23 17:07 Xetera