Skip to content

Move pts to rust, and avoid using thread#8927

Merged
topjohnwu merged 3 commits intomasterfrom
pump
Apr 11, 2025
Merged

Move pts to rust, and avoid using thread#8927
topjohnwu merged 3 commits intomasterfrom
pump

Conversation

@yujincheng08
Copy link
Copy Markdown
Collaborator

@yujincheng08 yujincheng08 commented Apr 9, 2025

After this, only one thread when running su:

$ su
# ls /proc/$(pidof -s su)/task/ | wc -l
1

Also fix:

  • wrong format of su | cat
  • wrong output of echo id | su
  • cannot crtl + z when su -c sleep 100

@yujincheng08 yujincheng08 marked this pull request as ready for review April 9, 2025 13:48
@yujincheng08 yujincheng08 requested review from Copilot and vvb2060 April 9, 2025 13:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • native/src/Android.mk: Language not supported
Comments suppressed due to low confidence (1)

native/src/core/su/pts.rs:79

  • Consider checking the return value of signalfd to handle the potential error case if it returns -1.
signalfd(-1, &mask, SFD_CLOEXEC)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • native/src/Android.mk: Language not supported

Comment thread native/src/core/su/su.cpp
Comment on lines +243 to +244
// output to stdout, which cause the target process lost input.
pump_tty(ptmx, (atty & ATTY_IN) ? ptmx : -1);
Copy link

Copilot AI Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment contains grammatical errors ('cause' should be 'causes' and 'lost' should be 'lose') to improve clarity.

Suggested change
// output to stdout, which cause the target process lost input.
pump_tty(ptmx, (atty & ATTY_IN) ? ptmx : -1);
// output to stdout, which causes the target process to lose input.

Copilot uses AI. Check for mistakes.
@topjohnwu topjohnwu merged commit 4864c11 into master Apr 11, 2025
53 of 54 checks passed
@topjohnwu topjohnwu deleted the pump branch April 11, 2025 20:21
@aviraxp
Copy link
Copy Markdown
Collaborator

aviraxp commented May 9, 2025

@topjohnwu I am not sure if you you have noticed, but last patch in this series effectively breaks su -c behavior that some apps have been relying on since 2012 (appending tty is koush's su default behaviour since then). Now these apps cannot react to external signals.

Yes, I know it is different from linux su behaviour, but su is not posix, there isn't a standard for this. At least, this behavior change should be noticed in change log.

agnostic-apollo added a commit to agnostic-apollo/sudo that referenced this pull request May 12, 2025
cfmakeraw(&termios);

if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &termios) < 0) {
// https://blog.zhanghai.me/fixing-line-editing-on-android-8-0/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this note

@Clawcore64
Copy link
Copy Markdown

Круто!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants