summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianon Gravi <admwiggin@gmail.com>2014-04-07 21:20:03 -0600
committerTianon Gravi <admwiggin@gmail.com>2014-04-07 21:20:03 -0600
commit603088be928564be2d863a897fbc1729adc74814 (patch)
treeeb7b7d9d87c5fc6de6e8987842b2780a59e3b678
parentbe3a5a2e375a3103883529c7da5563d94df036e3 (diff)
downloaddocker-603088be928564be2d863a897fbc1729adc74814.tar.gz
Fix edge case in bind mount absolute path detection
`filepath.Abs` does more than just `filepath.IsAbs` - namely, `filepath.Clean`, which resolves things like `.../.` or `.../../...`, and causes even an absolute path like `/some/path/../absolute` to fail (or, in my case, `/path/to/docker/.`) Just using `filepath.IsAbs` directly is a much cheaper check, too. :) Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
-rw-r--r--runtime/volumes.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/runtime/volumes.go b/runtime/volumes.go
index 0b6f3734e0..40db177174 100644
--- a/runtime/volumes.go
+++ b/runtime/volumes.go
@@ -177,12 +177,8 @@ func createVolumes(container *Container) error {
if bindMap, exists := binds[volPath]; exists {
isBindMount = true
srcPath = bindMap.SrcPath
- srcAbs, err := filepath.Abs(srcPath)
- if err != nil {
- return err
- }
- if srcPath != srcAbs {
- return fmt.Errorf("%s should be an absolute path", srcPath)
+ if !filepath.IsAbs(srcPath) {
+ return fmt.Errorf("%s must be an absolute path", srcPath)
}
if strings.ToLower(bindMap.Mode) == "rw" {
srcRW = true