Closed reini-1 closed 1 year ago
You can test this with the following simple configuration:
Ubuntu-22.04> reini@ubuntu:~$ grep -vE '^#|^$' ~/tmp/topgrade/topgrade.toml
assume_yes = true
disable = ["myrepos"]
no_retry = true
ssh_arguments = "-o ConnectTimeout=2"
cleanup = true
[git]
[composer]
[pre_commands]
[commands]
"01 Custom command 01" = "~/tmp/topgrade/command01.sh"
"02 Custom command 02" = "~/tmp/topgrade/command02.sh"
"03 Custom command 03" = "~/tmp/topgrade/command03.sh"
[brew]
greedy_cask = true
[linux]
[windows]
[npm]
[firmware]
[flatpak]
Ubuntu-22.04> reini@ubuntu:~$ more ~/tmp/topgrade/command0*
::::::::::::::
/home/reini/tmp/topgrade/command01.sh
::::::::::::::
#!/usr/bin/env sh
echo "Custom command 01"
::::::::::::::
/home/reini/tmp/topgrade/command02.sh
::::::::::::::
#!/usr/bin/env sh
echo "Custom command 02"
::::::::::::::
/home/reini/tmp/topgrade/command03.sh
::::::::::::::
#!/usr/bin/env sh
echo "Custom command 03"
Ubuntu-22.04> reini@ubuntu:~$ topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288.
── 11:51:31 - Self update ──────────────────────────────────────────────────────
Topgrade is up-to-date
── 11:51:32 - 01 Custom command 01 ─────────────────────────────────────────────
Custom command 01
── 11:51:33 - 02 Custom command 02 ─────────────────────────────────────────────
[1]+ Stopped topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
Ubuntu-22.04> reini@ubuntu:~$ jobs
[1]+ Stopped topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
I can confirm that it works on Mac with zsh here.
It also works in a multipass Ubuntu 22.04 vm (aarch64) on my Mac with similar .bashrc settings, but not on a real Linux machine (x86_64/amd64).
topgrade with the above test config:
Multipass~Ubuntu-22.04> [ssh] ubuntu@mac:~$ topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
―― 12:29:55 - Self update ――――――――――――――――――――――――――――――――――――――――――――――――――――――
Topgrade is up-to-date
―― 12:29:56 - 01 Custom command 01 ―――――――――――――――――――――――――――――――――――――――――――――
Custom command 01
―― 12:29:56 - 02 Custom command 02 ―――――――――――――――――――――――――――――――――――――――――――――
Custom command 02
―― 12:29:56 - 03 Custom command 03 ―――――――――――――――――――――――――――――――――――――――――――――
Custom command 03
―― 12:29:56 - Summary ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
01 Custom command 01: OK
02 Custom command 02: OK
03 Custom command 03: OK
So maybe this is only a problem on x86_64/amd64 machines.
Please fix this urgent, as topgrade did not work on Linux now when you use custom commands.
I think I have this same issue after the upgrade as well. Replicating this by doing
zsh -i -c 'custom_cmd_here'
prints the prompt instead of waiting for the command to finish, while zsh -c and bash does not have this problem at all.
Tested on both Ubuntu and MacOS.
Sorry, on the Mac vm I tested it with an old topgrade 9.0.1 that works.
With a new version it also did not work:
Multipass~Ubuntu-22.04> [ssh] ubuntu@mac:~/tmp/topgrade$ topgrade --version; topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands; topgrade --version
Topgrade 10.3.2
Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288.
── 12:39:23 - Self update ──────────────────────────────────────────────────────
Topgrade is up-to-date
── 12:39:23 - 01 Custom command 01 ─────────────────────────────────────────────
Custom command 01
── 12:39:23 - 02 Custom command 02 ─────────────────────────────────────────────
[2]+ Stopped topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
Topgrade 10.3.2
So I think testing this only on a Mac with zsh is not enough ...
Please fix it or revert the patch or add an option (in config) to disable this behavior.
Thanks in advance.
Have you guys set $PS1
in any of your bash/zsh dotfiles?
Do you use tmux/zellij or something like that?
PS1 is set in a default Ubuntu installation and I also set it to something different and PROMPT_COMMAND is also used. I did not use tmux/zellij for this.
Multipass~Ubuntu-22.04> [ssh] ubuntu@mac:~$ set|grep -E '^PS1|^PROMPT_COMMAND'
PROMPT_COMMAND='history -a;history -c;history -r;__ps1_long_path;'
PS1='\[\e[1;37m\]Multipass~Ubuntu-22.04>\[\e[0;0m\] $(_show_virtual_env)[ssh] \[\e]0;\u@\h:\w\a\]\[\e[0;32m\]\u\[\e[0m\]@\[\e[0;34m\]\h\[\e[0m\]:\[\e[0;36m\]\w\[\e[0m\]$(__git_ps1 '\''\[\033[0;33m\] (%s)\[\033[0m\]'\'')$ '
Without PS1 and PROMPT_COMMAND set it did also not work:
Multipass~Ubuntu-22.04> [ssh] ubuntu@MBP-009:~$ unset PS1
unset PROMPT_COMMAND
topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands; topgrade --version
Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288.
── 14:06:33 - Self update ──────────────────────────────────────────────────────
Topgrade is up-to-date
── 14:06:34 - 01 Custom command 01 ─────────────────────────────────────────────
Custom command 01
── 14:06:34 - 02 Custom command 02 ─────────────────────────────────────────────
[1]+ Stopped topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
Topgrade 10.3.2
On Raspian GNU/Linux 11 (armv7l) does it now also not work:
Raspbian-11> [ssh] pi@octoprint:~$ topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288.
── 14:13:10 - Self update ──────────────────────────────────────────────────────
[00:00:00] [========================================] 4.35MiB/4.35MiB (0s) Done
Topgrade upgraded to 10.3.2:
## What's Changed
* use documented way of updating by @vzze in https://github.com/topgrade-rs/topgrade/pull/344
* Add support for please (access elevation) by @dsully in https://github.com/topgrade-rs/topgrade/pull/310
* run_custom_command: use interactive shell on unix by @utkarshgupta137 in https://github.com/topgrade-rs/topgrade/pull/347
* ruby_gems: Fixes asdf by @DottoDev in https://github.com/topgrade-rs/topgrade/pull/350
* vim: Adds Astrovim support by @DottoDev in https://github.com/topgrade-rs/topgrade/pull/352
* CI: Update cross to v0.2.5 by @guihkx in https://github.com/topgrade-rs/topgrade/pull/354
* Silence misleading warning on other platforms. by @jstelzer in https://github.com/topgrade-rs/topgrade/pull/353
* apt: Recognise mist by @DottoDev in https://github.com/topgrade-rs/topgrade/pull/351
* pip3: Check for EXTERNALLY-MANAGED (PEP 668) by @TGRCdev in https://github.com/topgrade-rs/topgrade/pull/367
* pacdef: support new version 1.x by @arctic-penguin in https://github.com/topgrade-rs/topgrade/pull/364
* Support antidote by @r-darwish in https://github.com/topgrade-rs/topgrade/pull/368
* cargo: add cleanup step (using cargo-cache) by @IsaacTay in https://github.com/topgrade-rs/topgrade/pull/371
* skip skip-notify warning on Win by @DottoDev in https://github.com/topgrade-rs/topgrade/pull/362
* 10.3.2 patch by @DottoDev in https://github.com/topgrade-rs/topgrade/pull/378
## New Contributors
* @dsully made their first contribution in https://github.com/topgrade-rs/topgrade/pull/310
* @utkarshgupta137 made their first contribution in https://github.com/topgrade-rs/topgrade/pull/347
* @TGRCdev made their first contribution in https://github.com/topgrade-rs/topgrade/pull/367
* @IsaacTay made their first contribution in https://github.com/topgrade-rs/topgrade/pull/371
**Full Changelog**: https://github.com/topgrade-rs/topgrade/compare/v10.3.1...v10.3.2
Respawning...
Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288.
── 14:13:13 - 01 Custom command 01 ─────────────────────────────────────────────
Custom command 01
── 14:13:14 - 02 Custom command 02 ─────────────────────────────────────────────
[1]+ Stopped topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands
Raspbian-11> [ssh] pi@octoprint:~$ topgrade --version
Topgrade 10.3.2
I would vote to revoke this change, test successfully on all topgrade supported platforms before merging it again!
@utkarshgupta137 An alternative to zsh -i -c 'custom_cmd
is to invoke it via zsh built-in emulate
, e.g.
emulate zsh -c 'custom_cmd'
which executes the command on the foreground (tested in my Ubuntu and MacOS machines) while still being able to expand the user's aliases and functions.
I found in the source code (https://github.com/topgrade-rs/topgrade/blob/master/src/main.rs#L119) when setting environment variable TOPGRADE_NO_SELF_UPGRADE the self update is skipped:
Multipass~Ubuntu-22.04> [ssh] ubuntu@mac:~$ TOPGRADE_NO_SELF_UPGRADE=true topgrade --config ~/tmp/topgrade/topgrade.toml --only custom_commands; topgrade --version
Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288.
── 16:26:26 - 01 Custom command 01 ─────────────────────────────────────────────
Custom command 01
── 16:26:26 - 02 Custom command 02 ─────────────────────────────────────────────
Custom command 02
── 16:26:26 - 03 Custom command 03 ─────────────────────────────────────────────
Custom command 03
── 16:26:26 - Summary ──────────────────────────────────────────────────────────
01 Custom command 01: OK
02 Custom command 02: OK
03 Custom command 03: OK
Topgrade 10.3.1
I think this can be used as a workaround in conjunction with an old version of topgrade.
Should work now
thank you @DottoDev! Hopefully it can be published in crates.io soon.
The crate is also updated now
What did you expect to happen?
Topgrade runs all custom commands
What actually happened?
Topgrade stops after the first custom command when starting the second one and send itself in the background without continuing the scripts.
Topgrade hangs then in the background without continuing.
Downgrading to an older version did also not work, because it is automatically updated and I could not find an option to disable self-update.
So topgrade could not be used anymore.
Additional Details
See also my comment in pull request #347 (https://github.com/topgrade-rs/topgrade/pull/347#issuecomment-1465850005)