Zoxide unable to jump to directories when exporting zoxide from distrobox container
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
- Install distrobox
- Create archlinux container using distrobox-create -n test -i quay.io/toolbx-images/archlinux-toolbox
- Enter container using distrobox-enter test
- Install zoxide using pacman to get the binary.
- 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.
- Exit the container and perform following steps on host.
- Install zoxide using steps for relevant shell
- CD to directories to populate database
- 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
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).
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.
Just clarifying that I understood correctly:
zoxide query <QUERY>produces a correct pathcd (zoxide query <QUERY>)fails saying the directory does not exist- You are able to manually
cdinto the path returned by zoxide
Is this correct?
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 zoxideIs this correct?
Yep, that's right.