From bbb3e91a44fde7bdb3d179e27afdaa4b08fa74ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s=20Combarro=20=22piranna?= Date: Tue, 19 Apr 2016 14:52:43 +0200 Subject: [PATCH] Ensure packed symlinks have size zero as required by GNU `tar` --- pack.js | 2 +- test/pack.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pack.js b/pack.js index 4671393..025f007 100644 --- a/pack.js +++ b/pack.js @@ -117,7 +117,7 @@ Pack.prototype.entry = function (header, buffer, callback) { var self = this - if (!header.size) header.size = 0 + if (!header.size || header.type === 'symlink') header.size = 0 if (!header.type) header.type = modeToType(header.mode) if (!header.mode) header.mode = header.type === 'directory' ? DMODE : FMODE if (!header.uid) header.uid = 0 diff --git a/test/pack.js b/test/pack.js index 55817e0..49f7a90 100644 --- a/test/pack.js +++ b/test/pack.js @@ -110,7 +110,8 @@ test('types', function (t) { uname: 'maf', gname: 'staff', uid: 501, - gid: 20 + gid: 20, + size: 9 // Should convert to zero }) pack.finalize()