node-tar icon indicating copy to clipboard operation
node-tar copied to clipboard

[BUG] Crash when extracting file with hardlink to itself

Open 0xE1E10 opened this issue 1 year ago • 0 comments

See https://github.com/devcontainers/cli/issues/699 for details

/workspaces/cli/dist/spec-node/devContainersSpecCLI.js:6107
        return paths.every((q) => q[0] === fn) && dirs.every((q) => q[0] instanceof Set && q[0].has(fn));
                                   ^

TypeError: Cannot read properties of undefined (reading '0')

Root cause: https://github.com/devcontainers/cli/issues/699#issuecomment-1857028310

Why do we have these?

This happens if a file is specified multiple times indirectly by the directory when it is created. https://github.com/libarchive/libarchive/issues/1381#issuecomment-635066671 Apparently both GNU tar and libarchive just ignore this kind of silly links instead of fixing the problem. It's stupid but might want to do the same for compatibility.

0xE1E10 avatar Dec 15 '23 01:12 0xE1E10