Skip to content

Conversation

@timway
Copy link

@timway timway commented Nov 12, 2025

SUMMARY
  • Cisco SCP server will close the channel after retreiving a file and calling ssh_scp_pull_request will return -1 and raise an exception aborting get

Fixes #785

ISSUE TYPE
  • Bugfix Pull Request

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 12, 2025
@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/ansible-pylibssh-786
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@timway timway force-pushed the remove-eof-check branch 2 times, most recently from 7527685 to 09857ac Compare November 12, 2025 04:35
* Cisco SCP server will close the channel after retreiving a file and calling `ssh_scp_pull_request` will return `-1` and raise an exception aborting `get`
Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

This would also require a test.

@@ -0,0 +1,2 @@
Remove the SCP EOF message check in the ``get`` method to allow libssh clients
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using a TODO-list style imperative mood, use the writing style that explains the effect for the end-users compared to the previous release as if this is already included in a release. Sometimes, using the past tense helps.

Copy link
Member

Choose a reason for hiding this comment

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

Here's where you can see the surrounding writing style to adjust your release note: https://ansible-pylibssh--786.org.readthedocs.build/en/786/changelog/#changelog.

@@ -0,0 +1,2 @@
Remove the SCP EOF message check in the ``get`` method to allow libssh clients
get files from Cisco SCP servers. -- by :user:`timway`.
Copy link
Member

Choose a reason for hiding this comment

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

Avoid periods right before the em dash.

Suggested change
get files from Cisco SCP servers. -- by :user:`timway`.
get files from Cisco SCP servers -- by :user:`timway`.

Copy link
Member

Choose a reason for hiding this comment

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

Additionally, symlink this note to 785.bugfix.rst

@webknjaz
Copy link
Member

cc @Jakuje could you check this out?

@Jakuje
Copy link
Contributor

Jakuje commented Nov 13, 2025

Given that the CI with OpenSSH is happy about this, I think it is ok.

Out of the curiosity, do you have more information what is the libssh returning with the cisco case on the line you removed? From my reading of the code, its something I would expect it should work, but I assume the timing or order of the messages is different from the OpenSSH case.

@timway
Copy link
Author

timway commented Nov 13, 2025

Thanks @Jakuje and @webknjaz ! I'll work on rewording and linking of the changelog. I also looked at trying to get a test case that closes the channel after the bytes are read out but I haven't landed on something that works.

Lastly we could keep the EOF check but gate it behind a check on the channel itself. I can look at that as well. In the linked issue I copied in the -vvvv output from the Cisco case. It does send an EOF and then closes the channel. I'm assuming it's a race condition with my older Cisco switches that work intermittently but fail 100% of the time on newer IOS-XE models. I'm thinking the EOF and channel close messages are handled out of band of the get operation and complete prior to reaching the check on the channel for an EOF. In the Cisco case the rc of the EOF check in the Cisco case is -1 and does not match the EOF value so it fails and asserts.

@Jakuje
Copy link
Contributor

Jakuje commented Nov 13, 2025

Lastly we could keep the EOF check but gate it behind a check on the channel itself

If this is possible, I think this would be preferred, if it could work. Thank you for digging into this!

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

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected request: b'End of file while reading string' Against Cisco IOS-XE Devices During SCP File Retrieval

3 participants