Skip to content

Nix copy to s3 skips upload when another endpoint have the same bucket name #15974

@csernazs

Description

@csernazs

Describe the bug

When copying nix paths to two different s3 servers which have the same bucket name, the second copy does not copy the paths.

Steps To Reproduce

Copy a store path to foo.example.com:

nix copy -v /nix/store/...  --to s3://nix?profile=foo&scheme=https&endpoint=foo.example.com

Then, for the same path, copy it to bar.example.com:

nix copy -v /nix/store/...  --to s3://nix?profile=bar&scheme=https&endpoint=bar.example.com

This second command won't copy anything to the server, it will print copying 0 paths... and no connection attempts are made to the bar.example.com (according to strace and more verbose output).

The workaround is to specify --option narinfo-cache-positive-ttl 0, but it reduces the speed of copy dramatically if the closure is large.

Expected behavior

The path is copied to both servers.

Metadata

nix-env (Nix) 2.31.3

Additional context

I think the issue is that in ~/.cache/nix/binary-cache-v7.sqlite, nix registers the target as s3://nix (so only the bucket name is stored there), without the hostname or other parameters. That makes the second nix copy believe that the paths have been already copied.

Checklist

  • checked [latest Nix manual] ([source])
  • checked [open bug issues and pull requests] for possible duplicates

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