You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
❯ 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.
It shows the behavior of the file system object sink which should not describe tarball-specific behavior, but currently does.
This code is probably related to the problem, and I think we should change the GitFileSystemObjectSink to have more straightforward behavior, to make room for the tarball fetching code to handle the "complexity" of handling various layouts of tarball contents.
edolstra
changed the title
builtins.fetchTarball with a single-file tarball produces an empty derivationbuiltins.fetchTarball with a single-file tarball produces an empty store path
Jul 26, 2024
Describe the bug
Using a
.tar.gz
file which only contains a file withbuiltins.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 obtainsha256
for these fixed output derivations.Steps To Reproduce
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
outputnix-env (Nix) 2.23.0
Additional context
Similar expected behaviour ambiguity to #4785
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: