ax / apk.sh

apk.sh makes reverse engineering Android apps easier, automating some repetitive tasks like pulling, decoding, rebuilding and patching an APK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

substring expression < 0 error on macos zsh when patch

JaosnHsieh opened this issue · 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
commented

Got a similar issue here #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.

commented

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.

commented

Very same error?

commented

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