-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Windows 10 test failures not reflected in CI #266
Comments
note: I've updated the text above to reflect errors on the gitignore branch to eliminate those having to do with line endings. |
Now running the tests with elevated permissions gets 100% pass rate. That suggests to me that it's all due to attmpts to create symlinks, rather than NTFS junction points, when running on Windows. Updated problem statement above to reflect this. |
@BurtHarris Having ditched Windows a looong time ago (win98 was the last I've used) I am pretty far from being an expert here -- but a cursory search indicates that this might be due to an OS restriction and there might not be much we can do about it. We've switched to using junctions instead of links for directories, which for some insane reason don't require elevated privileges, but no such escape is apparently available for links to regular files. Some pages that seem relevant: What does and doesn't work with symlinky things on Windows: Possible workaround by changing user/group settings: Or, adapt your use case to work with links to directories instead of files, if that's even possible. Having said all this, it does appear that the tests on Appveyor runs with elevated privileges or in an otherwise permissive environment. That the tests fail in a default Windows setup, presuming that's what you're trying, is something that ought to be addressed IMHO. Perhaps simply by skipping those on Windows. Please understand, though, that the contributors to the gulp ecosystem, as far as I know, hardly work on this OS, so that's how things like this can slip through unfortunately... So if you have suggestions, or would be willing to do a bit more figuring out, that'd be much appreciated! |
@erikkemperman I retired after 17 years as a dev at Microsoft. I'm happy to try to fill in contributor ecosystem gap you mentioned. Feel free to assign these issues to me, I apparently can't self-assign them at this point. I have very little *NIX / open source experience, so it will take a little experimenting for me to put together a PR you'll like. Sorry if that's been unclear, I'm looking for a an opportunity to contribute, is my protocol of reporting the issue before submitting a PR somehow off? I think that the test code still has some cases where symbolic links could be replaced with junction points. For example, https://github.com/gulpjs/vinyl-fs/blob/master/test/src-symlinks.js#L37. If you can confirm I'm on the right track, I'd be happy to PR a fix. I actually think the lack of 1:1 compatibility between symlinks and junction points was intentional. The practice of developers running with elevated privileges is one some of use at Microsoft have tried hard to change. See for example my friend Aaron's blog: https://blogs.msdn.microsoft.com/aaron_margosis/ |
If I'm not mistaken, we have tests that specifically test that links can be created on Windows when permissions are elevated. Those tests should probably have a check to make sure permissions are elevated and skip otherwise. @BurtHarris Is there a way to check for elevated Windows permissions in node (since we can't access getuid)? |
@phated I've not used it before but https://github.com/coreybutler/node-windows looks to be a well-designed windows support package for Node.js. The What would you think of a solution using that package? |
I'd prefer not using another package for this. It looks like we need to exec |
We could do that, just used "NET SESSION" because it's a built-in command and will fail without elevated permissions. I was suggesting the package more for the But what I'd rather do is instead of skipping the tests, adapt them so they can run on Windows without elevation. I'm trying a few experiments now. |
Clarifying above with a few references:
It seems like vinyl-fs has made a choice to treat junctions as a symlink emulator, by making The differences between junctions and symlinks may not be a problem for some common uses use of symlinks, but some of the tests, like the one shown below, are implicitly testing the nested or mult-level redirect; substituting a junction for symlink fails this test. Perhaps what makes sense is separating the symlink tests into a "basic" set, which exercise and test behavior that junctions can emulate, and an advanced set that actually depend on symlink specific privildges. Has this already been done? Are there tests which are designed to cover the of the It is simple to update tests to create junctions, but some "symlink" tests still fail because they are testing behavior that is depending on nested/mult-level behavior that junctions can't emulate (by design.) For example, in src-symlinks.js, the use of
I was initially confused by this failure because the description didn't imply use of nested links. |
P.S. A unit-testing purist point-of-view might be that depending on behavior like resolving nested links goes above and beyond testing vinyl-fs itself. Its testing the behavior of an OS component external to Node.js, which contributes to brittleness in the form of tests aborting for reasons unrelated to the code in the package. |
@BurtHarris if those tests are running on Windows, why do they pass on Appveyor? |
P.S. Thinking of junctions like hardlinks may help explain some other restrictions and understand how to work around them. For example, while you are right that you can't create a file junction, only a directory junction, it is possible to create a file hardlink under windows, and that doesn't require elevated permissions either. |
@phated the tests pass on Appveyor because the account they are running under has elevated permissions. It's like running as root. ref: http://help.appveyor.com/discussions/questions/1888-running-tests-with-reduced-privileges |
@BurtHarris I think there's a disconnect here. |
Disconnect? Not sure about that, but I agree with you on this part: its not the actual production or test code that's causing an exception in Later... |
Sorry you feel that way, I think we've been trying to be supportive here and to accommodate or failing that to take time to try and explain why things are the way they are. You've added some valuable ideas (like we should probably test the case with nested junctions) but keep in mind this is an effort of volunteers doing this in their spare time... |
Erik, thanks. I appreciate your feedback too, however @phated's tendency to close issues/PRs rather than try to work out some compromise is what's so off-putting. Another example, I've just wasted most of this morning trying to debug a fix for some of the above errors. I count my time wasted because it finally turned out the bug was in the outdated version of Mocha this project has devDependency on. Do I want to even ask if your open to upgrading Mocha? This is recurrent: I think that's the third time that stale tool dependencies have wasted my "spare" time. It may be harsh, but I'll refer again to Martin Fowler definition:
The good news, is the problem is NOT in gulp's actual production code. I'm really glad because I plan on continuing to use gulp. The bad news is that the gulp project governance regarding devDependencies is pushing volunteers like me away. |
Mocha supports node 0.10. If you plan to update it here, please go through our ~30 other modules and update them too. Much appreciated ❤️ |
I'll consider it. Have you considered a using a monorepo so that such a task isn't so big and distributed? |
Yes, I've considered it but monorepos are an anti-pattern that has caught on because 1 person/company decided to build some tooling around them. Multi-repo projects just need a champion to build tooling around them in the same fashion. |
Good luck with that too. |
You mean the babel/lerna guys I guess? I would love to see some utilities for dealing with related multi-repo projects but would imagine it to be that much more complicated... |
Yarn is in the process of added an interesting feature called "workspaces" that took some good ideas from Lerna, but incorporate them at the package manager level. I'll find the reference in a few minutes... |
Of course that's still effectively a monorepo tool, not multi-repo, but Lerna is by no means alone. |
yarn and lerna are (basically) both facebook's... Pointing to yarn doesn't strengthen any case for proper node devs (maybe it works with frontend devs?) |
Back to vinyl-fs... If I'm thinking the answer should be yes... |
Huh, interesting. I quite like yarn. I guess I'm just a bit less concerned about where tools come from, so long as they work well, the license is ok (so not the +patents trojan FB have shackled react with) and the community is active and friendly. Eg, I dislike MS as much as the next guy (I'm old enough to remember the Halloween memos) but I think typescript is actually pretty cool. |
I'm obviously biased, but Facebook scares me much more than Microsoft. None the less, Yarn has my keen interest, the npm client is having some real stability problems. |
I'm debugging I think this is related to the fact that the docs on
It seems like it would be better for the test to report the actual error from the
|
That way the failure is a cleaner message indicating the reason:
P.S. I'm being methodical, trying to get the test to report well before I fix the problem. |
@BurtHarris that's super weird, I thought the outer-wrapping |
It sort of does, but |
There are a lot of places like this, perhaps we need a replacement function for |
Yep, likely. I didn't expect it to work that way. The stream should be torn down before concat gets called. We will probably need to make a custom implementation. |
I'd be happy to give that a shot. Where should it go? |
Stream utilities used for testing go in https://github.com/gulpjs/vinyl-fs/blob/master/test/utils/test-streams.js - Thanks for pointing this out. I'm currently looking into elevated permissions in AppVeyor (and if we can add non-elevated to the test matrix) |
Good idea. There was a earlier note suggesting they didn't support it (http://help.appveyor.com/discussions/questions/1888-running-tests-with-reduced-privileges) but maybe that's changed. |
Mini code review please: /*
* Creates a transform stream which concatenates objects from an object stream into an array.
* At end-of-stream, optional callback is invoked with array of collected objects.
* Array is also passed on to next object in pipeline, if any.
*/
function concat( cb ) {
var array = [];
var transform = through.obj( function( file, enc, done ) {
array.push(file);
done(null, file);
}, function(done) { // Flush
cb && cb(array);
this.push(array);
done();
});
return transform;
} |
The above seems to be working well, but I've noticed that I'm getting a timeout on |
It's probably related because a "through" stream doesn't finish. Try using |
Thanks, that's a big help. |
@phated I see your efforts on the appveyor-restrict branch. |
@BurtHarris thanks. I eventually got the |
Understood. I've hit those same problems w/ mkdir too. I'm sure I'll be able to come up with something, I've got a number of contacts who understand Windows security features better than I do. |
@phated, I've got a prototype to run with limited privileges using PowerShell Jobs. I'll clean it up a bit and submit another PR. The reason that |
@BurtHarris where do we stand on the above? It seems you can actually specify a test script to run in powershell using the |
Hi @phated . I've been busy elsewhere, but should be able to look at this again this week. By the way, I ran into an interesting blogpost about a change in Windows symlink support: https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10. It appears that for developers only recent builds of Windows 10 can avoid needing elevation to create symlinks! That's potentially big. What do you think? |
PR #265 seems to have passed the Appveyor tests, but the tests aren't working in my normal Windows dev environment. This is because Appveyer is running with elevated privileges; I've learned its best not to enable elevated privileges as a developer. But without them, symlinks can't be created on NTFS volumes. NTFS junction points are the recommended alternative, which does not require admin permissions, but I'm not sure if they match up for your use-cases.
node: v6.11.1
npm: 3.10.10
Microsoft Windows [Version 10.0.15063]
The text was updated successfully, but these errors were encountered: