Browse code

Remove skip evaluation of symlinks to data root on IoT Core

This fix was added in 8e71b1e210dc0eff980f39271d6c1dd48d87024e to work around
a go issue (https://github.com/golang/go/issues/20506).

That issue was fixed in
https://github.com/golang/go/commit/66c03d39f3aa65ec522c41e56c569391786539a7,
which is part of Go 1.10 and up. This reverts the changes that were made in
8e71b1e210dc0eff980f39271d6c1dd48d87024e, and are no longer needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/10/11 23:35:50
Showing 4 changed files
... ...
@@ -20,6 +20,7 @@ import (
20 20
 	"sync"
21 21
 	"time"
22 22
 
23
+	"github.com/docker/docker/pkg/fileutils"
23 24
 	"google.golang.org/grpc"
24 25
 
25 26
 	"github.com/containerd/containerd"
... ...
@@ -765,7 +766,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
765 765
 	if err != nil {
766 766
 		return nil, fmt.Errorf("Unable to get the TempDir under %s: %s", config.Root, err)
767 767
 	}
768
-	realTmp, err := getRealPath(tmp)
768
+	realTmp, err := fileutils.ReadSymlinkedDirectory(tmp)
769 769
 	if err != nil {
770 770
 		return nil, fmt.Errorf("Unable to get the full path to the TempDir (%s): %s", tmp, err)
771 771
 	}
... ...
@@ -1447,7 +1448,7 @@ func CreateDaemonRoot(config *config.Config) error {
1447 1447
 	if _, err := os.Stat(config.Root); err != nil && os.IsNotExist(err) {
1448 1448
 		realRoot = config.Root
1449 1449
 	} else {
1450
-		realRoot, err = getRealPath(config.Root)
1450
+		realRoot, err = fileutils.ReadSymlinkedDirectory(config.Root)
1451 1451
 		if err != nil {
1452 1452
 			return fmt.Errorf("Unable to get the full path to root (%s): %s", config.Root, err)
1453 1453
 		}
... ...
@@ -9,7 +9,6 @@ import (
9 9
 	"strings"
10 10
 
11 11
 	"github.com/docker/docker/daemon/config"
12
-	"github.com/docker/docker/pkg/fileutils"
13 12
 	"github.com/docker/docker/pkg/mount"
14 13
 	"github.com/docker/libnetwork/resolvconf"
15 14
 	"github.com/pkg/errors"
... ...
@@ -123,10 +122,6 @@ func getCleanPatterns(id string) (regexps []*regexp.Regexp) {
123 123
 	return
124 124
 }
125 125
 
126
-func getRealPath(path string) (string, error) {
127
-	return fileutils.ReadSymlinkedDirectory(path)
128
-}
129
-
130 126
 func shouldUnmountRoot(root string, info *mount.Info) bool {
131 127
 	if !strings.HasSuffix(root, info.Root) {
132 128
 		return false
... ...
@@ -12,7 +12,6 @@ import (
12 12
 	"github.com/docker/docker/container"
13 13
 	"github.com/docker/docker/daemon/config"
14 14
 	"github.com/docker/docker/pkg/containerfs"
15
-	"github.com/docker/docker/pkg/fileutils"
16 15
 	"github.com/docker/docker/pkg/idtools"
17 16
 	"github.com/docker/docker/pkg/parsers"
18 17
 	"github.com/docker/docker/pkg/platform"
... ...
@@ -651,16 +650,6 @@ func (daemon *Daemon) setupSeccompProfile() error {
651 651
 	return nil
652 652
 }
653 653
 
654
-func getRealPath(path string) (string, error) {
655
-	if system.IsIoTCore() {
656
-		// Due to https://github.com/golang/go/issues/20506, path expansion
657
-		// does not work correctly on the default IoT Core configuration.
658
-		// TODO @darrenstahlmsft remove this once golang/go/20506 is fixed
659
-		return path, nil
660
-	}
661
-	return fileutils.ReadSymlinkedDirectory(path)
662
-}
663
-
664 654
 func (daemon *Daemon) loadRuntimes() error {
665 655
 	return nil
666 656
 }
... ...
@@ -120,8 +120,6 @@ func IsWindowsClient() bool {
120 120
 
121 121
 // IsIoTCore returns true if the currently running image is based off of
122 122
 // Windows 10 IoT Core.
123
-// @engine maintainers - this function should not be removed or modified as it
124
-// is used to enforce licensing restrictions on Windows.
125 123
 func IsIoTCore() bool {
126 124
 	var returnedProductType uint32
127 125
 	r1, _, err := procGetProductInfo.Call(6, 1, 0, 0, uintptr(unsafe.Pointer(&returnedProductType)))