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

Zoxide unable to jump to directories when exporting zoxide from distrobox container #592

Open
shaun-mathew opened this issue Jul 13, 2023 · 4 comments

Comments

@shaun-mathew
Copy link

Issue

I am currently using Fedora Silverblue and have installed zoxide in distrobox archlinux container. The binary is also exported to host os (Silverblue) so that I can access it from outside the container. However, whenever, I try to jump to any directory (home or on root fs), I get the following error: ' does not existy '/var/home/shaun/Downloads. From within container, zoxide works just fine. I also tested it out inside a Fedora Workstation VM and the issue persists, so this seems to be an issue between distrobox and zoxide.

Steps to Reproduce

  1. Install distrobox
  2. Create archlinux container using distrobox-create -n test -i quay.io/toolbx-images/archlinux-toolbox
  3. Enter container using distrobox-enter test
  4. Install zoxide using pacman to get the binary.
  5. Export the binary to host system using distrobox-export --bin $(which zoxide) --export-path ~/.local/bin. Make sure the ~/.local/bin directory exists on the host.
  6. Exit the container and perform following steps on host.
  7. Install zoxide using steps for relevant shell
  8. CD to directories to populate database
  9. Using z to jump to any directory. This will result in an error

Additional Info

I have used zoxide installed on the host os previously on Fedora workstation (not silverblue).
I am using the fish shell, but I've tested it out using zsh and the problem persists.
This is the file created when using distrobox-export

#!/bin/sh
# distrobox_binary
# name: archbox
if [ -z "${CONTAINER_ID}" ]; then
	exec /usr/bin/distrobox-enter  -n archbox -- 		 /usr/sbin/zoxide  "$@"
else
	exec /usr/sbin/zoxide "$@"
fi
@ajeetdsouza
Copy link
Owner

I've not used distrobox, but I don't think zoxide can be containerized in that way.

zoxide verifies that directories still exist before trying to cd into it. In this case, the filesystem that zoxide has access to during verification (the arch container) is different from the filesystem that you're trying to cd around on (your local filesystem).

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label Jul 15, 2023
@shaun-mathew
Copy link
Author

shaun-mathew commented Jul 15, 2023

I can understand why it wouldn't work for folders in the root filesystem, but for folders in the home directory that shouldn't be the case since distrobox exposes your host's home folder to the container. I decided to check the absolute path of a random folder in the home directory of the host and the same folder on the container and they appear to have the same absolute path when I use the pwd command.

Edit:

Here's some more unexpected behaviour. I tried the following on the host:
cd (zoxide query "some path") where some path is a path on the host machine and I still get the same error.
zoxide query "some path" on the host machine does correctly return a path. Also executing echo (zoxide query "some path") behaves as expected i.e. how zoxide query "some path" works on the host.

@github-actions github-actions bot removed the waiting-for-response Waiting for a response from the issue author. label Jul 15, 2023
@ajeetdsouza
Copy link
Owner

Just clarifying that I understood correctly:

  • zoxide query <QUERY> produces a correct path
  • cd (zoxide query <QUERY>) fails saying the directory does not exist
  • You are able to manually cd into the path returned by zoxide

Is this correct?

@shaun-mathew
Copy link
Author

Just clarifying that I understood correctly:

* `zoxide query <QUERY>` produces a correct path

* `cd (zoxide query <QUERY>)` fails saying the directory does not exist

* You are able to manually `cd` into the path returned by zoxide

Is this correct?

Yep, that's right.

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

No branches or pull requests

2 participants