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

Testing: Mode Assertions may be Failing #86

Closed
CodeMan99 opened this issue Aug 20, 2019 · 4 comments
Closed

Testing: Mode Assertions may be Failing #86

CodeMan99 opened this issue Aug 20, 2019 · 4 comments

Comments

@CodeMan99
Copy link

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

@CodeMan99
Copy link
Author

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.

@CodeMan99
Copy link
Author

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)

@mafintosh
Copy link
Owner

Wanna send a PR?

@CodeMan99
Copy link
Author

Wanna send a PR?

See #87

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