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

pssh formula is outdated, failing for python3 with -A flag (possibly other flags as well) #76878

Closed
cahootsnboots opened this issue May 8, 2021 · 5 comments
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@cahootsnboots
Copy link

brew gist-logs <formula> link OR brew config AND brew doctor output

~ brew doctor
Your system is ready to brew.
➜  ~ brew gist-logs pssh
Error: No logs.


### 

- [X] I ran `brew update` and am still able to reproduce my issue.
- [X] I have resolved all warnings from `brew doctor` and that did not fix my problem.

### What were you trying to do (and why)?

I was trying to run a bulk operation to several password-protected remote servers (and no, they _cannot_ be changed to be non-password protected over ssh). This is unrelated to brew itself and related to the formula `pssh`. 

- The formula for `pssh` is rather old and outdated, it's an archive on google code that's about... 10+ years old and no longer receives updates. Not that it needs some bleeding-edge maintenance, but simple changes for the last 10 years and sunsetting of python 2

    -  Current `pssh` formula: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/pssh.rb

    - Where above formula points to (old and no longer maintained): https://code.google.com/archive/p/parallel-ssh/ 

  
The original authors no longer maintain it, but a fairly good fork has come along, especially as it looks like only various Linux distros were patching it. I found some references in Arch Linux repos, and Fedora... but they're all cursory and not well maintained. 

Instead, I propose the `pssh` formula should instead use this github repository which has more recent updates, and I've tested on my machine as working: 
- See this github for the best-maintained version I could find: https://github.com/lilydjwg/pssh 

Thanks!

### What happened (include all command output)?

This is a known bug with pssh as it was originally written in python 2 (as far as I know) and no longer actively maintained.

The `-A` flag fails with the following exception.

pssh -A -x "-o StrictHostKeyChecking=no" -H "<SOME_IP_OR_HOST>" --inline-stdout --timeout=60 'echo $(hostname)'


Warning: do not enter your password if anyone else has superuser
privileges or access to your account.
Password:

Traceback (most recent call last):
File "/usr/local/bin/pssh", line 121, in
do_pssh(hosts, cmdline, opts)
File "/usr/local/bin/pssh", line 92, in do_pssh
statuses = manager.run()
File "/usr/local/Cellar/pssh/2.3.1_3/libexec/lib/python3.9/site-packages/psshlib/manager.py", line 75, in run
self.iomap.poll(wait)
File "/usr/local/Cellar/pssh/2.3.1_3/libexec/lib/python3.9/site-packages/psshlib/manager.py", line 257, in poll
handler(fd, self)
File "/usr/local/Cellar/pssh/2.3.1_3/libexec/lib/python3.9/site-packages/psshlib/askpass_server.py", line 72, in handle_write
bytes_written = conn.send(buffer)
TypeError: a bytes-like object is required, not 'str'


### What did you expect to happen?

The password flag `-A` should work as intended, but the version of pssh homebrew is using is old and fails on modern versions of python, like 3.9

### Step-by-step reproduction instructions (by running `brew` commands)

```shell
brew install pssh

# Wait for pssh to install, try to run an ssh command using a password with the `-A` flag
# Run command as:

pssh -A -x "-o StrictHostKeyChecking=no" -H "<SOME_IP_OR_HOST>" --inline-stdout --timeout=60 'echo $(hostname)'


Warning: do not enter your password if anyone else has superuser
privileges or access to your account.
Password:
Traceback (most recent call last):
  File "/usr/local/bin/pssh", line 121, in <module>
    do_pssh(hosts, cmdline, opts)
  File "/usr/local/bin/pssh", line 92, in do_pssh
    statuses = manager.run()
  File "/usr/local/Cellar/pssh/2.3.1_3/libexec/lib/python3.9/site-packages/psshlib/manager.py", line 75, in run
    self.iomap.poll(wait)
  File "/usr/local/Cellar/pssh/2.3.1_3/libexec/lib/python3.9/site-packages/psshlib/manager.py", line 257, in poll
    handler(fd, self)
  File "/usr/local/Cellar/pssh/2.3.1_3/libexec/lib/python3.9/site-packages/psshlib/askpass_server.py", line 72, in handle_write
    bytes_written = conn.send(buffer)
TypeError: a bytes-like object is required, not 'str'
@cahootsnboots cahootsnboots added the bug Reproducible Homebrew/homebrew-core bug label May 8, 2021
@cahootsnboots
Copy link
Author

TL;DR version :) -- pssh fails on modern python3 with password -A flag (and other improvements) and is no longer maintained. Consider removing the google code repo, instead use something like: https://github.com/lilydjwg/pssh

@bayandin
Copy link
Member

Consider removing the google code repo, instead use something like: https://github.com/lilydjwg/pssh

We can't just replace the original version with someone's fork. As far as I can see on repology most of the distribs/package manages using the original version as well: https://repology.org/project/pssh/versions.

You could probably help to get approval from the original maintainers to mark https://github.com/lilydjwg/pssh (or another fork) as a successor. I see there're several open tickets regarding it, like lilydjwg/pssh#110 and lilydjwg/pssh#114

Meantime, I'll have a look and try to adopt arch linux patches for homebrews pssh

@cahootsnboots
Copy link
Author

Thanks, @bayandin, much appreciated. I figured it wouldn't be dropped for the fork but no harm in asking. Yeah, if I get some extra time then I'll see if I can push on getting the new successor, no need to wait on me though so let me know when you'd like to close this.

@bayandin
Copy link
Member

No problem, and thanks for the report!
I'll close the issue when the fix will be merged

@bayandin
Copy link
Member

Should be fixed

@github-actions github-actions bot added the outdated PR was locked due to age label Jun 11, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants