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
Support setting setuid/setgid/sticky in updateMetadata and adapt tests #162
Conversation
@erikkemperman wouldn't there need to be tests added for those actually getting set on the files created? |
This is failing on appveyor (windows) |
Yes, maybe I should've mentioned that in the pr to @tmcgee123 's fork -- it was just quicker to fix the extant tests that now failed than describing it in words. I don't have a Windows box, and am not familiar with appveyor, can we see those errors online somewhere? |
If you post which tests are failing I could run these on a Windows box (I have Windows 7 and 10) and debug them. I can't seem to find the stacktrace or error log either on AppVeyor 😿 |
@tmcgee123 I found them, here. Seems like the mobile version of GH doesn't link these clearly.
Looking at your patch more closely (I just checked the failing tests yesterday) I am wondering why it would need to be anything more than simply changing the mask to Am I missing something obvious? |
@erikkemperman I found the broken tests, sorry I didn't know I needed to click on the node environments it was running in (derp). In regards to the other changes than the mask, I made them because of the inner functionality of updateMetaData (the inner onStat): I was trying to return correctly here, since Windows doesn't have file modes.
I was also concerned that if for some reason if the timesDiff was true and made it to this point, that
|
I think |
Gotcha, reverted my commits and squashed everything, hopefully the build passes this time! |
After looking back at the code, if what you are saying is true can we combine the conditionals? For example:
to this:
|
Yay, getting there! All tests pass! Now, as @phated mentioned, tests ought to be added that actually set these special bits, both for files and directories... |
That would be functionally identical but, imho, less legible. |
@erikkemperman that makes sense. I've went ahead and added tests to the destModes to cover the areas you've said (I went ahead an added on to fileOperations test as well). So, there's something interesting happening with the tests that I need help with. On the CI, the tests pass. But locally (Mac OS X 10.11.1) the test fails with. Quite strange actually, if you look at the failed build: https://travis-ci.org/gulpjs/vinyl-fs/builds/124775406 and then compare to what you are seeing locally with the update test, their results are flopped. Sorry to take so much time with this small change, but I am very glad this repo enforces TDD standards. Thanks for the help! |
@tmcgee123 Sorry, I don't have the time for this that it deserves... Still buried in a project at work. But just a guess: OS-specific differences could be due to mkdirp (which is used to create directories) using Not sure if we should adapt the tests and/or |
It looks like both platforms are passing with that last commit. I'm not sure when I'll have a chance to review. Hopefully tomorrow but it might be next week. Thanks for the work on this. |
Yes, but now it fails npm test on macosx :-( |
I can look into this more today and tomorrow. I was able to figure out the "Linux" file mode by using http://permissions-calculator.org/decode/ which is why the test is passing on CI now and not locally. I think @erikkemperman is on the right track with the umask. In terms of accounting for this in |
@erikkemperman do you think this could be the cause of what we are seeing? https://github.com/substack/node-mkdirp/issues/80 |
Could be, it seems that issue is about new directories vs calling mkdirp on existing directories. It looks like @contra would like mkdirp to just do a chmod in the latter case? Just had a casual glance at it though, I might be way off... Busy busy busy, sorry about that. |
It looks like we don't handle that correctly anyway? Maybe we should write a test for it and skip it with a comment saying that it doesn't work for directories that already exist and point at that issue? I haven't run this locally to test yet. |
I wrote a simple catch like there was for Windows to see if it was Darwin. Let me know if this is acceptable for the time being or if you'd like me to add anything else. Thanks! |
I am now thinking it's not even an OS issue, per se. They might have different defaults for umask but users or admins can override it. So my feeling now is that vinyl-fs should account for it much like mkdirp does. That would mean a more fundamental change than the scope of this issue/pr though... https://en.m.wikipedia.org/wiki/Umask About the issue in the mkdirp repo, contra's suggestion makes sense to me. There's been no response though, maybe it would help if there was a concrete PR for it. |
@erikkemperman the node.js platform's builtin methods already account for umask, so I don't think we need to. |
@phated Yes but the tests seem to be assuming the umask to be But if the umask includes any of the other bits, the tests will fail: $ umask
0022
$ npm test
[pass]
$ umask 0033
$ umask
0033
$ npm test
[FAIL]
$ umask 0022 # don't forget to restore to whatever the first one returned
|
And also, if the effective umask restricts what folks pass into EDIT Sorry, never mind, the above is already handled correctly since The question about literals in the tests stands, though. |
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
@erikkemperman I think process.umask and some weirdness around mkdir modes on OSX are out of scope for this PR/issue combination. I'll open some other issues. |
I'm happy where this is at. Merging. |
@tmcgee123 thanks for this! |
@phated glad to help! Sorry for the delayed response, work has been busy the last week. Hopefully I'll have time to contribute some more, cheers! 🍻 |
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Adapt tests to support for setuid/setgid/sticky bits Relates to #156
Ref #156
Let me know if you need me to get rid of the merge commit, I can open a new branch and apply the changes there if need be.
Thanks everyone for the help!!