Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Fix SSH alias tilde (~) expansion issue

  • Explore repository structure and understand the issue
  • Locate relevant code in Runner.php and utils.php
  • Identify that expand_tilde_path() function already exists
  • Add new escapeshellarg_preserve_tilde() function to utils.php
  • Update Runner.php to use the new function for SSH/Vagrant paths
  • Add unit tests for the new function
  • Add Behat integration test for tilde expansion in SSH aliases
  • Run full test suite to verify no regressions
  • Run code review and address feedback
  • Run security scan (no issues found)
  • Add explicit scheme check for clarity and safety
  • Add test case for ~/ edge case
  • Simplify tilde check using substr() for better readability
Original prompt

This section details on the original issue you should resolve

<issue_title>ssh alias does not expand ~ tilde char and does not find path</issue_title>
<issue_description>Well, these kind of things make me hungry.

The ssh alias can not understand the tilde ~ character.
I have a line similar to this in ~/.wp-cli/config.yml:

ssh: dh-k1
  path: ~/sites/example.com/www

resulting error:
Error: This does not seem to be a WordPress installation.

when I change the config to

ssh: dh-k1
  path: /home/user/sites/example.com/www

everything works.

</issue_description>

Comments on the Issue (you are @copilot in this section)

@swissspidy Related: #5005

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 1, 2026 19:34
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ssh alias not expanding tilde character Fix tilde expansion in SSH alias paths Feb 1, 2026
Copilot AI requested a review from swissspidy February 1, 2026 19:37
@codecov

This comment was marked as resolved.

@swissspidy swissspidy requested a review from Copilot February 2, 2026 01:58
@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • abc4cb.example.com
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/wp-cli/wp-cli/bin/../php/boot-fs.php core install-network --title=WP CLI Network --subdomains=1 ache-6.9/licenseREDACTED ache-6.9/readme.html ache-6.9/wp-actish ache-6.9/wp-admi/home/REDACTED/work/wp-cli/wp-cli/bin/wp ache-6.9/wp-blog@foo ache-6.9/wp-commoption ache�� 49215&#39; ache-6.9/wp-cronREDACTED ache-6.9/wp-includes ache-6.9/wp-linkcp ache-6.9/wp-load-r ache-6.9/wp-logi/tmp/wp-cli-test-core-install-cache-6.9/install_c4775ff9eceb34ebd92a3deef4bd8d0b--title=WP CLI Site ache-6.9/wp-mail/tmp/wp-cli-test-core-install-cache-6.9/install_c4775ff9eceb34ebd92a3deef4bd8d0b--admin_user=admin (dns block)
  • example.com
    • Triggering command: /usr/bin/php /usr/bin/php /home/REDACTED/work/wp-cli/wp-cli/bin/../php/boot-fs.php core install --url=REDACTED --title=WP CLI Site --admin_user=admin --admin_email=admin@example.com --admin_password=password1 --skip-email (dns block)
  • host
    • Triggering command: /usr/bin/ssh ssh -i identityfile.key -T -vvv user@host cd &#39;/path/to/wordpress&#39;; WP_CLI_RUNTIME_ALIAS=&#39;{&#34;@foo&#34;:{&#34;key&#34;:&#34;identityfile.key&#34;}}&#39; wp @foo &#39;--debug&#39; &#39;--version&#39; ndor/bin/git (dns block)
    • Triggering command: /usr/bin/ssh ssh -T -vvv user@host cd ~/&#39;sites/example.com/www&#39;; wp &#39;--debug&#39; &#39;--version&#39; (dns block)
  • proxyhost
    • Triggering command: /usr/bin/ssh ssh -vvv -W [host]:22 proxyhost (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review February 3, 2026 15:02
@swissspidy swissspidy requested a review from a team as a code owner February 3, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ssh alias does not expand ~ tilde char and does not find path

2 participants