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

PS1 set by activate doesn't render properly in zsh #383

Open
gkelly opened this issue Aug 20, 2022 · 4 comments · May be fixed by #386
Open

PS1 set by activate doesn't render properly in zsh #383

gkelly opened this issue Aug 20, 2022 · 4 comments · May be fixed by #386

Comments

@gkelly
Copy link
Contributor

gkelly commented Aug 20, 2022

After running source kctf/activate I see:

[*] kCTF environment activated. Run "deactivate" to exit.
[*] To create a cluster config, run "kctf cluster create"
gkelly@pragma> kCTF[ctf=heist$(_kctf_config_string)$(_kctf_chal_string)] > 

Which is my original PS1 (gkelly@pragma> ) with a partially-rendered kCTF status line. I tested this in bash with the same checkout and it works fine.

@sroettger
Copy link
Collaborator

hmm, that's unexpected since we're also developing with zsh, so I would have assumed that bash would break first :).
Which zsh version are you using? And do you have any special config that might affect the prompt?

@gkelly
Copy link
Contributor Author

gkelly commented Sep 9, 2022

I reproduced this using docker and ubuntu:22.04, just apt install zsh and then running zsh then following the local testing instructions led me to the same state.

@gkelly
Copy link
Contributor Author

gkelly commented Sep 9, 2022

Here's the Dockerfile:

FROM ubuntu:22.04

RUN apt-get update && \
  DEBIAN_FRONTEND=noninteractive apt-get -y install xxd wget curl netcat zsh

RUN mkdir kctf && \
  curl -sSL https://kctf.dev/sdk | tar xz

ENTRYPOINT /bin/zsh

And then running it and just running source kctf/activate will reproduce:

a665b3a11f6a# source kctf/activate
<snip>
[*] kCTF environment activated. Run "deactivate" to exit.
[*] To create a cluster config, run "kctf cluster create"
a665b3a11f6a# kCTF[ctf=/$(_kctf_config_string)$(_kctf_chal_string)] >

@sroettger
Copy link
Collaborator

Thank you!
So looks like the way we build the prompt requires:
setopt PROMPT_SUBST

Just setting this option as part of kctf/activate might be an option, but it's also unexpected to the user.
Maybe we can detect the case instead, fall back to not showing the current config/challenge and print a notice to the user.

@sroettger sroettger linked a pull request Sep 9, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants