topgrade-rs / topgrade

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

tries and fails oh-my-zsh step, even though oh-my-zsh is not installed, when running in ssh #587

Closed Un1q32 closed 10 months ago

Un1q32 commented 11 months ago

Erroneous Behavior

oh-my-zsh step is tried and fails when topgrade is run over ssh, even though oh-my-zsh is not installed.

The failing command seems to run right at the end of another step, instead of being a separate step with its own banner with the timestamp and name like normal. On my Pi running Debian 12 it runs at the end of the system upgrade step, on my main Fedora machine it runs at the end of the flatpak system packages step, on my macbook pro running MacOS 14 with OCLP it runs at the end of the brew cask step.

Screenshot 2023-10-19 at 10 14 05 PM

Expected Behavior

oh-my-zsh step should not run

Steps to reproduce

https://github.com/OldWorldOrdr/dotfiles has my full zsh config

Possible Cause (Optional)

I know something similar used to happen in older versions, but that was fixed my not having the $ZSH variable set, not anymore.

I think the issue is the check for if oh-my-zsh should be run at all is failing.

Problem persists without calling from topgrade

The command zsh -c 'source /home/joey/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH' that is being run exits with code 1 even when not called from topgrade, but the bug is that it produces an error

Did you run topgrade through Remote Execution

Configuration file (Optional)

# Include any additional configuration file(s)
# [include] sections are processed in the order you write them
# Files in $CONFIG_DIR/topgrade.d/ are automatically included before this file
[include]
#paths = ["/etc/topgrade.toml"]

[misc]
# Don't ask for confirmations
#assume_yes = true

# Disable specific steps - same options as the command line flag
disable = ["node", "system", "cargo", "pip3"]

# Ignore failures for these steps
#ignore_failures = ["powershell"]

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

# Do not ask to retry failed steps (default: false)
#no_retry = true

# Sudo command to be used
#sudo_command = "sudo"

# Run `sudo -v` to cache credentials at the start of the run
# This avoids a blocking password prompt in the middle of an unattended run
#pre_sudo = false

# Run inside tmux
#run_in_tmux = true

# List of remote machines with Topgrade installed on them
#remote_topgrades = ["toothless", "pi", "parnas"]

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

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

# Arguments to pass tmux when pulling Repositories
#tmux_arguments = "-S /var/tmux.sock"

# Do not set the terminal title
#set_title = false

# Display the time in step titles
# display_time = true

# Cleanup temporary or old files
#cleanup = true

# Skip sending a notification at the end of a run
#skip_notify = true

# Whether to self update (this is ignored if the binary has been built without self update support, available also via setting the environment variable TOPGRADE_NO_SELF_UPGRADE)
#no_self_update = true

# Extra Home Manager arguments
#home_manager_arguments = ["--flake", "file"]

# Commands to run before anything
[pre_commands]
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"

# Commands to run after anything
[post_commands]
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"

# Custom commands
[commands]
#"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
#"Custom command using interactive shell (unix)" = "-i vim_upgrade"

[python]
#enable_pip_review = true                         ###disabled by default
#enable_pip_review_local = true                   ###disabled by default
#enable_pipupgrade = true                         ###disabled by default
#pipupgrade_arguments = "-y -u --pip-path pip"    ###disabled by default

[composer]
#self_update = true

[brew]
#greedy_cask = true
#autoremove = true

[linux]
# Arch Package Manager to use. Allowed values: autodetect, aura, garuda_update, pacman, pamac, paru, pikaur, trizen, yay.
#arch_package_manager = "pacman"
# Arguments to pass yay (or paru) when updating packages
#yay_arguments = "--nodevel"
# Arguments to pass dnf when updating packages
#dnf_arguments = "--refresh"
#aura_aur_arguments = "-kx"
#aura_pacman_arguments = ""
#garuda_update_arguments = ""
#show_arch_news = true
#trizen_arguments = "--devel"
#pikaur_arguments = ""
#pamac_arguments = "--no-devel"
#enable_tlmgr = true
#emerge_sync_flags = "-q"
#emerge_update_flags = "-uDNa --with-bdeps=y world"
#redhat_distro_sync = false
#suse_dup = false
#rpm_ostree = false
#nix_arguments = "--flake"

[git]
#max_concurrency = 5
# Additional git repositories to pull
#repos = [
#    "~/src/*/",
#    "~/.config/something"
#]

# Don't pull the predefined git repos
#pull_predefined = false

# Arguments to pass Git when pulling Repositories
#arguments = "--rebase --autostash"

[windows]
# Manually select Windows updates
#accept_all_updates = false
#open_remotes_in_new_terminal = true
#wsl_update_pre_release = true
#wsl_update_use_web_download = true

# Causes Topgrade to rename itself during the run to allow package managers
# to upgrade it. Use this only if you installed Topgrade by using a package
# manager such as Scoop or Cargo
#self_rename = true

[npm]
# Use sudo if the NPM directory isn't owned by the current user
#use_sudo = true

[yarn]
# Run `yarn global upgrade` with `sudo`
#use_sudo = true

[vim]
# For `vim-plug`, execute `PlugUpdate!` instead of `PlugUpdate`
#force_plug_update = true

[firmware]
# Offer to update firmware; if false just check for and display available updates
#upgrade = true

[vagrant]
# Vagrant directories
#directories = []

# power on vagrant boxes if needed
#power_on = true

# Always suspend vagrant boxes instead of powering off
#always_suspend = true

[flatpak]
# Use sudo for updating the system-wide installation
#use_sudo = true

[distrobox]
#use_root = false
#containers = ["archlinux-latest"]

Additional Details

Verbose Output (topgrade -v)

DEBUG Configuration at /Users/joey/.config/topgrade.toml
DEBUG Version: 13.0.0
DEBUG OS: x86_64-apple-darwin
DEBUG Args { inner: ["topgrade", "-v"] }
DEBUG Binary path: Ok("/Users/joey/.local/bin/topgrade")
DEBUG self-update Feature Enabled: true
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: Some([Node, System, Cargo, Pip3]), 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, cleanup: None, notify_each_step: None, skip_notify: None, bashit_branch: None, only: None, 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 }), composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: 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, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: None, pull_arguments: None, push_arguments: None, repos: None, pull_only_repos: None, push_only_repos: None, pull_predefined: None }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None, wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: Some(Yarn { use_sudo: 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 }) }, allowed_steps: [AM, AppMan, Asdf, Atom, Bin, Bob, BrewCask, BrewFormula, Bun, Chezmoi, Chocolatey, Choosenim, Composer, Conda, ConfigUpdate, Containers, CustomCommands, DebGet, Deno, Distrobox, DkpPacman, Dotnet, Emacs, Firmware, Flatpak, Flutter, Fossil, Gcloud, Gem, Ghcup, GithubCliExtensions, GitRepos, GnomeShellExtensions, Go, Guix, Haxelib, Helm, HomeManager, Jetpack, Julia, Juliaup, Kakoune, Helix, Krew, Lure, Macports, Mamba, Miktex, Mas, Maza, Micro, Myrepos, Nix, Opam, Pacdef, Pacstall, Pearl, PipReview, PipReviewLocal, Pipupgrade, Pipx, Pkg, Pkgin, Pnpm, Powershell, Protonup, Raco, Rcm, Remotes, Restarts, Rtcl, RubyGems, Rustup, Scoop, Sdkman, SelfUpdate, Sheldon, Shell, Snap, Sparkle, Spicetify, Stack, Stew, Tldr, Tlmgr, Tmux, Toolbx, Vagrant, Vcpkg, Vim, Vscode, Winget, Wsl, WslUpdate, Yadm, Yarn] }
DEBUG Detected "/usr/bin/git" as "git"
DEBUG Cannot find "pwsh"
DEBUG Cannot find "powershell"
DEBUG Path "/Users/joey/.config/emacs" doesn't exist
DEBUG Path "/Users/joey/.emacs.d" doesn't exist
DEBUG Cannot find "doas"
DEBUG Detected "/usr/bin/sudo" as "sudo"
DEBUG Step "Self Update"

── 22:39:19 - Self update ──────────────────────────────────────────────────────
Checking target-arch... x86_64-apple-darwin
Checking current version... v13.0.0
Checking latest released version... DEBUG starting new connection: https://api.github.com/    
DEBUG resolving host="api.github.com"
DEBUG connecting to 140.82.112.5:443
DEBUG connected to 140.82.112.5:443
DEBUG No cached session for DnsName("api.github.com")    
DEBUG Not resuming any session    
DEBUG Using ciphersuite TLS13_AES_128_GCM_SHA256    
DEBUG Not resuming    
DEBUG TLS1.3 encrypted extensions: [ServerNameAck, Protocols([ProtocolName(6832)])]    
DEBUG ALPN protocol is Some(b"h2")    
DEBUG binding client connection
DEBUG client connection bound
DEBUG send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
DEBUG Connection{peer=Client}: new
DEBUG Connection{peer=Client}: send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 }
DEBUG pooling idle connection for ("https", api.github.com)
DEBUG Connection{peer=Client}: send frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
DEBUG Connection{peer=Client}: received frame=Settings { flags: (0x0), max_concurrent_streams: 100, initial_window_size: 67108864, max_frame_size: 68608, enable_connect_protocol: 1 }
DEBUG Connection{peer=Client}: send frame=Settings { flags: (0x1: ACK) }
DEBUG Connection{peer=Client}: received frame=Settings { flags: (0x1: ACK) }
DEBUG Connection{peer=Client}: received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
DEBUG Connection{peer=Client}: received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
DEBUG Connection{peer=Client}: received frame=Data { stream_id: StreamId(1) }
DEBUG Connection{peer=Client}: received frame=Data { stream_id: StreamId(1) }
DEBUG Connection{peer=Client}: received frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) }
DEBUG Connection{peer=Client}: close
v13.0.0
Topgrade is up-to-date
DEBUG Step "Brew (ARM)"
DEBUG Step "Brew (Intel)"
DEBUG Detected "/usr/local/bin/brew" as "/usr/local/bin/brew"

── 22:39:19 - Brew ─────────────────────────────────────────────────────────────
DEBUG Executing command `/usr/local/bin/brew update`
Already up-to-date.
DEBUG Executing command `/usr/local/bin/brew upgrade --ignore-pinned --formula`
DEBUG Step "Brew"
DEBUG Detected "/usr/local/bin/brew" as "brew"
DEBUG Step "Brew Cask (ARM)"
DEBUG Step "Brew Cask (Intel)"
DEBUG Detected "/usr/local/bin/brew" as "/usr/local/bin/brew"

── 22:39:24 - Brew - Cask ──────────────────────────────────────────────────────
DEBUG Executing command `/usr/local/bin/brew --repository buo/cask-upgrade`
DEBUG Executing command `/usr/local/bin/brew upgrade --cask`
DEBUG Step "Brew Cask"
DEBUG Detected "/usr/local/bin/brew" as "brew"
DEBUG Step "MacPorts"
DEBUG Step "Sparkle"
DEBUG Step "App Store"
DEBUG Step "yadm"
DEBUG Step "nix"
DEBUG Step "guix"
DEBUG Step "home-manager"
DEBUG Step "asdf"
DEBUG Step "pkgin"
DEBUG Step "bun"
DEBUG Step "zr"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Step "antibody"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Step "antidote"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Step "antigen"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Path "/Users/joey/.zshrc" exists
DEBUG Step "zgenom"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Path "/Users/joey/.zshrc" exists
DEBUG Step "zplug"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Path "/Users/joey/.zshrc" exists
DEBUG Step "zinit"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Path "/Users/joey/.zshrc" exists
DEBUG Step "zi"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Path "/Users/joey/.zshrc" exists
DEBUG Step "zim"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Executing command `zsh -c '[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}'`
DEBUG Command failed: Err(
   0: Command failed: `zsh -c '[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}'`
   1: `zsh` failed: exit status: 1

Location:
   src/steps/zsh.rs:151)
DEBUG Step "oh-my-zsh"
DEBUG Detected "/bin/zsh" as "zsh"
DEBUG Path "/Users/joey/.zshrc" exists
DEBUG Executing command `zsh -c 'source /Users/joey/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH'`
DEBUG Command failed: Err(
   0: Command failed: `zsh -c 'source /Users/joey/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH'`
   1: `zsh` failed: exit status: 1

Location:
   src/steps/zsh.rs:190)
DEBUG Step "oh-my-zsh" failed: 
   0: Command failed: `zsh -c 'source /Users/joey/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH'`
   1: `zsh` failed: exit status: 1

Location:
   src/steps/zsh.rs:190
oh-my-zsh failed: 
   0: Command failed: `zsh -c 'source /Users/joey/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH'`
   1: `zsh` failed: exit status: 1

Location:
   src/steps/zsh.rs:190
Retry? (y)es/(N)o/(s)hell/(q)uit
DEBUG Step "oh-my-bash"
DEBUG Detected "/usr/local/bin/bash" as "bash"
DEBUG Step "fisher"
DEBUG Step "bash-it"
DEBUG Step "oh-my-fish"
DEBUG Step "fish-plug"
DEBUG Step "fundle"
DEBUG Step "tmux"
DEBUG Step "TLDR"
DEBUG Step "pearl"
DEBUG Step "SDKMAN!"
DEBUG Detected "/usr/local/bin/bash" as "bash"
DEBUG Step "rcm"
DEBUG Step "maza"
DEBUG Step "apm"
DEBUG Step "fossil"
DEBUG Step "rustup"
DEBUG Step "juliaup"
DEBUG Step ".NET"
DEBUG Step "choosenim"
DEBUG Step "Flutter"
DEBUG Step "go-global-update"
DEBUG Step "gup"
DEBUG Step "Emacs"
DEBUG Step "opam"
DEBUG Step "vcpkg"
DEBUG Step "pipx"
DEBUG Step "Visual Studio Code extensions"
DEBUG Detected "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" as "code"

── 22:39:29 - Visual Studio Code extensions ────────────────────────────────────
DEBUG Executing command `/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code --list-extensions`
DEBUG Executing command `/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code --force --install-extension 13xforever.language-x86-64-assembly --install-extension arcensoth.language-mcfunction --install-extension DavidAnson.vscode-markdownlint --install-extension donjayamanne.githistory --install-extension emily-curry.base16-tomorrow-dark-vscode --install-extension GitHub.copilot --install-extension GitHub.copilot-chat --install-extension kamikillerto.vscode-colorize --install-extension mads-hartmann.bash-ide-vscode --install-extension MinecraftCommands.syntax-mcfunction --install-extension ms-vscode-remote.remote-ssh --install-extension ms-vscode-remote.remote-ssh-edit --install-extension ms-vscode-remote.remote-wsl --install-extension ms-vscode.cpptools --install-extension ms-vscode.makefile-tools --install-extension ms-vscode.powershell --install-extension ms-vscode.remote-explorer --install-extension PKief.material-icon-theme --install-extension rogalmic.bash-debug --install-extension rust-lang.rust-analyzer --install-extension SPGoding.datapack-language-server --install-extension tamasfe.even-better-toml --install-extension vscodevim.vim --install-extension wayou.vscode-todo-highlight --install-extension webfreak.debug --install-extension ZainChen.json`
Installing extensions...
Extension 'github.copilot' is already installed.
Extension 'donjayamanne.githistory' is already installed.
Extension 'emily-curry.base16-tomorrow-dark-vscode' is already installed.
Extension '13xforever.language-x86-64-assembly' is already installed.
Extension 'davidanson.vscode-markdownlint' is already installed.
Extension 'github.copilot-chat' is already installed.
Extension 'arcensoth.language-mcfunction' is already installed.
Extension 'kamikillerto.vscode-colorize' is already installed.
Extension 'ms-vscode-remote.remote-wsl' is already installed.
Extension 'mads-hartmann.bash-ide-vscode' is already installed.
Extension 'ms-vscode-remote.remote-ssh' is already installed.
Extension 'minecraftcommands.syntax-mcfunction' is already installed.
Extension 'ms-vscode-remote.remote-ssh-edit' is already installed.
Extension 'ms-vscode.cpptools' is already installed.
Extension 'ms-vscode.remote-explorer' is already installed.
Extension 'rogalmic.bash-debug' is already installed.
Extension 'ms-vscode.makefile-tools' is already installed.
Extension 'ms-vscode.powershell' is already installed.
Extension 'spgoding.datapack-language-server' is already installed.
Extension 'tamasfe.even-better-toml' is already installed.
Extension 'webfreak.debug' is already installed.
Extension 'pkief.material-icon-theme' is already installed.
Extension 'vscodevim.vim' is already installed.
Extension 'zainchen.json' is already installed.
Extension 'wayou.vscode-todo-highlight' is already installed.
Extension 'rust-lang.rust-analyzer' is already installed.
DEBUG Step "conda"
DEBUG Step "mamba"
DEBUG Step "miktex"
DEBUG Step "pip-review"
DEBUG Step "pip-review (local)"
DEBUG Step "pipupgrade"
DEBUG Step "ghcup"
DEBUG Step "stack"
DEBUG Step "tlmgr"
DEBUG Step "myrepos"
DEBUG Step "chezmoi"
DEBUG Step "jetpack"
DEBUG Step "vim"
DEBUG Detected "/Users/joey/.local/bin/vim" as "vim"
DEBUG Executing command `/Users/joey/.local/bin/vim --version`
DEBUG Step "Neovim"
DEBUG Detected "/usr/local/bin/nvim" as "nvim"
DEBUG Path "/Users/joey/.config/nvim/init.lua" exists

── 22:39:33 - Neovim ───────────────────────────────────────────────────────────
DEBUG Wrote vim script to "/var/folders/py/ynnlc1r12z1f9m9s4j2vq7580000gn/T/.tmpF5ynZF"
DEBUG Executing command `/usr/local/bin/nvim -u /Users/joey/.config/nvim/init.lua --headless -V1 -nS /var/folders/py/ynnlc1r12z1f9m9s4j2vq7580000gn/T/.tmpF5ynZF`

Lazy UpdatePlugins upgraded
DEBUG Step "The Ultimate vimrc"
DEBUG Step "voom"
DEBUG Step "Kakoune"
DEBUG Step "helix"
DEBUG Step "yarn"
DEBUG Step "pnpm"
DEBUG Step "Containers"
DEBUG Step "deno"
DEBUG Step "composer"
DEBUG Step "krew"
DEBUG Step "helm"
DEBUG Step "gem"
DEBUG Detected "/usr/bin/gem" as "gem"
DEBUG Step "rubygems"
DEBUG Step "julia"
DEBUG Step "haxelib"
DEBUG Step "sheldon"
DEBUG Step "stew"
DEBUG Step "rtcl"
DEBUG Step "bin"
DEBUG Step "gcloud"
DEBUG Step "micro"
DEBUG Step "raco"
DEBUG Step "spicetify"
DEBUG Step "GitHub CLI Extensions"
DEBUG Detected "/usr/local/bin/gh" as "gh"
DEBUG Executing command `/usr/local/bin/gh extensions list`

── 22:39:34 - GitHub CLI Extensions ────────────────────────────────────────────
DEBUG Executing command `/usr/local/bin/gh extension upgrade --all`
no installed extensions found
DEBUG Step "Bob"
DEBUG /Users/joey/.doom.d does not exist
DEBUG /Users/joey/.vim does not exist
DEBUG Checking if /Users/joey/.config/nvim is a git repository
DEBUG Executing command `/usr/bin/git rev-parse --show-toplevel`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/git rev-parse --show-toplevel`

      Stderr:
      fatal: not a git repository (or any of the parent directories): .git
   1: `/usr/bin/git` failed: exit status: 128

Location:
   src/steps/git.rs:208)
DEBUG /Users/joey/.ideavimrc does not exist
DEBUG /Users/joey/.intellimacs does not exist
DEBUG /Users/joey/.dotfiles does not exist
DEBUG /Users/joey/.zshrc is a file. Checking /Users/joey
DEBUG Checking if /Users/joey is a git repository
DEBUG Executing command `/usr/bin/git rev-parse --show-toplevel`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/git rev-parse --show-toplevel`

      Stderr:
      fatal: not a git repository (or any of the parent directories): .git
   1: `/usr/bin/git` failed: exit status: 128

Location:
   src/steps/git.rs:208)
DEBUG /Users/joey/.tmux does not exist
DEBUG /Users/joey/.config/fish does not exist
DEBUG /Users/joey/.config/openbox does not exist
DEBUG /Users/joey/.config/bspwm does not exist
DEBUG /Users/joey/.config/i3 does not exist
DEBUG /Users/joey/.config/sway does not exist
DEBUG Step "Git repositories"
DEBUG Step "Vagrant boxes"

── 22:39:34 - Summary ──────────────────────────────────────────────────────────
Self Update: OK
Brew (ARM): SKIPPED: Cannot find "/opt/homebrew/bin/brew" in PATH
Brew (Intel): OK
Brew: SKIPPED: Not a custom brew for macOS
Brew Cask (ARM): SKIPPED: Cannot find "/opt/homebrew/bin/brew" in PATH
Brew Cask (Intel): OK
Brew Cask: SKIPPED: Not a custom brew for macOS
MacPorts: SKIPPED: Cannot find "port" in PATH
Sparkle: SKIPPED: Cannot find "sparkle" in PATH
App Store: SKIPPED: Cannot find "mas" in PATH
yadm: SKIPPED: Cannot find "yadm" in PATH
nix: SKIPPED: Cannot find "nix" in PATH
guix: SKIPPED: Cannot find "guix" in PATH
home-manager: SKIPPED: Cannot find "home-manager" in PATH
asdf: SKIPPED: Cannot find "asdf" in PATH
pkgin: SKIPPED: Cannot find "pkgin" in PATH
bun: SKIPPED: Cannot find "bun" in PATH
zr: SKIPPED: Cannot find "zr" in PATH
antibody: SKIPPED: Cannot find "antibody" in PATH
antidote: SKIPPED: Path "/Users/joey/.antidote" doesn't exist
antigen: SKIPPED: Path "/Users/joey/antigen.zsh" doesn't exist
zgenom: SKIPPED: Path "/Users/joey/.zgenom" doesn't exist
zplug: SKIPPED: Path "/Users/joey/.zplug" doesn't exist
zinit: SKIPPED: Path "/Users/joey/.zinit" doesn't exist
zi: SKIPPED: Path "/Users/joey/.zi" doesn't exist
zim: SKIPPED: Path "/Users/joey/.zim" doesn't exist
oh-my-zsh: FAILED
oh-my-bash: SKIPPED: Path "/Users/joey/.oh-my-bash" doesn't exist
fisher: SKIPPED: Cannot find "fish" in PATH
bash-it: SKIPPED: Path "/Users/joey/.bash_it" doesn't exist
oh-my-fish: SKIPPED: Cannot find "fish" in PATH
fish-plug: SKIPPED: Cannot find "fish" in PATH
fundle: SKIPPED: Cannot find "fish" in PATH
tmux: SKIPPED: Path "/Users/joey/.tmux/plugins/tpm/bin/update_plugins" doesn't exist
TLDR: SKIPPED: Cannot find "tldr" in PATH
pearl: SKIPPED: Cannot find "pearl" in PATH
SDKMAN!: SKIPPED: Path "/Users/joey/.sdkman/bin/sdkman-init.sh" doesn't exist
rcm: SKIPPED: Cannot find "rcup" in PATH
maza: SKIPPED: Cannot find "maza" in PATH
apm: SKIPPED: Cannot find "apm" in PATH
fossil: SKIPPED: Cannot find "fossil" in PATH
rustup: SKIPPED: Cannot find "rustup" in PATH
juliaup: SKIPPED: Cannot find "juliaup" in PATH
.NET: SKIPPED: Cannot find "dotnet" in PATH
choosenim: SKIPPED: Cannot find "choosenim" in PATH
Flutter: SKIPPED: Cannot find "flutter" in PATH
go-global-update: SKIPPED: Cannot find "go" in PATH
gup: SKIPPED: Cannot find "go" in PATH
Emacs: SKIPPED: Cannot find "emacs" in PATH
opam: SKIPPED: Cannot find "opam" in PATH
vcpkg: SKIPPED: Cannot find "vcpkg" in PATH
pipx: SKIPPED: Cannot find "pipx" in PATH
Visual Studio Code extensions: OK
conda: SKIPPED: Cannot find "conda" in PATH
mamba: SKIPPED: Cannot find "mamba" in PATH
miktex: SKIPPED: Cannot find "miktex" in PATH
pip-review: SKIPPED: Cannot find "pip-review" in PATH
pip-review (local): SKIPPED: Cannot find "pip-review" in PATH
pipupgrade: SKIPPED: Cannot find "pipupgrade" in PATH
ghcup: SKIPPED: Cannot find "ghcup" in PATH
stack: SKIPPED: Cannot find "stack" in PATH
tlmgr: SKIPPED: Cannot find "tlmgr" in PATH
myrepos: SKIPPED: Cannot find "mr" in PATH
chezmoi: SKIPPED: Cannot find "chezmoi" in PATH
jetpack: SKIPPED: Cannot find "jetpack" in PATH
vim: SKIPPED: vim binary might be actually nvim
Neovim: OK
The Ultimate vimrc: SKIPPED: Path "/Users/joey/.vim_runtime" doesn't exist
voom: SKIPPED: Cannot find "voom" in PATH
Kakoune: SKIPPED: Cannot find "kak" in PATH
helix: SKIPPED: Cannot find "helix" in PATH
yarn: SKIPPED: Cannot find "yarn" in PATH
pnpm: SKIPPED: Cannot find "pnpm" in PATH
Containers: SKIPPED: Cannot find "docker" in PATH
deno: SKIPPED: Cannot find "deno" in PATH
composer: SKIPPED: Cannot find "composer" in PATH
krew: SKIPPED: Cannot find "kubectl-krew" in PATH
helm: SKIPPED: Cannot find "helm" in PATH
gem: SKIPPED: Path "/Users/joey/.gem" doesn't exist
rubygems: SKIPPED: Path "/Users/joey/.gem" doesn't exist
julia: SKIPPED: Cannot find "julia" in PATH
haxelib: SKIPPED: Cannot find "haxelib" in PATH
sheldon: SKIPPED: Cannot find "sheldon" in PATH
stew: SKIPPED: Cannot find "stew" in PATH
rtcl: SKIPPED: Cannot find "rupdate" in PATH
bin: SKIPPED: Cannot find "bin" in PATH
gcloud: SKIPPED: Cannot find "gcloud" in PATH
micro: SKIPPED: Cannot find "micro" in PATH
raco: SKIPPED: Cannot find "raco" in PATH
spicetify: SKIPPED: Cannot find "spicetify-cli" in PATH
GitHub CLI Extensions: OK
Bob: SKIPPED: Cannot find "bob" in PATH
Git repositories: SKIPPED: No repositories to pull or push
Vagrant boxes: SKIPPED: Cannot find "vagrant" in PATH
DEBUG Desktop notification: Topgrade finished with errors
SteveLauC commented 11 months ago

So you SSHed into a machine, within its interactive shell, you run topgrade, then you get the error, right?

The command zsh -c 'source /home/joey/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH' that is being run exits with code 1

I think this is the root cause, it is propagated by the grep command (export -p | grep ZSH > /dev/null) as there is no ZSH in its input.

SteveLauC commented 11 months ago

When I implemented #528, I recalled I had tested that this command won't give an error if the ZSH variable is not present when using remote execution (login shell, not an interactive shell)

It seems like they have different behaviors here, needs investigation

tralce commented 10 months ago

I am having the same issue, but it is happening when I run it with remote execution.

I also noticed that oh-my-zsh is not a listed step to disable in the config file.


   0: Command failed: `zsh -c 'source /home/violet/.zshrc > /dev/null && export -p | grep ZSH > /dev/null && echo $ZSH'`
   1: `zsh` failed: exit status: 1

Location:
   src/steps/zsh.rs:190```
Un1q32 commented 10 months ago

What is the purpose of greping export -p anyway? Why not just check if the variable is set with [ -n $ZSH ] or test -n $ZSH

Realized immediately after writing it wouldn't check if it's exported.

You can at least do grep -q instead of redirecting output to /dev/null, I'm pretty sure every major grep implementation supports -q

SteveLauC commented 10 months ago

I also noticed that oh-my-zsh is not a listed step to disable in the config file.

Yeah, oh-my-zsh is not a step, shell is, see #515

SteveLauC commented 10 months ago

Here is a build for x86_64-unknown-linux-musl, please test it

Do you guys need builds for other targets?

Code review for #592 is also enacouraged

Un1q32 commented 10 months ago

Here is a build for x86_64-unknown-linux-musl, please test it

Do you guys need builds for other targets?

Code review for #592 is also enacouraged

that seems to fix it

tralce commented 10 months ago

Can confirm that this addresses it. Wonderful!

SteveLauC commented 10 months ago

Thanks for testing it!

I will give it a test to see whether it will work when oh-my-zsh is actually installed, after that, I will merge that PR

tralce commented 10 months ago

Thank you so much for looking into it.

Somewhat unrelatedly, is there no configuration option to disable oh-my-zsh checks, or did I just guess the name of the step incorrectly? If the former, it would be nice to blacklist that as I do use zsh on nearly all my hosts, but I do not use Oh-My-Zsh!

SteveLauC commented 10 months ago

Somewhat unrelatedly, is there no configuration option to disable oh-my-zsh checks, or did I just guess the name of the step incorrectly?

Unfortunately, there is currently no way to disable oh-my-zsh cause it is not a step, Topgrade groups all the shell-related things into a step shell:

$ topgrade --only shell --dry-run

── 10:06:36 - Sudo ─────────────────────────────────────────────────────────────
Dry running: /usr/bin/sudo -v

── 10:06:36 - oh-my-zsh ────────────────────────────────────────────────────────
Pulling custom plugins and themes
Would pull /home/steve/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Would pull /home/steve/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Dry running: zsh /home/steve/.oh-my-zsh/tools/upgrade.sh

── 10:06:36 - Summary ──────────────────────────────────────────────────────────
oh-my-zsh: OK

I have a plan to enhance the step granularity, see #515, though I do think it needs more evaluation and discussion

If the former, it would be nice to blacklist that as I do use zsh on nearly all my hosts, but I do not use Oh-My-Zsh!

If this issue is fixed, then Topgrade won't try the oh-my-zsh update when it finds that the tool is not installed on the host, so no worries about this

Un1q32 commented 10 months ago

Just a thought, why run grep at all when you can just parse the output of export -p in rust to get the $ZSH environment variable? Means you depend on less external binaries on top of being a bit faster.

SteveLauC commented 10 months ago

Yeah, you are right

SteveLauC commented 10 months ago

Just a thought, why run grep at all when you can just parse the output of export -p in rust to get the $ZSH environment variable? Means you depend on less external binaries on top of being a bit faster.

I just updated the binary here, would you like to give it a test?