holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.71k stars 117 forks source link

Mv - command not found #646

Open zanodor opened 1 year ago

zanodor commented 1 year ago

Since a re-jailbreak, some of my Siri Shortcuts to do with moving regex [A-Z] folders have started not working properly.

Simple mv commands came back with the error: "permissions denied: command not found."

I didn't really know what to make of "permissions denied" either but I chmoded all folders I am using for good measure.
Then I received "command not found" even when the folder in question was still successfully moved to the desired location properly. Why the error message then? Strange.

I thought an uninstall – reinstall would be in order but I don't want to lose my preferences in A-Shell.
For now, I have changed to local SSH mv actions, but I liked A-Shell doing the moving before better (they also work without a JB).

Have you heard about such behaviour before?

Cheers

holzschu commented 1 year ago

I have very little experience with jailbreaking since I started working on a-Shell, so I'm going to take some guesses.

iOS has an underlying shell. Once you jailbreak, that shell becomes accessible. It's possible that the mv command became available because of the jailbreaking, and that it is now on the PATH. Since a-Shell uses the $PATH environment variable to look for commands, it's possible that it found this mv command, decided that it was an executable command, and tried to execute it. And since I haven't set up a-Shell to execute Arm64 binaries, it fails with a "permission denied".

That's what I think is the most likely hypothesis. A good way to check would be:

If you see it, then my hypothesis is validated. The fix for you would then be to remove this directory from the PATH.

zanodor commented 1 year ago

I was being a bit hasty putting up this issue despite wanting to do it yesterday.

It turns out that there was some problem with PATH indeed and it had to do with a symlink into /private/var/mobile.
Even the app Textastic didn't find my External Folder. I deleted the symlink and replaced it with a new one. In the meantime my git picked up on the chmod changes as well (showing all files modified). I created an ignore in the config of that and now my move command miraculously works again with regex options as well as before.

I surmise that when I restored to RootFs and created FakeFs anew during re-jailbreak something with the PATHs went haywire. But it didn't happen a week before and this has taken me by surprise.

Thanks buddy - we learn something new every day

Z.