devbox icon indicating copy to clipboard operation
devbox copied to clipboard

[Bug]: The default "tar" command can not recognize a compressed file with a suffix ".txz"

Open jianliang00 opened this issue 2 years ago • 2 comments

Current Behavior (bug) I got following error when I use "tar" command to unpack a compressed file named "file.txz" in devbox shell on Mac:

$ /nix/store/4ifdvs7fjczlvyssp1h91139n4yb57d3-gnutar-1.35/bin/tar xf /var/folders/bx/rkz1lhfd5pbdnk5gthwjjkdm0000gn/T/d20231129-24858-15lo80l/file.txz -C /var/folders/bx/rkz1lhfd5pbdnk5gthwjjkdm0000gn/T/d20231129-24858-15lo80l
   /nix/store/4ifdvs7fjczlvyssp1h91139n4yb57d3-gnutar-1.35/bin/tar: This does not look like a tar archive
   /nix/store/4ifdvs7fjczlvyssp1h91139n4yb57d3-gnutar-1.35/bin/tar: Skipping to next header
   /nix/store/4ifdvs7fjczlvyssp1h91139n4yb57d3-gnutar-1.35/bin/tar: Exiting with failure status due to previous errors

Expected Behavior (fix) The 'tar' command functions properly in the devbox shell on Mac when unpacking a compressed file whose name ends with '.txz'.

Additional context I checked the version of tar command in devbox shell and found that the devbox use gnutar as the default "tar" command. While outside the shell, I found the default version of "tar" command is bsdtar.

By the way, the orignional command used to unpack the file is generated by Cocoapods, so I'm not able to use other command or arguments to do the unpacking process

Here's the output of devbox version -v and a copy of my devbox.json file.

Version:     0.8.2
Platform:    darwin_amd64
Commit:      33ea788cb4dbf6958208669c9e4df9c1e858ad2c
Commit Time: 2023-11-15T00:23:52Z
Go Version:  go1.21.3
Launcher:    0.2.0
{
  "packages": ["[email protected]"],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

jianliang00 avatar Nov 29 '23 11:11 jianliang00

I think there was a similar post in the Discord. If you need bsdtar, the correct package to install is [libarchive](https://www.nixhub.io/packages/libarchive). This is unfortunately not very clear from the package description or title, so we should add some more information in Nixhub to clarify this

Lagoja avatar Dec 04 '23 18:12 Lagoja

The libarchive package only provides the bsdtar command, but does not provide the tar command. I want to replace the tar command provided by gnutar with bsdtar. @Lagoja

jianliang00 avatar Dec 07 '23 05:12 jianliang00