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

builtins.fetchTarball with a single-file tarball produces an empty derivation #10983

Open
Silic0nS0ldier opened this issue Jun 28, 2024 · 0 comments
Assignees
Labels
bug fetching Networking with the outside (non-Nix) world

Comments

@Silic0nS0ldier
Copy link

Describe the bug

Using a .tar.gz file which only contains a file with builtins.fetchTarball results in a derivation that is an empty directory.

This behaviour is inconsistent with nix-prefetch-url --unpack which is often cited as the recommended way to obtain sha256 for these fixed output derivations.

Steps To Reproduce

let
  dotslashPath = builtins.fetchTarball {
    url = "https://github.com/facebook/dotslash/releases/download/v0.4.1/dotslash-macos.v0.4.1.tar.gz";
  };
in
  dotslashPath
❯ nix-instantiate --eval ./testing.nix                  
"/nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source"
❯ file /nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source
/nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source: directory
❯ ls -l /nix/store/0ccnxa25whszw7mgbgyzdm4nqc0zwnm8-source
total 0

Expected behavior

The documentation states that the top-level directory will be removed, but does not specify what happens when there is no top-level directory.

#4785 suggests that prior to a certain Nix release the file would have been extracted successfully. Looking back at a past release may help to inform what should happen.

My personal preference is that fetching of a single-file tarball would work, and that the filename be perserved (this does not happen with nix-prefetch-url --unpack, the file ends up being placed at the store path itself). If that is not possible, a clear error.

nix-env --version output

nix-env (Nix) 2.23.0

Additional context

Similar expected behaviour ambiguity to #4785

Priorities

Add 👍 to issues you find important.

@roberth roberth added the fetching Networking with the outside (non-Nix) world label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fetching Networking with the outside (non-Nix) world
Projects
None yet
Development

No branches or pull requests

3 participants