Skip to content

fix(RemoteCmdRunner): fix scp destination string #10585

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

Merged
merged 1 commit into from
Apr 8, 2025

Conversation

dimakr
Copy link
Contributor

@dimakr dimakr commented Apr 3, 2025

Scp command behaviour has changed on systems that have newer openssh version (v9.0+,
like in Ubuntu24) compared to older version (e.g. v8.*, Like in Ubuntu22). Newer openssh
versions use SFTP protocol by default. This affected the behavior of RemoteCmdRunner
send_files and receive_files API, where we quote path portion of desctination to be sure
that we can run the command with multiple remote paths.

This change removes single quotes around the destination parameter in scp command.
This helps to avoid improper shell expansion of remote path portion of destination.

Fixes: #10584

Testing

  • pr-provision-test
  • executed a test locally (i.e environment uses local machine as sct-runner and runs test on remote scylla cluster) - the issue was observed on such setup

PR pre-checks (self review)

  • I added the relevant backport labels
  • I didn't leave commented-out/debugging code

Reminders

  • Add New configuration option and document them (in sdcm/sct_config.py)
  • Add unit tests to cover my changes (under unit-test/ folder)
  • Update the Readme/doc folder relevant to this change (if needed)

@dimakr dimakr added the backport/none Backport is not required label Apr 3, 2025
@dimakr dimakr added the test-provision-aws Run provision test on AWS label Apr 3, 2025
@dimakr dimakr marked this pull request as ready for review April 3, 2025 10:04
@dimakr dimakr requested review from Copilot and soyacz April 3, 2025 10:04
Copy link

@Copilot 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.

Pull Request Overview

This PR updates the scp command in RemoteCmdRunner to enforce usage of the legacy scp protocol by adding the '-O' flag, addressing differences between Ubuntu 24.04 and 22.04.

  • Updated scp command to include '-O'.
  • Ensures compatibility with both newer openssh versions (using SFTP by default) and older versions (ignoring the flag).

@dimakr dimakr marked this pull request as draft April 3, 2025 22:03
@dimakr
Copy link
Contributor Author

dimakr commented Apr 3, 2025

Turns out not all flavors of scp ignore unknown option, like the package for Ubuntu for instance

Scp command behaviour has changed on systems that have newer openssh version (v9.0+,
like in Ubuntu24) compared to older version (e.g. v8.*, Like in Ubuntu22). Newer openssh
versions use SFTP protocol by default. This affected the behavior of RemoteCmdRunner
send_files and receive_files API, where we quote path portion of desctination to be sure
that we can run the command with multiple remote paths.

This change removes single quotes around the destination parameter in scp command.
This helps to avoid improper shell expansion of remote path portion of destination.

Fixes: scylladb#10584
@dimakr dimakr force-pushed the fix_scp_command_remote_path branch from 9f7f0c7 to c6926f5 Compare April 4, 2025 12:17
@dimakr dimakr marked this pull request as ready for review April 4, 2025 18:38
@dimakr dimakr requested a review from soyacz April 4, 2025 18:38
@dimakr dimakr changed the title fix(RemoteCmdRunner): run scp with legacy protocol if applicable fix(RemoteCmdRunner): fix scp destination string Apr 4, 2025
Copy link
Contributor

@soyacz soyacz left a comment

Choose a reason for hiding this comment

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

Seems should be fine - we have 2 usages of this and anyway we pass double-quoted path for remote and using quote() for local destination, so looks like we added another single-quotes unnecessarily and it worked only because we never had special chars/space in local dest (which is usually /tmp).
LGTM

Copy link
Contributor

@vponomaryov vponomaryov left a comment

Choose a reason for hiding this comment

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

LGTM

@soyacz soyacz merged commit 3233f97 into scylladb:master Apr 8, 2025
8 checks passed
@dimakr dimakr deleted the fix_scp_command_remote_path branch April 21, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/none Backport is not required promoted-to-master test-provision-aws Run provision test on AWS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(send|receive)_files API of RemoteCmdRunner is failing on ubuntu24 when scp is used as transport
4 participants