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

stdenv: default unpack can unpack bzip2 as well #79127

Closed
wants to merge 1 commit into from

Conversation

@bhipple
Copy link
Contributor

@bhipple bhipple commented Feb 2, 2020

Running tar xf foo.bz2 will successfully decompress without explicitly passing
the tar options, just like the others in this list.

Since it often produces smaller archives without significantly increasing
compression or decompression time, we may want to use it more often.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Running `tar xf foo.bz2` will successfully decompress without explicitly passing
the tar options, just like the others in this list.

Since it often produces smaller archives without significantly increasing
compression or decompression time, we may want to use it more often.
@bhipple bhipple requested review from Ericson2314 and matthewbauer as code owners Feb 2, 2020
case "$fn" in
*.tar.xz | *.tar.lzma | *.txz)
# Don't rely on tar knowing about .xz.
xz -d < "$fn" | tar xf -
;;
*.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
*.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz | *.bz2)

This comment has been minimized.

@bhipple

bhipple Feb 2, 2020
Author Contributor

Other lines are just stylistically updating for consistency while we're here rebuilding the world; most other functions in stdenv's setup.sh don't have padding whitespace.

A local run for me of tar xf out.bz2 works just fine for me on NixOS, using tar v1.32. Not sure if there's a reason we're excluding bz2? It seems to be used for distribution of a bunch of the bootstrap binaries, alongside xz, so it seems reasonable to support it.
https://nixos.org/releases/nix/nix-2.3.2/

@bhipple
Copy link
Contributor Author

@bhipple bhipple commented Feb 2, 2020

Per tip from @samueldr on IRC, all bz2 tarballs should be named *.tar.bz2, which will be caught by the *.tar.* clause in the conditional already; hence we don't need the explicit clause for bz2.

@bhipple bhipple closed this Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.