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

Possible problem with tests running in a setgid dir #103

Closed
OnkelTem opened this issue Sep 29, 2015 · 1 comment
Closed

Possible problem with tests running in a setgid dir #103

OnkelTem opened this issue Sep 29, 2015 · 1 comment

Comments

@OnkelTem
Copy link
Contributor

These tests fail on my system (Linux/Ubuntu):

  1. dest stream should write directories to the right folder
  2. dest stream should use different modes for files and directories
  3. symlink stream should use different modes for files and directories

After some debugging I figured out that all three tests fail due to the project directory (and its subdirectories) permissions which has setgid bit set.

To reproduce execute this command:

$ find test -type d -exec chmod g+s {} \;

and then run the tests.

Whys

Let's look at the first failing test should write directories to the right folder.
The expected mode of a dir is:

var expectedMode = parseInt('655', 8);

and the failing line is:

realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode);

and my run-time values were:

fs.lstatSync(expectedPath).mode.toString(8) // 42655
realMode(fs.lstatSync(expectedPath).mode).toString(8) // 2655 != 655 (expectedMode)

— i.e. it didn't expect an extra bit set by the filesystem.

Ideas? Can't we just make realMode() more loosing like this:

var realMode = function(n) {
-  return n & parseInt('7777', 8);
+  return n & parseInt('777', 8);
};
@yocontra
Copy link
Member

PR?

@phated phated closed this as completed in e33b632 Dec 16, 2015
phated added a commit that referenced this issue Nov 28, 2017
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