Code Monkey home page Code Monkey logo

Comments (10)

PerfectSlayer avatar PerfectSlayer commented on August 21, 2024 1

I add a log into the com.topjohnwu.superuser.internal.StreamGobbler.OUT#call method to dump read lines and here is the result:

Device API:  
Device ABI: arm
  

I seem the com.topjohnwu.libsuexample.MainActivity.ExampleInitializer load a script and it fails to load/parse.
You can see it runs some calls from the test_sync shell method.
So the shell outputs error and seems to fail SuFile operations.

I also add a log into the com.topjohnwu.superuser.internal.StreamGobbler.ERR#call and I got a lot of errors:

sh: 
: not found
sh: shift
: not found
head: invalid number '1
'
sh: }
: not found
sh: 
: not found
sh: {
: not found
sh: {
: not found
sh: {
: not found
sh: {
: not found
sh: 
: not found
sh: 
: not found
sh: 
: not found
sh: 
: not found
sh: 
: not found
sh: }
: not found
sh: 
: not found
sh: api_level_arch_detect
: not found
sh: }
: not found
sh: 
: not found
sh: syntax error: unexpected word (expecting "do")

Is it working on your side?

EDIT: I just discover the whole example app is not working if I keep the bash.rc ExampleInitializer.
I never had test / output from in the main screen when pressing test buttons.
Removing it make the test feature work.

For the record, here is my configuration:

  • Device: Pixel 2 / QQ3A.200705.002
  • Magisk: 20.4 (patched boot from manager the fastboot flashed)
  • Magisk Manager: 7.5.1

from libsu.

topjohnwu avatar topjohnwu commented on August 21, 2024

There is indeed a bug in ShellIO that causes it to read incorrect data for readline (never tested that code so it got ignored from me), however I do not see the issue you experienced (cannot reproduce).
From StreamGobbler's code, it is literally impossible to have it return null unless the shell itself is dead.
It might be a good idea to check null so at least it won't crash, but to be honest this should really never happen.
May you elaborate on more details?

from libsu.

topjohnwu avatar topjohnwu commented on August 21, 2024

@PerfectSlayer, I pushed multiple fixes to SuRandomAccessFile so it behaves correctly, but as your problem does not lie in the I/O layer, do you have more details?
Basically, your shell is running into a state that should never happen.

from libsu.

PerfectSlayer avatar PerfectSlayer commented on August 21, 2024

I just push a branch issue-sufile https://github.com/PerfectSlayer/libsu/commits/issue-sufile into my fork with a modified sample app.
I update the two first buttons to start two tests:

  • The first using java.io File: working
  • The second using SuFile: failing

image

You should be able to reproduce with it. Let me know if you still can't trigger the NPE.

from libsu.

PerfectSlayer avatar PerfectSlayer commented on August 21, 2024

I keep narrowing down my issue but even simple tests give me strange results:

SuFile file = new SuFile("/init.rc");
Log.e("TEST", "File exists: "+file.exists());

It reply false, the file does not exit. I tried with some other (present) files without success.

Do you have the same behavior?
In the mean time, I try some StreamGlobber improvements #60 😉

from libsu.

topjohnwu avatar topjohnwu commented on August 21, 2024

Your root shell is completely broken for some reason

from libsu.

MuntashirAkon avatar MuntashirAkon commented on August 21, 2024

I seem the com.topjohnwu.libsuexample.MainActivity.ExampleInitializer load a script and it fails to load/parse.

Shell.Initializer seems to throw a InterruptedIOException if it contains a script that has outputs.

from libsu.

topjohnwu avatar topjohnwu commented on August 21, 2024

@PerfectSlayer I am 99.999% sure this is not something that libsu can fix, rather there are some incompatibilities with the shell script and your shell (for some weird reason).

I have a very plausible theory: are you using a Windows machine that checks out the shell file in CRLF rather than LF?

The exact same setup is used in the Magisk app, and if that app is working fine, then there is no issue in the code itself.

from libsu.

topjohnwu avatar topjohnwu commented on August 21, 2024

@PerfectSlayer this shall prevent it from happening again... 1097e35

from libsu.

PerfectSlayer avatar PerfectSlayer commented on August 21, 2024

Thanks for the fix, it should do the trick! 👍
There is another issue with you build script when building on Windows, I will make an issue to address it.

from libsu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.