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

ENOENT while extracting an tar with hardlinks #93

Open
xingrz opened this issue Nov 1, 2021 · 2 comments
Open

ENOENT while extracting an tar with hardlinks #93

xingrz opened this issue Nov 1, 2021 · 2 comments

Comments

@xingrz
Copy link

xingrz commented Nov 1, 2021

File: gcc-arm-none-eabi-9-2020-q2-update-mac.tar.bz2 from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads/9-2020-q2-update

[Error: ENOENT: no such file or directory, link './arm-none-eabi/lib/libg.a' -> '/Users/XiNGRZ/****/arm-none-eabi/lib/libc.a'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'link',
  path: './arm-none-eabi/lib/libg.a',
  dest: '/Users/XiNGRZ/****/arm-none-eabi/lib/libc.a'
}

Just did some investigation and found:

return fsP.symlink(x.linkname, dest);

I think x.linkname should be joined with the output path. Otherwise fsPromises.symlink can't find the target.

@xingrz xingrz changed the title ENOENT while extracting an tar with symlinks ENOENT while extracting an tar with hardlinks Nov 3, 2021
xingrz added a commit to xingrz/decompress that referenced this issue Nov 3, 2021
@xingrz
Copy link
Author

xingrz commented Nov 3, 2021

Finally I've fixed the problem. I would like to share my solution.

The issue was brought by hard links:

  1. The source of hard link should be an absolute path, instead of a relative path
  2. Creation of hard links should be deferred until all files are wrote to the file system

I've make a test case to reproduce the issue, as well as the solution. Since my fork was refactored far ahead from this project, I'm not going to make a PR.

@ilg-ul
Copy link

ilg-ul commented Feb 4, 2023

I also encountered this error.

Is it possible to fix this package to include the patch suggested by @xingrz ?

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