Skip to content

Commit

Permalink
Skip evaluation of symlinks to data root on IoT Core
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Stahl <darst@microsoft.com>
  • Loading branch information
darstahl committed Jun 13, 2017
1 parent 9c446a4 commit 8e71b1e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
5 changes: 2 additions & 3 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
"github.com/docker/docker/layer"
"github.com/docker/docker/libcontainerd"
"github.com/docker/docker/migrate/v1"
"github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/plugingetter"
"github.com/docker/docker/pkg/registrar"
Expand Down Expand Up @@ -537,7 +536,7 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
if err != nil {
return nil, fmt.Errorf("Unable to get the TempDir under %s: %s", config.Root, err)
}
realTmp, err := fileutils.ReadSymlinkedDirectory(tmp)
realTmp, err := getRealPath(tmp)
if err != nil {
return nil, fmt.Errorf("Unable to get the full path to the TempDir (%s): %s", tmp, err)
}
Expand Down Expand Up @@ -1143,7 +1142,7 @@ func CreateDaemonRoot(config *config.Config) error {
if _, err := os.Stat(config.Root); err != nil && os.IsNotExist(err) {
realRoot = config.Root
} else {
realRoot, err = fileutils.ReadSymlinkedDirectory(config.Root)
realRoot, err = getRealPath(config.Root)
if err != nil {
return fmt.Errorf("Unable to get the full path to root (%s): %s", config.Root, err)
}
Expand Down
5 changes: 5 additions & 0 deletions daemon/daemon_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"

"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/mount"
)

Expand Down Expand Up @@ -86,3 +87,7 @@ func getCleanPatterns(id string) (regexps []*regexp.Regexp) {
}
return
}

func getRealPath(path string) (string, error) {
return fileutils.ReadSymlinkedDirectory(path)
}
5 changes: 5 additions & 0 deletions daemon/daemon_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/docker/docker/container"
"github.com/docker/docker/image"
"github.com/docker/docker/layer"
"github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/sysinfo"
Expand Down Expand Up @@ -525,3 +526,7 @@ func setupDaemonProcess(config *Config) error {
func (daemon *Daemon) setupSeccompProfile() error {
return nil
}

func getRealPath(path string) (string, error) {
return fileutils.ReadSymlinkedDirectory(path)
}
11 changes: 11 additions & 0 deletions daemon/daemon_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/docker/docker/container"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/platform"
Expand Down Expand Up @@ -628,3 +629,13 @@ func (daemon *Daemon) verifyVolumesInfo(container *container.Container) error {
func (daemon *Daemon) setupSeccompProfile() error {
return nil
}

func getRealPath(path string) (string, error) {
if system.IsIoTCore() {
// Due to https://github.com/golang/go/issues/20506, path expansion
// does not work correctly on the default IoT Core configuration.
// TODO @darrenstahlmsft remove this once golang/go/20506 is fixed
return path, nil
}
return fileutils.ReadSymlinkedDirectory(path)
}

0 comments on commit 8e71b1e

Please sign in to comment.