Skip to content

".upload-lock File name too long" when using --builders #7565

@NiklasGollenstede

Description

@NiklasGollenstede

Describe the bug

This is fairly non-critical, as there is a simple workaround (at least where I encountered it), but still:

When specifying a log URL for remote builds, the name of a lockfile that nix creates will be longer than 255 bytes, making it fail on many(/most?) filesystems. The base64-ssh-public-host-key quite easily makes the URL long.

Specifically, I was using --builders 'ssh://root@65.109.176.33?compress=true&ssh-key=/tmp/vps-worker-lineage-builder-tmp-keys/login&base64-ssh-public-host-key=c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUJ2ZGJzNFd4MXVaVnNIeDdGOFdnajNpZmRlT2NqQ0x0ODBEYk4reFVJZSsgd29ya2VySG9zdAo= i686-linux,x86_64-linux /tmp/vps-worker-lineage-builder-tmp-keys/login 4 - nixos-test,benchmark,big-parallel,kvm - c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUJ2ZGJzNFd4MXVaVnNIeDdGOFdnajNpZmRlT2NqQ0x0ODBEYk4reFVJZSsgd29ya2VySG9zdAo='.

In this case, one can simply shorten the URL by removing the ssh-key and/or base64-ssh-public-host-key arguments, since that information is in the later args of the builder spec as well. I has the URL in the long, here redundant, form because I was also using it as the arg to --store and --from/--to.

Steps To Reproduce

  1. Have /nix/var/nix/ on an FS with a file name length limit of about 255 bytes (ext-2/3/4, ZFS, ...).
  2. Run nix -j0 --builders-use-substitutes --builders 'ssh://root@65.109.176.33?compress=true&ssh-key=/tmp/vps-worker-lineage-builder-tmp-keys/login&base64-ssh-public-host-key=c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUJ2ZGJzNFd4MXVaVnNIeDdGOFdnajNpZmRlT2NqQ0x0ODBEYk4reFVJZSsgd29ya2VySG9zdAo= i686-linux,x86_64-linux /tmp/vps-worker-lineage-builder-tmp-keys/login 4 - nixos-test,benchmark,big-parallel,kvm - c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUJ2ZGJzNFd4MXVaVnNIeDdGOFdnajNpZmRlT2NqQ0x0ODBEYk4reFVJZSsgd29ya2VySG9zdAo=' buildnixpkgs#something-not-in-the-local-store-yet`
  3. See error

Expected behavior

Nix should probably hash the URL before creating the lockfile, and maybe include the first X bytes o the hostname.

nix-env --version output
nix (Nix) 2.12.0

Additional context

Add any other context about the problem here.

Priorities
👎

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions