Skip to content

[BUG] tar does not resolve when extracting a tarball including multiple symlinks that point at the same file #265

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

Closed
ewanharris opened this issue Nov 26, 2020 · 3 comments

Comments

@ewanharris
Copy link

What / Why

When extracting a tarball that includes multiple symlinks that point at the same file, tar will never resolve (or call the callback).

This only occurs when running on Windows and symlinks cannot be created (i.e. not running as an administrator or with developer mode enabled). However, the EPERM failures are not fatal errors so I would consider what's occurring here a bug. This works fine on [email protected] and looks to have appeared around 5.X

In larger tarballs when this situation occurs this causes the extraction to finish and the extracted folder to be incomplete and invalid.

When

  • tar: 5.0.5, 6.0.5

  • Node.js: 10.23.0, 12.20.0

  • n/a

Current Behaviour

In step 3 done! is never logged

Steps to Reproduce

  1. Download output-with.tar.gz and
    output.tar.gz
  2. Run the below code in a node repl from the same folder as the tar.gz file (this is the tarball that works fine)
require('tar').x({file: 'output.tar.gz'})
    .then(() => console.log('done!'))
    .catch((err) => console.log(err));
  1. Run the below code in a node repl from the same folder as the tar.gz file
require('tar').x({file: 'output-with.tar.gz'})
    .then(() => console.log('done!'))
    .catch((err) => console.log(err));

Expected Behavior

At step 3, done! is logged and extraction is completed

@ewanharris
Copy link
Author

Curiously, when passing sync: true this doesn't occur

@isaacs
Copy link
Owner

isaacs commented Aug 2, 2021

Can you test this again? I can't seem to reproduce on the latest v6.

@ewanharris
Copy link
Author

I can still repro this issue on tar 6.1.3/Node.js 14.17.4

Do you have symlink creation disabled? mklink foo package.json should fail with You do not have sufficient privilege to perform this operation.. If you have Developer Mode enabled then disabling it should disable symlink creation

@isaacs isaacs closed this as completed in 9f6f97c Aug 3, 2021
isaacs added a commit that referenced this issue Aug 3, 2021
Also, close the fd, no matter what happens.

Fix: #265
Fix: #276
isaacs added a commit that referenced this issue Aug 9, 2021
Also, close the fd, no matter what happens.

Fix: #265
Fix: #276
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