RootTools icon indicating copy to clipboard operation
RootTools copied to clipboard

The shell context is always set, even if the su binary does not support it

Open miracle2k opened this issue 10 years ago • 5 comments

It seems that the su on CM11 does not support the --context switch.

libsuperuser tests the shell version before using the --context flag. This seems like a sensible thing to do.

miracle2k avatar Dec 16 '14 23:12 miracle2k

Shell Context would be set to the normal context, which would still be the same context that the su binary in CM11 would run in.

If the su binary doesn't support the --context switch then it should simply ignore it. Are you seeing something else?

Stericson avatar Dec 22 '14 20:12 Stericson

The su binary in CM11 does not ignore the --context switch, it raises an error that you passed an unknown arguments (the behaviour I would expect).

In my case, I need to run using a different context in the case that SELinux is enabled. Chainfire's latest su binary supports the --context switch because of this. For some reason, CM11 claims that SELinux is enabled, but the su binary shipped does not support --context, and in fact the commands I want to run work fine on CM11.

FWIW I extracted the version checking code from libsuperuser and I'm using it manually now:

https://github.com/miracle2k/android-autostarts/blob/master/src/com/elsdoerfer/android/autostarts/Utils.java#L67

miracle2k avatar Dec 25 '14 03:12 miracle2k

Thanks,

I was unaware of this issue, I will address this and have the code checked in soon.

Stericson avatar Dec 29 '14 20:12 Stericson

I've checked in the code and the issue should be resolved.

Can you review the code changes made in Shell.java?

Stericson avatar Dec 30 '14 02:12 Stericson

Amazing, thanks! The code looks perfectly good to me.

miracle2k avatar Dec 30 '14 04:12 miracle2k