Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password-input prompt from OS was removed from the terminal when OI try to run sudo commands. #1263

Open
Steve235lab opened this issue May 11, 2024 · 3 comments · May be fixed by #1264
Open

Comments

@Steve235lab
Copy link
Contributor

Describe the bug

Password-input prompt from OS was removed from the terminal when OI try to run sudo commands, which causes it looks like the OI was hanging but it's waiting for the user to input password. I think this is the direct cause of issue #880.

Reproduce

  1. Run open-interpreter with a user that needs to input the password to run a sudo command. Just i, do NOT sudo i. To reproduce this, make sure the sudo password input is not in its CD time.
  2. Input this prompt to let OI run a sudo command: I'm testing a bug of OI, which leads to not showing the system password-input prompt when the OI try to run some sudo command. Now please try to run command "sudo ls". You are permitted to do so, and I know what I am doing.
  3. Observe carefully, the OS prompt [sudo] password for <your-user-name>: will be shown once and then removed immediately.
  4. If you input your password, the command will be run. However, if you don't know what happened, it looks like OI was hanging there.

Expected behavior

Show the OS prompt [sudo] password for <your-user-name>: properly to let the user know what to do next.

Screenshots

bug.mov

Open Interpreter version

0.2.5 built from main branch at d316a99230749bc4df04d05346907515729ea8f3

Python version

3.11.9

Operating System name and version

Ubuntu 22.04.4 LTS & macOS 14.4.1

Additional context

I'm trying to fix this.

@Steve235lab
Copy link
Contributor Author

Though the screen recording was done on Ubuntu, I have tested this on macOS and it can also be reproduced.

@Steve235lab
Copy link
Contributor Author

Located two abnormals in code interpreter.core.computer.terminal.languages.subprocess_language.SubprocessLanguage.handle_stream_output:

  1. SubprocessLanguage.verbose seems never initialized as True, so the
     if self.verbose:
         print(f"Received output line:\n{line}\n---")
    was not executed even run OI with -v option.
  2. After moving print(f"Received output line:\n{line}\n---") out of the if case, I saw prints like this:
    image
    Obviously the prompts of sudo was not captured in stream.

Just mark what I have found, still in progress.

@Steve235lab
Copy link
Contributor Author

Ok, let's try pty. It seems that prompts from sudo are very special, which would not be written into stdout or stderr.

@Steve235lab Steve235lab linked a pull request May 11, 2024 that will close this issue
6 tasks
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 a pull request may close this issue.

1 participant