New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path/filepath: filepath.Walk does not work on mounted volumes in Windows containers #26033

Open
buddyspike opened this Issue Jun 24, 2018 · 2 comments

Comments

Projects
None yet
5 participants
@buddyspike

buddyspike commented Jun 24, 2018

What version of Go are you using (go version)?

1.10

Does this issue reproduce with the latest release?

Not sure

What operating system and processor architecture are you using (go env)?

windows 386

What did you do?

  • Cross compile the following program from osx GOOS=windows GOARCH=386 go build -o walk.exe main.go (cross compilation does not really matter, the behaviour outlined below is also consistent even if the binary is produced in a windows)

  • Created a docker container from microsoft/windowsservercore

docker run --rm -it -v c:\files:c:\files microsoft/windowsservercore
  • Ran the program on the mounted volume
walk.exe -path c:\files
package main

import (
	"flag"
	"fmt"
	"os"
	"path/filepath"
)

func main() {
	path := flag.String("path", "", "path to walk")
	flag.Parse()
	fmt.Printf("walking path %v\n", *path)

	err := filepath.Walk(*path, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			panic(err)
		}
		fmt.Printf("visiting %v\n", path)
		return nil
	})

	if err != nil {
		panic(err)
	}
}

What did you expect to see?

List of files and directories in c:\files.

What did you see instead?

Just the root directory

@slrz

This comment has been minimized.

slrz commented Jun 24, 2018

You run the walk program outside of the started container, just on the same directory that is also mounted into the container?

The directory search works ok when using other (non-Go) programs? Can you check what this C program would output?

@namusyaka namusyaka changed the title from filepath.Walk does not work on mounted volumes in Windows containers to path/filepath: filepath.Walk does not work on mounted volumes in Windows containers Jun 24, 2018

@FiloSottile FiloSottile modified the milestones: Go1.12, Go1.11 Jun 26, 2018

@buddyspike

This comment has been minimized.

buddyspike commented Jun 26, 2018

Sorry about the lag in my response. Program is run from the default CWD inside the container. However it's in a mounted directory. To be precise:

Step 1 - Launch the container. c:\files has the items we want to traverse. c:\bin has walk.exe.

docker run --rm -it -v c:\files:c:\files -v c:\bin:c:\bin microsoft/windowsservercore

Step 2 - From cwd, run walk.exe

c:\bin\walk.exe -path c:\files

Using other programs such as dir works just fine on mounted directories.
I will update this thread the with the result of the above program over the next couple of days.

Hopefully this clarifies the situation a bit further.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment