Skip to content
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
This repository was archived by the owner on Jan 15, 2026. It is now read-only.

pr #387 ('su -c') seems to break command execution for me #405

Closed

Description

@v0lker

#387 moves from echo <command> | su to su -c <command>

su doesn't know about the -c option, at least on my test platform with an android q preview, which uses android's own system/extras/su/su.cpp

evil_platform:/ # which su
/system/xbin/su

and that's the only one.. on that machine.

Activity

  1. changed the title [-]commit #387 ('su -c') seems to break command execution for me[/-] [+]pr #387 ('su -c') seems to break command execution for me[/+] on Jul 25, 2019
  2. marcbonnici commented on Jul 26, 2019

    @marcbonnici
    Collaborator

    Would you be able to provide the version of su that you are using and also the error output that attempting to use that parameter produces?

  3. v0lker commented on Jul 29, 2019

    @v0lker
    ContributorAuthor

    i'm using a different version but visually, it looks like this one: https://android.googlesource.com/platform/system/extras/+/refs/tags/android-q-preview-5/su/su.cpp

    the error message is su: invalid uid/gid '-c'

  4. marcbonnici commented on Jul 30, 2019

    @marcbonnici
    Collaborator

    A fallback mechanism has been added with #409, would you be able to try this out and see if it resolves your issue?

  5. v0lker commented on Jul 30, 2019

    @v0lker
    ContributorAuthor

    thanks, that seems to work for me:

    [ins] In [6]: a = devlib.AndroidTarget(working_directory=s)
    [...]
    [ins] In [8]: a.execute("whoami")         
    Out[8]: 'shell\n'
    
    [ins] In [9]: a.execute("whoami", as_root=True)                                     
    Out[9]: 'root\n'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions