Closed CodeMan99 closed 1 year ago
Investigating further it seems there is a mismatch between the test expectations and the intention of the code.
The packing code always respects umask even if the mode is valid. This means that when the original file has umask permissions set, the above test case will fail.
One option for working around this issue is #87 and the following patch.
diff --git a/test/index.js b/test/index.js
index 3f5e07bb2af2..83b42d34cf18 100644
--- a/test/index.js
+++ b/test/index.js
@@ -20,7 +20,7 @@ test('copy a -> copy/a', function (t) {
rimraf.sync(b)
tar.pack(a)
- .pipe(tar.extract(b))
+ .pipe(tar.extract(b, { umask: 0 }))
.on('finish', function () {
var files = fs.readdirSync(b)
t.same(files.length, 1)
@@ -41,7 +41,7 @@ test('copy b -> copy/b', function (t) {
rimraf.sync(b)
tar.pack(a)
- .pipe(tar.extract(b))
+ .pipe(tar.extract(b, { umask: 0 }))
.on('finish', function () {
var files = fs.readdirSync(b)
t.same(files.length, 1)
Wanna send a PR?
Wanna send a PR?
See #87
The mode assertion is failing in my environment.
First, is this line suppose respect any update to "test/fixtures/a/hello.txt"? Reading the test case it seems like this should be the case.
However, the assertion fails when the permissions of the (real) file "test/fixtures/a/hello.txt" is 0664. In my environment the "copy" file is still written with 0644 permissions.
--
OS: Ubuntu 18.04.3 LTS Filesystem: ext4 / tmpfs umask: 0022