| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,40 +0,0 @@ |
| 1 |
-// +build !windows |
|
| 2 |
- |
|
| 3 |
-package dockerfile |
|
| 4 |
- |
|
| 5 |
-import ( |
|
| 6 |
- "os" |
|
| 7 |
- "path/filepath" |
|
| 8 |
-) |
|
| 9 |
- |
|
| 10 |
-func fixPermissions(source, destination string, uid, gid int, destExisted bool) error {
|
|
| 11 |
- // If the destination didn't already exist, or the destination isn't a |
|
| 12 |
- // directory, then we should Lchown the destination. Otherwise, we shouldn't |
|
| 13 |
- // Lchown the destination. |
|
| 14 |
- destStat, err := os.Stat(destination) |
|
| 15 |
- if err != nil {
|
|
| 16 |
- // This should *never* be reached, because the destination must've already |
|
| 17 |
- // been created while untar-ing the context. |
|
| 18 |
- return err |
|
| 19 |
- } |
|
| 20 |
- doChownDestination := !destExisted || !destStat.IsDir() |
|
| 21 |
- |
|
| 22 |
- // We Walk on the source rather than on the destination because we don't |
|
| 23 |
- // want to change permissions on things we haven't created or modified. |
|
| 24 |
- return filepath.Walk(source, func(fullpath string, info os.FileInfo, err error) error {
|
|
| 25 |
- // Do not alter the walk root iff. it existed before, as it doesn't fall under |
|
| 26 |
- // the domain of "things we should chown". |
|
| 27 |
- if !doChownDestination && (source == fullpath) {
|
|
| 28 |
- return nil |
|
| 29 |
- } |
|
| 30 |
- |
|
| 31 |
- // Path is prefixed by source: substitute with destination instead. |
|
| 32 |
- cleaned, err := filepath.Rel(source, fullpath) |
|
| 33 |
- if err != nil {
|
|
| 34 |
- return err |
|
| 35 |
- } |
|
| 36 |
- |
|
| 37 |
- fullpath = filepath.Join(destination, cleaned) |
|
| 38 |
- return os.Lchown(fullpath, uid, gid) |
|
| 39 |
- }) |
|
| 40 |
-} |
| ... | ... |
@@ -301,12 +301,6 @@ func (container *Container) ConfigPath() (string, error) {
|
| 301 | 301 |
return container.GetRootResourcePath(configFileName) |
| 302 | 302 |
} |
| 303 | 303 |
|
| 304 |
-// Returns true if the container exposes a certain port |
|
| 305 |
-func (container *Container) exposes(p nat.Port) bool {
|
|
| 306 |
- _, exists := container.Config.ExposedPorts[p] |
|
| 307 |
- return exists |
|
| 308 |
-} |
|
| 309 |
- |
|
| 310 | 304 |
// StartLogger starts a new logger driver for the container. |
| 311 | 305 |
func (container *Container) StartLogger(cfg containertypes.LogConfig) (logger.Logger, error) {
|
| 312 | 306 |
c, err := logger.GetLogDriver(cfg.Type) |
| ... | ... |
@@ -47,17 +47,6 @@ func assertNotDirectoryError(t *testing.T, err error) {
|
| 47 | 47 |
} |
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 |
-func assertPermissionError(t *testing.T, err error) {
|
|
| 51 |
- perr, ok := err.(*os.PathError) |
|
| 52 |
- if !ok {
|
|
| 53 |
- t.Fatalf("Unexpected error %#v, expected path error", err)
|
|
| 54 |
- } |
|
| 55 |
- |
|
| 56 |
- if perr.Err != syscall.EACCES {
|
|
| 57 |
- t.Fatalf("Unexpected error %s, expected %s", perr.Err, syscall.EACCES)
|
|
| 58 |
- } |
|
| 59 |
-} |
|
| 60 |
- |
|
| 61 | 50 |
func TestCommitFailure(t *testing.T) {
|
| 62 | 51 |
fms, td, cleanup := newFileMetadataStore(t) |
| 63 | 52 |
defer cleanup() |