Skip to content

Glob fails with ENOTSUP on Windows when working of network drive #205

@jvoccia

Description

@jvoccia

Version 3.2.11:
Using Grunt which still uses this older version -- If this belongs over there, I can certainly move it. Not sure if you all are still maintaining the older versions.

When doing globs with paths that contain "**" like:
`"src/**/*.js"``
The error:
ENOTSUP, operation not supported on socket 'W:\folder\project\src\file.js'
Happens and the glob fails, when working off some Windows Network Mapped Drives using DFS (I am not sure of the specific underlying network filesystem details).

See also:
http://stackoverflow.com/questions/30199739/enotup-using-grunt

It looks like the error occurs specifically when the globber calls:
readdirsync on a file, and then gets the "unsupported" error back.

When it handles the error in glob.js ~Line 606:

 // now handle errors, and cache the information
if (er) switch (er.code) {
      case "ENOTDIR": // totally normal. means it *does* exist.
        this.statCache[f] = 1
        return cb.call(this, er)
      case "ENOENT": // not terribly unusual
      case "ELOOP":
      case "ENAMETOOLONG":
      case "UNKNOWN":
        this.statCache[f] = false
        return cb.call(this, er)
      default: // some unusual error.  Treat as failure.
        this.statCache[f] = false
        if (this.strict) this.emit("error", er)
        if (!this.silent) console.error("glob error", er)
          return cb.call(this, er)
    }
  }

It does not allows for the error "ENOTSUP" only the error "ENOTDIR", adding
case "ENOTSUP":
Right after `case "ENOTDIR":``
Seems to resolve the problem, but it is hard to know if this is the only situation this error would come up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions