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

Invalid archive tar #47

Open
m93a opened this issue Feb 17, 2018 · 1 comment
Open

Invalid archive tar #47

m93a opened this issue Feb 17, 2018 · 1 comment

Comments

@m93a
Copy link

m93a commented Feb 17, 2018

I'm using a PowerShell script to download and extract an archive. It's a .tar.bz2 and when I use Expand-7Zip for the first time, it only decompresses it, leaving a .tar file. But when I try to extract it, I get an error message saying it's an invalid package. That is weird because when I double-click on it, 7Zip GUI opens it normally 🤔. This is the whole script:

$ErrorActionPreference = "Stop"

function Expand-Tar($TarFile, $Destination) {

    if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) {
        Install-Package -Scope CurrentUser -Force 7Zip4PowerShell > $null
    }

    Expand-7Zip $TarFile $Destination
}

Write-Output "Downloading libraries..."

Invoke-WebRequest http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 -OutFile libs.tar.bz2
New-Item -ItemType directory -Name libs

Write-Output "Exctracting..."

Expand-Tar -TarFile libs.tar.bz2
Expand-Tar -TarFile libs.tar -Destination libs
Remove-Item libs.tar.bz2
Write-Output "Libs have been extracted to the libs/ directory. Copy files for your platform to the debug folder."

And this is the error:

Expand-7Zip : Invalid archive: open/read error! Is it encrypted and a wrong password was provided?
If your archive is an exotic one, it is possible that SevenZipSharp has no signature for its format and thus decided it is TAR by mistake.
At C:\Users\Michal Grňo\Documents\GitHub\mff-totem\getlibs.ps1:14 char:5
+     Expand-7Zip $TarFile $Destination
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (SevenZip4PowerS...ip+ExpandWorker:ExpandWorker) [Expand-7Zip], SevenZipArchiveException
    + FullyQualifiedErrorId : err01,SevenZip4PowerShell.Expand7Zip

As I said, extracting with GUI (v18.01) works fine...

@james-d-elliott
Copy link

I'm going to guess that it's the same filename as you see in the GUI except it ends in .tar? For example if you have file.tar.bz2 and inside that is document.txt, it comes out with document.txt.tar? If so your problem is similar to what I had with the openSUSE images.

What's happening is it's extracting the whole file, correctly, but adding tar to the extension for some reason. For example with http://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-Kubic-kubeadm-MS-HyperV.vhdx.xz it names the file openSUSE-MicroOS.x86_64-Kubic-kubeadm-MS-HyperV.vhdx.tar but it should be openSUSE-MicroOS.x86_64-Kubic-kubeadm-MS-HyperV.vhdx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants