Skip to content

Commit

Permalink
Remove Windows' Readlink fork
Browse files Browse the repository at this point in the history
This reverts the part of commit 8100e75 (PR containerd#113)
that added the fork of Readlink() for Windows.

At that time the fork was done to work around the bug
in golang's implementation of os.Readlink() for Windows.

The above bug was never reported upstream, but fortunately
it was independently found, reported [1], and fixed [2].
The fix made its way into go-1.13 (there is no mention of
that in release notes, so I checked it in git history).

[1] golang/go#30463
[2] https://go-review.googlesource.com/c/go/+/164201

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Feb 27, 2020
1 parent 26c1120 commit 5f26c82
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 279 deletions.
4 changes: 4 additions & 0 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ func (d *driver) Lstat(p string) (os.FileInfo, error) {
return os.Lstat(p)
}

func (d *driver) Readlink(p string) (string, error) {
return os.Readlink(p)
}

func (d *driver) Mkdir(p string, mode os.FileMode) error {
return os.Mkdir(p, mode)
}
Expand Down
5 changes: 0 additions & 5 deletions driver/driver_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,3 @@ func (d *driver) LSetxattr(path string, attrMap map[string][]byte) error {
func (d *driver) DeviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) {
return devices.DeviceInfo(fi)
}

// Readlink was forked on Windows to fix a Golang bug, use the "os" package here
func (d *driver) Readlink(p string) (string, error) {
return os.Readlink(p)
}
8 changes: 0 additions & 8 deletions driver/driver_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package driver

import (
"os"

"github.com/containerd/continuity/sysx"
)

func (d *driver) Mknod(path string, mode os.FileMode, major, minor int) error {
Expand All @@ -35,9 +33,3 @@ func (d *driver) Lchmod(path string, mode os.FileMode) (err error) {
// TODO: Use Window's equivalent
return os.Chmod(path, mode)
}

// Readlink is forked in order to support Volume paths which are used
// in container layers.
func (d *driver) Readlink(p string) (string, error) {
return sysx.Readlink(p)
}
26 changes: 0 additions & 26 deletions syscallx/syscall_unix.go

This file was deleted.

112 changes: 0 additions & 112 deletions syscallx/syscall_windows.go

This file was deleted.

128 changes: 0 additions & 128 deletions sysx/file_posix.go

This file was deleted.

0 comments on commit 5f26c82

Please sign in to comment.