Skip to content

etc/ghostel.zsh fails to parse when user has an ssh alias #155

@aaronjensen

Description

@aaronjensen

etc/ghostel.zsh:44 defines the outbound-ssh wrapper with POSIX function syntax:

ssh() {
    ...
}

Zsh expands aliases at parse time, so any user who has aliased ssh before the integration file is sourced will see the whole file fail to parse. With alias ssh='TERM=xterm-256color ssh' in my zsh config, sourcing ghostel.zsh produces:

.../etc/ghostel.zsh:44: parse error near `()'

The parse error fires regardless of GHOSTEL_SSH_INSTALL_TERMINFO, because zsh parses the entire if ... fi block (including the function definition) at source time. Minimal repro:

zsh -c 'alias ssh="TERM=xterm-256color ssh"; ssh() { :; }'
# zsh:1: parse error near `()'

Easy fix — switch to ksh-style function syntax, which has no parens for the alias to expand against:

function ssh {
    ...
}

Or defensively unalias ssh 2>/dev/null before the definition.

etc/ghostel.bash:81 has the same ssh() { ... } pattern. I didn't verify whether bash hits the same issue under realistic sourcing conditions, but worth auditing together.

Ghostel version: 0.16.x (dakra/ghostel master as of 2026-04-20). zsh 5.9 on macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions