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
The documentation states that fetchTarball requires the file to be tar file. Apparently that isn't entirely true and Nix happily consumes other files.
Steps To Reproduce
Open a nix repl and paste nix-repl> builtins.readDir (builtins.fetchTarball "https://releases.nixos.org/nixos/24.05-small/nixos-24.05beta551.6d452319127a/nixos-minimal-24.05beta551.6d452319127a-x86_64-linux.iso")
See that Nix happily downloaded the entire ISO and unpacked it into your store.
Expected behavior
It should fail to unpack the archive..
From the libarchive.org page it seems like the following formats are supported: tar, pax, cpio, zip, xar, lha, ar, cab, mtree, rar, and ISO images. I chose the iso test by random and that succeeded.
nix-env --version output
Additional context
I was trying to figure out what has to be supported to be feature compatible with fetchTarball while working on npins. My objective was to get rid of calling nix-prefetch-url as a subprocess in order to ship the program as a single statically linked binary..
The documentation is clear about the supported formats (with at least
`builtins.fetchTarball`). The way the code was written previously it
supported all the formats that libarchive supported. That is a
surprisingly large amount of formats that are likely not on the radar
of the Nix developers and users. Before people end up relying on
this (or if they do) it is better to break it now before it becomes a
widespread "feature".
FixesNixOS#10917
I depend on mtree support to replace the usecase for #9911 to some degree. It's also impossible to tell whether any of these have leaked into projects already, either. Someone's definitely used this to fetch rar files, or maybe 7z.
Describe the bug
The documentation states that
fetchTarball
requires the file to betar
file. Apparently that isn't entirely true and Nix happily consumes other files.Steps To Reproduce
nix repl
and pastenix-repl> builtins.readDir (builtins.fetchTarball "https://releases.nixos.org/nixos/24.05-small/nixos-24.05beta551.6d452319127a/nixos-minimal-24.05beta551.6d452319127a-x86_64-linux.iso")
Expected behavior
It should fail to unpack the archive..
From the
libarchive.org
page it seems like the following formats are supported: tar, pax, cpio, zip, xar, lha, ar, cab, mtree, rar, and ISO images. I chose theiso
test by random and that succeeded.nix-env --version
outputAdditional context
I was trying to figure out what has to be supported to be feature compatible with
fetchTarball
while working onnpins
. My objective was to get rid of callingnix-prefetch-url
as a subprocess in order to ship the program as a single statically linked binary..Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: