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

zellij hangs when run from a fish function #2606

Closed
ghost opened this issue Jul 5, 2023 · 2 comments
Closed

zellij hangs when run from a fish function #2606

ghost opened this issue Jul 5, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 5, 2023

I want a fish function that does the following:

  • stores current directory in session_name
  • checks if a session with name "session_name" exists
    • if so, attach to it
    • if not, create a new session with name "session_name" and strider layout

My nixcode to do this is as follows:

       programs.fish.functions.za = ''
          if status is-interactive
            set session_name (pwd | sd "/" "_")
            if rg "^$session_name\$" (command zellij list-sessions | psub)
              echo attempting to attach to existing session
              exec zellij attach $session_name
            else
              echo attempting to start new session
              exec zellij --session $session_name --layout strider
            end
          end
        '';

I get expected behaviour until the zellij calls. At this point the function hangs. How do I fix this?

@ghost ghost added the suspected bug label Jul 5, 2023
@ghost
Copy link
Author

ghost commented Jul 5, 2023

It seems like this is related to #2591.

The function works as expected when run from root.

@ghost
Copy link
Author

ghost commented Jul 5, 2023

My solution was to name the session using the base64 encoded sha1 of the current directory (openssl sha1 -binary (pwd | psub) | base64). This will always yield a session name of 29 chars (which is within the limits provided by empirical tests in #2591).

A birthday attack on the sha1 is not a problem as I intend to use far less than 2^159 sessions concurrently.

@ghost ghost closed this as completed Jul 5, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants