Code Monkey home page Code Monkey logo

Comments (18)

dougwilson avatar dougwilson commented on August 21, 2024

git blame points to the change starting from 08471b2 if it helps

from node-graceful-fs.

dougwilson avatar dougwilson commented on August 21, 2024

And the reason your eval is altering global state in node 0.11.13 is because in your eval, the line https://github.com/joyent/node/blob/v0.11.13/lib/fs.js#L153 is run, which modifies the global binding.

from node-graceful-fs.

isaacs avatar isaacs commented on August 21, 2024

Hm, interesting.

I suppose we could just extend the fs module, but I'd want to test it pretty thoroughly before publishing.

from node-graceful-fs.

isaacs avatar isaacs commented on August 21, 2024

Would it be possible to just add a guard in that function in node-core so that it doesn't call multiple times?

from node-graceful-fs.

dougwilson avatar dougwilson commented on August 21, 2024

but I'd want to test it pretty thoroughly before publishing

yes. i don't think there's any hurry here :) in fact, the dirtiest solution is to do the following, lol:

var lib = process.binding('natives').fs.replace(/\bbinding\.FSInitialize\b/, '(function(){})')
var src = pre + lib + post

Would it be possible to just add a guard in that function in node-core so that it doesn't call multiple times?

i.m.o. the only reason it's even like that is because of some weird circular dependency crap. but yes, i would think it should only call once; i don't see any reason why you'd want to call it multiple times. i believe the only reason it is even in js-land is because v8 will optimize the ops into less code than writing the same thing using the c++ api (this is according to the talk about that commit).

from node-graceful-fs.

isaacs avatar isaacs commented on August 21, 2024

Can you please see if 34e473a fixes the issue?

In your node program, you can type npm install isaacs/node-graceful-fs#34e473a915b6d10379151ce3b8ce591549b35c8a to pull in the change.

from node-graceful-fs.

dougwilson avatar dougwilson commented on August 21, 2024

Yes, it does fix it for my limited testing.

I'm going to ping the following people here who were actually encountering the issue (and so I assume make more use of graceful-fs), hopefully for some feedback on if the change has noticeable effects:
@sam-github @mikebarnhardt @bnoordhuis @cgole @raymondfeng

from node-graceful-fs.

sam-github avatar sam-github commented on August 21, 2024

@isaacs

Would it be possible to just add a guard in that function in node-core so that it doesn't call multiple times?

You probably noticed, but a guard fixes fs, but breaks graceful-fs by reversing the problem: it causes the stat object to be an instance of fs.Stats, but not to be an instance of gfs.Stats.

The change LGTM, but I've only minimized reproductions.

from node-graceful-fs.

cgole avatar cgole commented on August 21, 2024

LGTM.

from node-graceful-fs.

sam-github avatar sam-github commented on August 21, 2024

So, works for the apps we noticed it with at strongloop (@cgole @raymondfeng @bnoordhuis and me).

@mikebarnhard?

from node-graceful-fs.

elado avatar elado commented on August 21, 2024

Breaks etag, send, serve-static, browser-sync.

pillarjs/send#63

from node-graceful-fs.

xmlking avatar xmlking commented on August 21, 2024

seams like it is working with Node v0.11.14 without this issue.

from node-graceful-fs.

dougwilson avatar dougwilson commented on August 21, 2024

If you are talking about etag module working, it's because I added a workaround, though it is slow.

from node-graceful-fs.

xmlking avatar xmlking commented on August 21, 2024

@dougwilson you are right , in my case browse-sync -> serve-static -> send -> etag

from node-graceful-fs.

isaacs avatar isaacs commented on August 21, 2024

@elado Are you saying that this gfs change fixes pillarjs/send#63, or that it's still broken? (That is, are you +1ing this change, or -1ing it?)

from node-graceful-fs.

isaacs avatar isaacs commented on August 21, 2024

Published as 3.0.2, since it seems to be a strictly good change that does not affect API at all.

from node-graceful-fs.

elado avatar elado commented on August 21, 2024

@isaacs it was a +1. Thanks.

from node-graceful-fs.

dougwilson avatar dougwilson commented on August 21, 2024

Hi @isaacs , I just wanted to chime in and thank you for coming up with the patch and eventually releasing it. I hope that it doesn't cause any new issues due to some un-forseen issue that it creates. In the end, because of the was the fs module has been changed in 0.11, it helps graceful-fs fulfill the "no global monkey patch" promise :)

from node-graceful-fs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.