isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 148 forks source link

Error: ENOTSUP: operation not supported on socket, chmod - Polyfills #159

Open florian-kittel opened 5 years ago

florian-kittel commented 5 years ago

This error handling causes, that our copysync with fs-extra to the network share is not working anymore.

function chmodFixSync (orig) {
    if (!orig) return orig
    return function (target, mode) {
      try {
        return orig.call(fs, target, mode)
      } catch (er) {
        if (!chownErOk(er)) throw er
      }
    }
  }

https://github.com/isaacs/node-graceful-fs/blob/master/polyfills.js#L248

I don't know why you need to check it, but is there a way to disable this? Because when I comment this line out, it works fine for the hole project.

Summery from the stack trace:

C:\Users\...\AppData\Roaming\npm\node_modules\...\node_modules\graceful-fs\polyfills.js:250
      if (!chownErOk(er)) throw er
                          ^

Error: ENOTSUP: operation not supported on socket, chmod '\\YOURNETWORKADDRESS'
    at Object.fs.chmodSync (fs.js:1123:18)
    at Object.chmodSync (C:\Users\...\AppData\Roaming\npm\node_modules\...\node_modules\graceful-fs\polyfills.js:248:19)
    at mkDirAndCopy (C:\Users\...\AppData\Roaming\npm\node_modules\...\node_modules\fs-extra\lib\copy-sync\copy-sync.js:107:13)
...
coreyfarrell commented 4 years ago

You are asking that we suppress all errors given from fs.chmodSync. I'm not sure how this is an issue with graceful-fs, if you ran require('fs').chmodSync('\\YOURNETWORKADDRESS') without loading graceful-fs wouldn't you get the same result?