-
-
Notifications
You must be signed in to change notification settings - Fork 214
Closed
Description
When there are two files pointing to same inode:
mkdir files
touch files/file0
ln files/file0 files/file1node-tar writes them to tarball as regular file + hardlink:
const tar = require("tar")
const fs = require("fs")
tar
.create({}, ["files"])
.pipe(fs.createWriteStream("tarball.tar"))But sometimes (with ~10% chance) these records are placed in the wrong order (link goes before the file):
> node index.js; and tar --list --verbose -f tarball.tar
drwxr-xr-x zblzgamer/1000 0 2025-12-09 14:56 files/
hrw-r--r-- zblzgamer/1000 0 2025-12-09 14:56 files/file0 link to files/file1
-rw-r--r-- zblzgamer/1000 0 2025-12-09 14:56 files/file1tar decompresses this tarball partially and with error:
> tar -xf tarball.tar --directory=extracted
tar: files/file0: Cannot hard link to ‘files/file1’: No such file or directory
tar: Exiting with failure status due to previous errors
> find extracted
extracted
extracted/files
extracted/files/file1
node-tar version: 7.5.2
node version: v25.2.1
OS: Arch Linux
FS: btrfs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels