topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.96k stars 131 forks source link

unknown command: attach-client #928

Open rabin-io opened 1 day ago

rabin-io commented 1 day ago

Erroneous Behavior

# topgrade
unknown command: attach-client

Expected Behavior

Just run

Steps to reproduce

# ~/.config/topgrade.d/overwrites.toml
[misc]

run_in_tmux = true
skip_notify = true
only = ["self_update", "system", "flatpak", "firmware"]

Problem persists without calling from topgrade

Did you run topgrade through Remote Execution

If yes, does the issue still occur when you run topgrade directlly in your remote host

Configuration file (Optional)

[misc]

run_in_tmux = true
tmux_session_mode = "attach_if_not_in_session"
skip_notify = true
only = ["self_update", "system", "flatpak", "firmware"]

Additional Details

Verbose Output (topgrade -v)

root@localhost:~# topgrade -vt
DEBUG Current system locale is en-US
DEBUG Found additional (directory) configuration file at /root/.config/topgrade.d/overwrites.toml
DEBUG Version: 16.0.0
DEBUG OS: x86_64-unknown-linux-gnu
DEBUG Args { inner: ["topgrade", "-vt"] }
DEBUG Binary path: Ok("/usr/local/bin/topgrade")
DEBUG self-update Feature Enabled: true
DEBUG Configuration: Config { opt: CommandLineArgs { edit_config: false, show_config_reference: false, run_in_tmux: true, cleanup: false, dry_run: false, no_retry: false, disable: [], only: [], custom_commands: [], env: [], verbose: true, keep_at_end: false, skip_notify: false, yes: None, disable_predefined_git_repos: false, config: None, remote_host_limit: None, show_skipped: false, log_filter: "warn", gen_completion: None, gen_manpage: false, no_self_update: false }, config_file: ConfigFile { include: None, misc: Some(Misc { pre_sudo: None, sudo_command: None, disable: None, ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: None, no_retry: None, run_in_tmux: None, tmux_session_mode: Some(AttachIfNotInSession), cleanup: None, notify_each_step: None, skip_notify: Some(true), bashit_branch: None, only: Some([SelfUpdate, System, Flatpak, Firmware]), no_self_update: None, log_filters: None }), pre_commands: None, post_commands: None, commands: None, python: None, composer: None, brew: None, linux: None, git: None, containers: None, windows: None, npm: None, yarn: None, vim: None, firmware: None, vagrant: None, flatpak: None, distrobox: None, lensfun: None }, allowed_steps: [SelfUpdate, System, Flatpak, Firmware] }
DEBUG Detected "/usr/bin/tmux" as "tmux"
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade`
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade-1`
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade-2`
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade-3`
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade-4`
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade-5`
DEBUG Executing command `/usr/bin/tmux has-session -t topgrade-6`
DEBUG Executing command `/usr/bin/tmux new-session -d -s topgrade-6 -n topgrade 'env '\''TOPGRADE_KEEP_END=1'\'' '\''TOPGRADE_INSIDE_TMUX=1'\'' topgrade -vt'`
unknown command: attach-client
lucaspar commented 22 hours ago

Same here. It seems it was introduced in #901.

https://github.com/topgrade-rs/topgrade/commit/4455ecdf94350f41bde5ca9f5b3c206a7dda5d20

A current workaround is to disable run_in_tmux.

SteveLauC commented 20 hours ago

Gentle ping on @wetfloo, could you please figure out the version of Tmux where this command was added, I think we need to do a check here

wetfloo commented 8 hours ago

@SteveLauC Welp, my bad, this command actually never existed. It seems that I've messed up and it should be attach-session instead of attach-client

wetfloo commented 8 hours ago

This is how it can be fixed

diff --git a/src/steps/tmux.rs b/src/steps/tmux.rs
index 1914719..f699886 100644
--- a/src/steps/tmux.rs
+++ b/src/steps/tmux.rs
@@ -162,7 +162,7 @@ pub fn run_in_tmux(config: TmuxConfig) -> Result<()> {
                 println!("{}", t!("Topgrade launched in a new tmux session"));
                 return Ok(());
             } else {
-                tmux.build().args(["attach-client", "-t", &session]).exec()
+                tmux.build().args(["attach-session", "-t", &session]).exec()
             }
         }

@@ -170,7 +170,7 @@ pub fn run_in_tmux(config: TmuxConfig) -> Result<()> {
             if is_inside_tmux {
                 tmux.build().args(["switch-client", "-t", &session]).exec()
             } else {
-                tmux.build().args(["attach-client", "-t", &session]).exec()
+                tmux.build().args(["attach-session", "-t", &session]).exec()
             }
         }
     };