withfig / fig

Public issue tracker for Fig.
https://fig.io
MIT License
2.06k stars 63 forks source link

bug: broken remote hostname resolving #2531

Open ww7 opened 1 year ago

ww7 commented 1 year ago

Checks

Operating system

macOS Ventura 13.3.1

Expected behaviour

Tmux's configuration contains a script to resolve the hostname of remote host to show it in tmux status bar.

This is a function from tmux config:

# _hostname() {
#   pane_pid=${1:-$(tmux display -p '#{pane_pid}')}
#   pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')}
#   ssh_only=$3
#   full=$4
#   h_or_H=$5
#
#   pane_info=$(_pane_info "$pane_pid" "$pane_tty")
#   command=${pane_info#*:}
#   command=${command#*:}
#
#   ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
#   if [ -n "$ssh_or_mosh_args" ]; then
#     # shellcheck disable=SC2086
#     hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }')
#     # shellcheck disable=SC2086
#     [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }')
#
#     if ! _is_true "$full"; then
#       case "$hostname" in
#           *[a-z-].*)
#               hostname=${hostname%%.*}
#               ;;
#           127.0.0.1)
#               hostname="localhost"
#               ;;
#       esac
#     fi
#   else
#     if ! _is_true "$ssh_only"; then
#       hostname="$h_or_H"
#     fi
#   fi
#
#   printf '%s\n' "$hostname"
# }

Actual behaviour

Hostname is not showing in tmux if fig enabled. It's probably resolving, and maybe the environment is loosing a variable.

Steps to reproduce

Install configuration https://github.com/gpakosz/.tmux

Environment

fig-details:
  - 2.16.0
hardware-info:
  - model:
  - model-id:
  - chip-id: Apple M1 Pro
  - cores: 10
  - mem: 32.00 GB
os-info:
  - macOS 13.3.1 (22E772610a)
environment:
  - shell: /bin/zsh
  - terminal: wezterm
  - cwd: /Users/ww7
  - exe-path: /opt/homebrew/bin/fig
  - install-method: brew
  - env-vars:
    - FIGTERM_SESSION_ID: e0822e08-5eed-4d2a-970e-a5f8da005934
    - FIG_SET_PARENT_CHECK: 1
    - FIG_TERM: 2.16.0
    - FIG_TERM_TMUX: 2.16.0
    - PATH: ~/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/ww7/.fig/bin:/Users/ww7/.local/bin
    - SHELL: /bin/zsh
    - TERM: screen-256color
    - __CFBundleIdentifier: com.github.wez.wezterm
    - FIG_PID: 46671
    - FIG_SET_PARENT: e0822e08-5eed-4d2a-970e-a5f8da005934
mschrage commented 1 year ago

This looks like a collision between Fig's SSH functionality and your custom tmux configuration. I am not sure what the fix would look like.

Can you provide any additional logging?