Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topgrade opens too many remote terminals (with space in config) on Windows #1016

Open
3 of 7 tasks
loehden opened this issue Jan 5, 2025 · 1 comment
Open
3 of 7 tasks
Labels
C-bug Something isn't working

Comments

@loehden
Copy link

loehden commented Jan 5, 2025

Erroneous Behavior

When configuring two remote Raspberry Pis to be updated with remote_topgrades = ["pi@raspi4", "pi@raspi5"] (space after comma) on my Windows machine an run via PowerShell in WindowsTerminal, topgrade opens 3 terminal windows, sometimes two for raspi4 and sometimes two for raspi5, and one of the terminal windows cannot be closed afterwards and has to be killed via task manager. When using no space between the entries remote_topgrades = ["pi@raspi4","pi@raspi5"] it works as expected.

Expected Behavior

Open only one terminal per remote machine and close it after completion.

Steps to reproduce

  1. configure two remote machines with ``userY@machineX" as remote machines and use a space after the comma, e.g. remote_topgrades = ["pi@raspi4", "pi@raspi5"], like in the example configuration
  2. configure to only run the remotes step with only = ["remotes"]

Possible Cause (Optional)

It may be a problem with the interpretation of the user in the string. It may also have to do something with the way topgrade opens on Windows when run from a terminal. It always opens in a new terminal-like window, if this is suppressed by using either | Out-Default or | Out-File log.txtthe above behavior does not seem to occur (the DEBUG output below is from such a file).

Problem persists without calling from topgrade

  • Yes
  • No

Both machines can be connected via ssh without any flaws.

Did you run topgrade through Remote Execution

  • Yes
  • No

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

  • Yes
  • No
  • not applicable

Since it is a remote connection topic, this makes no sense here. Topgrade itself, however, runs flawless on both machines.

Configuration file (Optional)

# List of remote machines with Topgrade installed on them
remote_topgrades = ["pi@raspi4", "pi@raspi5"]

# Path to Topgrade executable on remote machines
remote_topgrade_path = ".cargo/bin/topgrade"

# Arguments to pass to SSH when upgrading remote systems
ssh_arguments = "-o ConnectTimeout=2"

# Run specific steps - same options as the command line flag
# only = ["system", "emacs"]
only = ["remotes"]

Additional Details

  • Operation System/Version
    Windows 11 24H2

  • Installation

    cargo install topgrade

  • Topgrade version (topgrade -V)
    16.0.2

Verbose Output (topgrade -v)

DEBUG Current system locale is de-DE
DEBUG Configuration at C:\Users\USER\AppData\Roaming\topgrade.toml
DEBUG Path E:/source/extern/*/ expanded to E:/source/extern/*/
DEBUG Loaded configuration: ConfigFile { include: Some(Include { paths: None }), misc: Some(Misc { pre_sudo: None, sudo_command: None, disable: None, ignore_failures: None, remote_topgrades: Some(["pi@raspi4", "pi@raspi5"]), remote_topgrade_path: Some(".cargo/bin/topgrade"), ssh_arguments: Some("-o ConnectTimeout=2"), tmux_arguments: None, set_title: None, display_time: None, assume_yes: Some(true), no_retry: None, run_in_tmux: None, tmux_session_mode: None, cleanup: None, notify_each_step: None, skip_notify: None, bashit_branch: None, only: Some([Remotes]), no_self_update: None, log_filters: None }), pre_commands: Some({}), post_commands: Some({}), commands: Some({}), python: Some(Python { enable_pip_review: None, enable_pip_review_local: None, enable_pipupgrade: None, pipupgrade_arguments: None, poetry_force_self_update: None }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, greedy_latest: None, greedy_auto_updates: None, autoremove: None, fetch_head: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, nix_env_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, bootc: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: Some(["E:/source/extern/*/"]), pull_predefined: None }), containers: Some(Containers { ignored_containers: None, runtime: None }), windows: Some(Windows { accept_all_updates: None, self_rename: Some(true), open_remotes_in_new_terminal: Some(true), wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: Some(Yarn { use_sudo: None }), deno: None, vim: Some(Vim { force_plug_update: None }), firmware: Some(Firmware { upgrade: None }), vagrant: Some(Vagrant { directories: None, power_on: None, always_suspend: None }), flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }), lensfun: Some(Lensfun { use_sudo: None }), julia: None }
DEBUG Version: 16.0.2
DEBUG OS: x86_64-pc-windows-msvc
DEBUG Args { inner: ["C:\\Users\\USER\\.cargo\\bin\\topgrade.exe", "-v"] }
DEBUG Binary path: Ok("C:\\Users\\USER\\.cargo\\bin\\topgrade.exe")
DEBUG self-update Feature Enabled: false
DEBUG Configuration: Config { opt: CommandLineArgs { edit_config: false, show_config_reference: false, run_in_tmux: false, 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: Some(Include { paths: None }), misc: Some(Misc { pre_sudo: None, sudo_command: None, disable: None, ignore_failures: None, remote_topgrades: Some(["pi@raspi4", "pi@raspi5"]), remote_topgrade_path: Some(".cargo/bin/topgrade"), ssh_arguments: Some("-o ConnectTimeout=2"), tmux_arguments: None, set_title: None, display_time: None, assume_yes: Some(true), no_retry: None, run_in_tmux: None, tmux_session_mode: None, cleanup: None, notify_each_step: None, skip_notify: None, bashit_branch: None, only: Some([Remotes]), no_self_update: None, log_filters: None }), pre_commands: Some({}), post_commands: Some({}), commands: Some({}), python: Some(Python { enable_pip_review: None, enable_pip_review_local: None, enable_pipupgrade: None, pipupgrade_arguments: None, poetry_force_self_update: None }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, greedy_latest: None, greedy_auto_updates: None, autoremove: None, fetch_head: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, nix_env_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, bootc: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: Some(["E:/source/extern/*/"]), pull_predefined: None }), containers: Some(Containers { ignored_containers: None, runtime: None }), windows: Some(Windows { accept_all_updates: None, self_rename: Some(true), open_remotes_in_new_terminal: Some(true), wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: Some(Yarn { use_sudo: None }), deno: None, vim: Some(Vim { force_plug_update: None }), firmware: Some(Firmware { upgrade: None }), vagrant: Some(Vagrant { directories: None, power_on: None, always_suspend: None }), flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }), lensfun: Some(Lensfun { use_sudo: None }), julia: None }, allowed_steps: [Remotes] }
DEBUG Detected "C:\\Program Files\\PowerShell\\7\\pwsh.exe" as "pwsh"
DEBUG Path "C:\\Users\\USER\\AppData\\Roaming\\.emacs.d" doesn't exist
DEBUG Cannot find "doas"
DEBUG Detected "C:\\Windows\\System32\\sudo.exe" as "sudo"
DEBUG Current exe in "C:\\Users\\USER\\.cargo\\bin\\topgrade.exe". Moving it to "C:\\Users\\USER\\AppData\\Local\\Temp\\.tmpVJQFHy\\topgrade.exe"
DEBUG Executing command `hostname`
DEBUG Step "Remote (pi@raspi4)"
DEBUG Detected "C:\\Windows\\System32\\OpenSSH\\ssh.exe" as "ssh"
DEBUG Running "wt" "ssh" "-t" "pi@raspi4" "-o" "ConnectTimeout=2" "env" "TOPGRADE_PREFIX=pi@raspi4" "$SHELL" "-lc" ".cargo/bin/topgrade" "--keep"
DEBUG Executing command `wt ssh -t pi@raspi4 -o 'ConnectTimeout=2' env 'TOPGRADE_PREFIX=pi@raspi4' '$SHELL' -lc .cargo/bin/topgrade --keep`
DEBUG Executing command `hostname`
DEBUG Step "Remote (pi@raspi5)"
DEBUG Detected "C:\\Windows\\System32\\OpenSSH\\ssh.exe" as "ssh"
DEBUG Running "wt" "ssh" "-t" "pi@raspi5" "-o" "ConnectTimeout=2" "env" "TOPGRADE_PREFIX=pi@raspi5" "$SHELL" "-lc" ".cargo/bin/topgrade" "--keep"
DEBUG Executing command `wt ssh -t pi@raspi5 -o 'ConnectTimeout=2' env 'TOPGRADE_PREFIX=pi@raspi5' '$SHELL' -lc .cargo/bin/topgrade --keep`
ÔÇòÔÇò 15:44:08 - Summary ÔÇòÔÇò
Remote (pi@raspi4): SKIPPED: Remote Topgrade launched in an external terminal
Remote (pi@raspi5): SKIPPED: Remote Topgrade launched in an external terminal
DEBUG Desktop notification: Topgrade finished successfully
DEBUG Moved Topgrade back from "C:\\Users\\USER\\AppData\\Local\\Temp\\.tmpVJQFHy\\topgrade.exe" to "C:\\Users\\USER\\.cargo\\bin\\topgrade.exe"
@loehden loehden added the C-bug Something isn't working label Jan 5, 2025
@loehden
Copy link
Author

loehden commented Jan 9, 2025

I just recognized that the erroneous behavior also most of the times occurs, when no space is used in the configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant