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

[WINCH in ble/prompt/update] Cyclic dependency error #442

Closed
neilbags opened this issue Apr 27, 2024 · 13 comments
Closed

[WINCH in ble/prompt/update] Cyclic dependency error #442

neilbags opened this issue Apr 27, 2024 · 13 comments
Labels

Comments

@neilbags
Copy link

Sometimes when opening my terminal, I see this error 3 times:
ble/prompt: FATAL: detected cyclic dependency (_ble_prompt_ps1 required by _ble_prompt_ps1)

It doesn't seem to cause any issues but is annoying.

Here are my version details:

GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) [Debian GNU/Linux 12 (bookworm)]
ble.sh, version 0.4.0-devel4+70a325f (noarch) [git 2.39.2, GNU Make 4.3, GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0, GNU MP 6.2.1)]
atuin, version 18.1.0 (/usr/bin/atuin)
locale: LANG=en_AU.UTF-8
terminal: TERM=xterm-256color wcwidth=15.0-west/15.1-2+ri, vte:7006 (65;7006;1)

In my .bashrc I have this line at the top:

[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach

And this at the bottom:

[[ ${BLE_VERSION-} ]] && ble-attach
if [[ $(command -v atuin) ]]; then
  eval "$(atuin init bash --disable-up-arrow)"
fi

Can anyone help?

@akinomyoga
Copy link
Owner

What is the output of the following command?

$ declare -p PS1

@akinomyoga
Copy link
Owner

If you have custom ble.sh settings in ~/.blerc (or ~/.config/blesh/init.sh or other files), could you provide us with them?

@akinomyoga
Copy link
Owner

akinomyoga commented Apr 27, 2024

There was a similar report at #359.

Both seem to happen only on the startup. One possibility is that the terminal resizes the size of PTY after the shell starts on its startup, which causes the nested evaluation of the prompt via the WINCH trap. I'm not sure if this is actually the culprit in your case, but I added a workaround for it in commit 6196849. Could you update ble.sh by running ble-update and see if the behavior changes?

@neilbags
Copy link
Author

Hi,

My PS1 is super weird because I'm using powerline-shell.

I haven't run ble-update yet but am unable to reproduce the issue at present - I'm not sure what has changed. The theory about the terminal resizing the PTY seems reasonable - I'm using a tiling extension for GNOME

If the error comes back I'll try doing an update

@neilbags
Copy link
Author

Update - I'm still seeing the issue occasionally, even after ble-update

@akinomyoga
Copy link
Owner

akinomyoga commented Apr 29, 2024

Thank you.

  • Q3: I'd like to take a stack dump. Can you put the following code in your ~/.blerc and try to replicate the issue? After an issue happens, could you check if a file ~/debug.blesh.GitHub442.txt is created, and if present, attach the file to this issue? You can attach a .txt file in GitHub Issue by dragging and dropping the file into the text area.
# blerc

# Test code 1
function blerc/github442/test1 {
  [[ ${ADVICE_WORDS[1]} == *'(_ble_prompt_ps1 required by _ble_prompt_ps1)'* ]] || return
  (
    shopt -s extdebug
    shopt -s extglob
    ble-stackdump
    declare -p "${!_ble_prompt_ps1@}" $(compgen -vX '@([_A-Z]*|bleopt_)*')
  ) >> ~/debug.blesh.GitHub442.txt
}
ble/function#advice around ble/util/print blerc/github442/test1

After testing and attaching the file, you can remove the above test code from ~/.bashrc and delete the file ~/.debug.blesh.GitHub442.txt.

@neilbags
Copy link
Author

neilbags commented May 1, 2024

@akinomyoga
Copy link
Owner

Thank you.

  • Q4: Is the problem fixed by putting the following line in ~/.blerc? Since the problem seems to happen only occasionally, can you use this setting for a while to check if the situation changes?
# somewhere in blerc

ble/function#advice around ble/prompt/update 'prompt_unit="" ble/function#advice/do'

@neilbags
Copy link
Author

neilbags commented May 1, 2024

Its been happening really consistently today (which is weird, and inconsistent with previous behavior), but its seems to have stopped since I put this in the config.

So far so good

@akinomyoga
Copy link
Owner

Thank you for checking! I'll push a proper fix to the master branch after waiting for a few days. If you face the problem again, please let me know!

@akinomyoga akinomyoga changed the title Cyclic dependency error [WINCH in ble/prompt/update] Cyclic dependency error May 1, 2024
@akinomyoga
Copy link
Owner

@neilbags Sorry for the delay. I've pushed the mentioned proper fix to the master branch. Now I think the workaround I provided in #442 (comment) is no longer needed. Could you check the behavior by updating ble.sh by running ble-update in a ble.sh session?

@neilbags
Copy link
Author

Seems all good

@akinomyoga
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants