Skip to content

Error copying directory with sockets despite sockets skipped #173

@hobti01

Description

@hobti01

When copying with copy.Options to skip sockets, receive the following error with 1.14.1, but no error with 1.14.0:

error: lstat /var/mnt/a.sock: operation not supported

We attempting to copy a directory with copy.Options as follows:

opts := copy.Options{
	Skip: func(info os.FileInfo, src, dest string) (bool, error) {
		if info.Mode().Type() == fs.ModeSocket {
			return true, nil
		}
	}
}
err := cp.Copy("/var/mnt", "/tmp", opts)
if err != nil {
	fmt.Println("Error:", err)
}

Now the special circumstances:

  • code is running in a docker container and accessing files that are mounted from the host (MacOS) to the container
    • we don't see any problem in unit tests with sockets when the socket is not mounted into a container
  • if the files in the mount are queried before using copy, e.g. ls /var/mnt, then copy does work as expected

Is there something we're doing incorrectly or could change to have lstat work?

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