Skip to content

Fix SSH aliases with separate path lines on tcsh#6231

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-aliases-freebsd-tcsh
Open

Fix SSH aliases with separate path lines on tcsh#6231
Copilot wants to merge 3 commits intomainfrom
copilot/fix-aliases-freebsd-tcsh

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

WP-CLI aliases with separate path: configuration fail on FreeBSD/tcsh with "Command not found" error. The issue occurs because bash-style environment variable assignment (VAR=value command) is not supported in tcsh.

Changes

  • php/WP_CLI/Runner.php: Prefix WP_CLI_RUNTIME_ALIAS assignment with env command for POSIX shell portability
  • features/aliases.feature: Add test scenario verifying env usage in SSH command generation

Example

Alias configuration that now works on tcsh:

@domain:
  ssh: domain
  path: /home/user/public_html

Generated SSH command changes from:

WP_CLI_RUNTIME_ALIAS='{"@domain":{"path":"/home/user/public_html"}}' wp @domain

To:

env WP_CLI_RUNTIME_ALIAS='{"@domain":{"path":"/home/user/public_html"}}' wp @domain

The env command is POSIX-compliant and works across bash, sh, tcsh, zsh, and other shells.

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:

  • example.com
    • Triggering command: /usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php '-d short_open_t-n (dns block)
  • nosuchhost_asdf_asdf_asdf.com
    • Triggering command: /usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php '-d short_open_t-n (dns block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>Aliases with separate path line fail on FreeBSD/tcsh</issue_title>
<issue_description>## Bug Report

Describe the current, buggy behavior

When writing a WP-CLI config yml file, we have the option of appending the WordPress root directory path to the sss: line, or putting it on it's own path: line. Both seem to work without issues. The docs show samples with both lines being used.

However, if the server we are connecting to is a FreeBSD/tcsh one, only the single concatenated line works for aliasing.

For instance, the wp @domain plugin list does not work. None of them do.

Does not work:

@domain:
  ssh: domain
  path: /home/user/public_html

Does work:

@domain
  ssh: domain/home/user/public_html

The specific output when failing is:

WP_CLI_RUNTIME_ALIAS={"@domain":{"path":"\/home\/user\/public_html"}}: Command not found.

Describe how other contributors can replicate this bug

Access to the correct type of host. I haven't tested this on either FreeBSD only, or tcsh only...

Describe what you expect as the correct outcome

No errors and command would output what is wanted.

Let us know what environment you are running this on

wp @domain cli info
OS:     FreeBSD 14.3-RELEASE-p8 FreeBSD 14.3-RELEASE-p8 GENERIC amd64
Shell:  /bin/tcsh
PHP binary:     /usr/local/bin/php
PHP version:    8.4.16
php.ini used:   /usr/local/etc/php.ini
MySQL binary:   /usr/local/bin/mysql
MySQL version:  mysql  Ver 8.0.44 for FreeBSD14.3 on amd64 (Source distribution)
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /home/user/public_html
WP-CLI packages dir:    /home/user/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.6.0

This was created per conversation had with @swissspidy on the #cli Slack Channel:
https://wordpress.slack.com/archives/C02RP4T41/p1770177817812479

</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI and others added 2 commits February 4, 2026 21:33
…env command

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 aliases with separate path line on FreeBSD/tcsh Fix SSH aliases with separate path lines on tcsh Feb 4, 2026
Copilot AI requested a review from swissspidy February 4, 2026 21:34
@swissspidy swissspidy requested a review from Copilot February 5, 2026 06:37

This comment was marked as resolved.

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

Labels

bug command:cli-alias Related to 'cli alias' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aliases with separate path line fail on FreeBSD/tcsh

2 participants