Skip to content

os: MkdirAll fails when creating top-level UNC paths on Windows #10900

@Zillode

Description

@Zillode

Go 1.4, Windows

When the top-level folder of a Windows UNC path does not exist, the os.MkdirAll function goes one step too deep in recursion. This is illustrated in the following scenario:

  1. Make sure C:\Test does not exist
  2. Try to create a new folder with arbitrary depth os.MkdirAll("\\\\?\\C:\\Test", 0700) using UNC (we use UNC to support long paths).
  3. This fails with The filename, directory name, or volume label syntax is incorrect. This is due to a bug in the Go library. The callstack reveals that it tries to create the folder \\?, which should not happen.

(Related to syncthing/syncthing#1822)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions