cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.56k stars 259 forks source link

infinite symlink: /tmp/devenv-XXX/devenv-XXX -> /tmp/devenv-XXX #1115

Closed bobvanderlinden closed 3 weeks ago

bobvanderlinden commented 1 month ago

Describe the bug Currently it seems that any devenv creates a devenv-XXX directory in /tmp and creates a symlink in there that points to the same directory.

$ ls -l /tmp/devenv-*/
/tmp/devenv-f4c9edc/:
total 0
lrwxrwxrwx 1 bob.vanderlinden users 19 Apr  5 00:03 devenv-f4c9edc -> /tmp/devenv-f4c9edc

Tools like vite will run into errors when recursing into these directories:

Error: ELOOP: too many symbolic links encountered, stat '.../.devenv/run/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1/devenv-4b8b6c1

Are these symlinks cause of a bug or are they intentionally created?

To reproduce

From what I can tell, these symlinks are created for all devenvs (there are tons of /tmp/devenv-* and all consistently have the symlink).

I ran this in a project using:

{
  languages.javascript.enable = true;
}

And which also uses vite.

Version

devenv 1.0.2 (x86_64-linux)

domenkozar commented 1 month ago

I'm looking into this, but can't see what's creating the symlink.

domenkozar commented 1 month ago
      ls ${lib.escapeShellArg config.devenv.runtime} || true
      mkdir -p ${lib.escapeShellArg config.devenv.runtime}
      ls ${lib.escapeShellArg config.devenv.runtime}

prints

ls: cannot access '/run/user/1000/devenv-0fcf29a': No such file or directory
devenv-0fcf29a
domenkozar commented 1 month ago
++++ mkdir -p /run/user/1000/devenv-0fcf29a
++++ ls /run/user/1000/devenv-0fcf29a
devenv-0fcf29a