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

Closed
Zillode opened this Issue May 18, 2015 · 4 comments

Comments

Projects
None yet
5 participants
@Zillode

Zillode commented May 18, 2015

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)

@minux

This comment has been minimized.

Show comment
Hide comment
@minux

minux May 18, 2015

Member
Member

minux commented May 18, 2015

@Zillode

This comment has been minimized.

Show comment
Hide comment
@Zillode

Zillode May 18, 2015

I figured this issue is different because we use explicitly use the UNC paths (where #3358 tries to automatically support long paths for all functions).
We'll implement a custom MkdirAll if this seems out of scope for the moment, thanks.

Zillode commented May 18, 2015

I figured this issue is different because we use explicitly use the UNC paths (where #3358 tries to automatically support long paths for all functions).
We'll implement a custom MkdirAll if this seems out of scope for the moment, thanks.

@DmitriyMV

This comment has been minimized.

Show comment
Hide comment
@DmitriyMV

DmitriyMV Feb 19, 2018

@minux @ianlancetaylor I think it's a predecessor of #22230 and can be safely closed.

@minux @ianlancetaylor I think it's a predecessor of #22230 and can be safely closed.

@bradfitz

This comment has been minimized.

Show comment
Hide comment
@bradfitz

bradfitz Feb 19, 2018

Member

@DmitriyMV, thanks, closing. Fixed by 7a1347a

Member

bradfitz commented Feb 19, 2018

@DmitriyMV, thanks, closing. Fixed by 7a1347a

@bradfitz bradfitz closed this Feb 19, 2018

@BowmanChen BowmanChen referenced this issue in go-gitea/gitea Jun 14, 2018

Closed

Failed to create repository on windows network drive #4245

2 of 7 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment