aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-04 14:46:07 +0100
committerGitHub <noreply@github.com>2020-11-04 14:46:07 +0100
commit303191bf522db9af32cabd98a5309e3079da0eb0 (patch)
tree119087ac0cb189310871fbacfc1bd52b3ef451c2
parent7699557b5d644c31b139b24eb2a260a6ec624b19 (diff)
parent47a19346310f3ed7b19ac92dee668107226c83b0 (diff)
downloadpodman-303191bf522db9af32cabd98a5309e3079da0eb0.tar.gz
podman-303191bf522db9af32cabd98a5309e3079da0eb0.tar.bz2
podman-303191bf522db9af32cabd98a5309e3079da0eb0.zip
Merge pull request #8239 from containers/dependabot/go_modules/github.com/containers/storage-1.23.9
Bump github.com/containers/storage from 1.23.8 to 1.23.9
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--vendor/github.com/containers/storage/VERSION2
-rw-r--r--vendor/github.com/containers/storage/pkg/homedir/homedir_linux.go96
-rw-r--r--vendor/github.com/containers/storage/pkg/homedir/homedir_others.go2
-rw-r--r--vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go100
-rw-r--r--vendor/github.com/containers/storage/userns.go125
-rw-r--r--vendor/github.com/containers/storage/utils.go6
-rw-r--r--vendor/modules.txt2
9 files changed, 154 insertions, 185 deletions
diff --git a/go.mod b/go.mod
index bd9effa19..f7e211744 100644
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.7.0
github.com/containers/psgo v1.5.1
- github.com/containers/storage v1.23.8
+ github.com/containers/storage v1.23.9
github.com/coreos/go-systemd/v22 v22.1.0
github.com/cri-o/ocicni v0.2.0
github.com/cyphar/filepath-securejoin v0.2.2
diff --git a/go.sum b/go.sum
index ad40d8f83..603b394c6 100644
--- a/go.sum
+++ b/go.sum
@@ -101,8 +101,8 @@ github.com/containers/psgo v1.5.1/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzP
github.com/containers/storage v1.23.6/go.mod h1:haFs0HRowKwyzvWEx9EgI3WsL8XCSnBDb5f8P5CAxJY=
github.com/containers/storage v1.23.7 h1:43ImvG/npvQSZXRjaudVvKISIuZSfI6qvtSNQQSGO/A=
github.com/containers/storage v1.23.7/go.mod h1:cUT2zHjtx+WlVri30obWmM2gpqpi8jfPsmIzP1TVpEI=
-github.com/containers/storage v1.23.8 h1:Z3KKE9BkbW6CGOjIeTtvX+Dl9pFX8QgvSD2j/tS+r5E=
-github.com/containers/storage v1.23.8/go.mod h1:3b2ktpB6pw53SEeIoFfO0sQfP9+IoJJKPq5iJk74gxE=
+github.com/containers/storage v1.23.9 h1:qbgnTp76pLSyW3vYwY5GH4vk5cHYVXFJ+CsUEBp9TMw=
+github.com/containers/storage v1.23.9/go.mod h1:3b2ktpB6pw53SEeIoFfO0sQfP9+IoJJKPq5iJk74gxE=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-iptables v0.4.5 h1:DpHb9vJrZQEFMcVLFKAAGMUVX0XoRC0ptCthinRYm38=
diff --git a/vendor/github.com/containers/storage/VERSION b/vendor/github.com/containers/storage/VERSION
index 82bfa5ce3..63f23d2af 100644
--- a/vendor/github.com/containers/storage/VERSION
+++ b/vendor/github.com/containers/storage/VERSION
@@ -1 +1 @@
-1.23.8
+1.23.9
diff --git a/vendor/github.com/containers/storage/pkg/homedir/homedir_linux.go b/vendor/github.com/containers/storage/pkg/homedir/homedir_linux.go
deleted file mode 100644
index d28ba9d69..000000000
--- a/vendor/github.com/containers/storage/pkg/homedir/homedir_linux.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package homedir
-
-// Copyright 2013-2018 Docker, Inc.
-// NOTE: this package has originally been copied from github.com/docker/docker.
-
-import (
- "errors"
- "os"
- "path/filepath"
- "strings"
-)
-
-// GetRuntimeDir returns XDG_RUNTIME_DIR.
-// XDG_RUNTIME_DIR is typically configured via pam_systemd.
-// GetRuntimeDir returns non-nil error if XDG_RUNTIME_DIR is not set.
-//
-// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
-func GetRuntimeDir() (string, error) {
- if xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR"); xdgRuntimeDir != "" {
- return xdgRuntimeDir, nil
- }
- return "", errors.New("could not get XDG_RUNTIME_DIR")
-}
-
-// StickRuntimeDirContents sets the sticky bit on files that are under
-// XDG_RUNTIME_DIR, so that the files won't be periodically removed by the system.
-//
-// StickyRuntimeDir returns slice of sticked files.
-// StickyRuntimeDir returns nil error if XDG_RUNTIME_DIR is not set.
-//
-// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
-func StickRuntimeDirContents(files []string) ([]string, error) {
- runtimeDir, err := GetRuntimeDir()
- if err != nil {
- // ignore error if runtimeDir is empty
- return nil, nil
- }
- runtimeDir, err = filepath.Abs(runtimeDir)
- if err != nil {
- return nil, err
- }
- var sticked []string
- for _, f := range files {
- f, err = filepath.Abs(f)
- if err != nil {
- return sticked, err
- }
- if strings.HasPrefix(f, runtimeDir+"/") {
- if err = stick(f); err != nil {
- return sticked, err
- }
- sticked = append(sticked, f)
- }
- }
- return sticked, nil
-}
-
-func stick(f string) error {
- st, err := os.Stat(f)
- if err != nil {
- return err
- }
- m := st.Mode()
- m |= os.ModeSticky
- return os.Chmod(f, m)
-}
-
-// GetDataHome returns XDG_DATA_HOME.
-// GetDataHome returns $HOME/.local/share and nil error if XDG_DATA_HOME is not set.
-//
-// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
-func GetDataHome() (string, error) {
- if xdgDataHome := os.Getenv("XDG_DATA_HOME"); xdgDataHome != "" {
- return xdgDataHome, nil
- }
- home := os.Getenv("HOME")
- if home == "" {
- return "", errors.New("could not get either XDG_DATA_HOME or HOME")
- }
- return filepath.Join(home, ".local", "share"), nil
-}
-
-// GetConfigHome returns XDG_CONFIG_HOME.
-// GetConfigHome returns $HOME/.config and nil error if XDG_CONFIG_HOME is not set.
-//
-// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
-func GetConfigHome() (string, error) {
- if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" {
- return xdgConfigHome, nil
- }
- home := os.Getenv("HOME")
- if home == "" {
- return "", errors.New("could not get either XDG_CONFIG_HOME or HOME")
- }
- return filepath.Join(home, ".config"), nil
-}
diff --git a/vendor/github.com/containers/storage/pkg/homedir/homedir_others.go b/vendor/github.com/containers/storage/pkg/homedir/homedir_others.go
index f7bcfb878..4f778c858 100644
--- a/vendor/github.com/containers/storage/pkg/homedir/homedir_others.go
+++ b/vendor/github.com/containers/storage/pkg/homedir/homedir_others.go
@@ -1,4 +1,4 @@
-// +build !linux
+// +build !linux,!darwin
package homedir
diff --git a/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go b/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go
index dcadb7e8d..0274d037f 100644
--- a/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go
+++ b/vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go
@@ -6,8 +6,12 @@ package homedir
// NOTE: this package has originally been copied from github.com/docker/docker.
import (
+ "errors"
"os"
- "os/user"
+ "path/filepath"
+ "strings"
+
+ "github.com/containers/storage/pkg/unshare"
)
// Key returns the env var name for the user's home dir based on
@@ -25,13 +29,8 @@ func Key() string {
//
// If needing to do nss lookups, do not disable cgo or set osusergo.
func Get() string {
- home := os.Getenv(Key())
- if home == "" {
- if u, err := user.Current(); err == nil {
- return u.HomeDir
- }
- }
- return home
+ homedir, _ := unshare.HomeDir()
+ return homedir
}
// GetShortcutString returns the string that is shortcut to user's home directory
@@ -39,3 +38,88 @@ func Get() string {
func GetShortcutString() string {
return "~"
}
+
+// GetRuntimeDir returns XDG_RUNTIME_DIR.
+// XDG_RUNTIME_DIR is typically configured via pam_systemd.
+// GetRuntimeDir returns non-nil error if XDG_RUNTIME_DIR is not set.
+//
+// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
+func GetRuntimeDir() (string, error) {
+ if xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR"); xdgRuntimeDir != "" {
+ return xdgRuntimeDir, nil
+ }
+ return "", errors.New("could not get XDG_RUNTIME_DIR")
+}
+
+// StickRuntimeDirContents sets the sticky bit on files that are under
+// XDG_RUNTIME_DIR, so that the files won't be periodically removed by the system.
+//
+// StickyRuntimeDir returns slice of sticked files.
+// StickyRuntimeDir returns nil error if XDG_RUNTIME_DIR is not set.
+//
+// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
+func StickRuntimeDirContents(files []string) ([]string, error) {
+ runtimeDir, err := GetRuntimeDir()
+ if err != nil {
+ // ignore error if runtimeDir is empty
+ return nil, nil
+ }
+ runtimeDir, err = filepath.Abs(runtimeDir)
+ if err != nil {
+ return nil, err
+ }
+ var sticked []string
+ for _, f := range files {
+ f, err = filepath.Abs(f)
+ if err != nil {
+ return sticked, err
+ }
+ if strings.HasPrefix(f, runtimeDir+"/") {
+ if err = stick(f); err != nil {
+ return sticked, err
+ }
+ sticked = append(sticked, f)
+ }
+ }
+ return sticked, nil
+}
+
+func stick(f string) error {
+ st, err := os.Stat(f)
+ if err != nil {
+ return err
+ }
+ m := st.Mode()
+ m |= os.ModeSticky
+ return os.Chmod(f, m)
+}
+
+// GetDataHome returns XDG_DATA_HOME.
+// GetDataHome returns $HOME/.local/share and nil error if XDG_DATA_HOME is not set.
+//
+// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
+func GetDataHome() (string, error) {
+ if xdgDataHome := os.Getenv("XDG_DATA_HOME"); xdgDataHome != "" {
+ return xdgDataHome, nil
+ }
+ home := Get()
+ if home == "" {
+ return "", errors.New("could not get either XDG_DATA_HOME or HOME")
+ }
+ return filepath.Join(home, ".local", "share"), nil
+}
+
+// GetConfigHome returns XDG_CONFIG_HOME.
+// GetConfigHome returns $HOME/.config and nil error if XDG_CONFIG_HOME is not set.
+//
+// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
+func GetConfigHome() (string, error) {
+ if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" {
+ return xdgConfigHome, nil
+ }
+ home := Get()
+ if home == "" {
+ return "", errors.New("could not get either XDG_CONFIG_HOME or HOME")
+ }
+ return filepath.Join(home, ".config"), nil
+}
diff --git a/vendor/github.com/containers/storage/userns.go b/vendor/github.com/containers/storage/userns.go
index 5ba8cc418..49ec544a3 100644
--- a/vendor/github.com/containers/storage/userns.go
+++ b/vendor/github.com/containers/storage/userns.go
@@ -221,94 +221,71 @@ outer:
return size, nil
}
+func minInt(a, b int) int {
+ if a < b {
+ return a
+ }
+ return b
+}
+
+func maxInt(a, b int) int {
+ if a < b {
+ return b
+ }
+ return a
+}
+
// subtractHostIDs return the subtraction of the range USED from AVAIL. The range is specified
// by [HostID, HostID+Size).
// ContainerID is ignored.
func subtractHostIDs(avail idtools.IDMap, used idtools.IDMap) []idtools.IDMap {
- switch {
- case used.HostID <= avail.HostID && used.HostID+used.Size >= avail.HostID+avail.Size:
- return nil
- case used.HostID <= avail.HostID && used.HostID+used.Size > avail.HostID && used.HostID+used.Size < avail.HostID+avail.Size:
- newContainerID := avail.ContainerID + used.Size
- newHostID := used.HostID + used.Size
- r := idtools.IDMap{
- ContainerID: newContainerID,
- HostID: newHostID,
- Size: avail.Size + avail.HostID - newHostID,
- }
- return []idtools.IDMap{r}
- case used.HostID > avail.HostID && used.HostID < avail.HostID+avail.Size && used.HostID+used.Size >= avail.HostID+avail.Size:
- r := idtools.IDMap{
+ var out []idtools.IDMap
+ availEnd := avail.HostID + avail.Size
+ usedEnd := used.HostID + used.Size
+ // Intersection of [avail.HostID, availEnd) and (-inf, used.HostID) is [avail.HostID, newEnd).
+ if newEnd := minInt(availEnd, used.HostID); newEnd > avail.HostID {
+ out = append(out, idtools.IDMap{
ContainerID: avail.ContainerID,
HostID: avail.HostID,
- Size: used.HostID - avail.HostID,
- }
- return []idtools.IDMap{r}
- case used.HostID > avail.HostID && used.HostID < avail.HostID+avail.Size && used.HostID+used.Size < avail.HostID+avail.Size:
- r1 := idtools.IDMap{
- ContainerID: avail.ContainerID,
- HostID: avail.HostID,
- Size: used.HostID - avail.HostID,
- }
- r2 := idtools.IDMap{
- ContainerID: used.ContainerID + used.Size,
- HostID: avail.HostID + (used.HostID - avail.HostID),
- Size: avail.HostID + avail.Size - used.HostID - used.Size,
- }
- return []idtools.IDMap{r1, r2}
- default:
- r := idtools.IDMap{
- ContainerID: 0,
- HostID: avail.HostID,
- Size: avail.Size,
- }
- return []idtools.IDMap{r}
- }
+ Size: newEnd - avail.HostID,
+ })
+ }
+ // Intersection of [avail.HostID, availEnd) and [usedEnd, +inf) is [newStart, availEnd).
+ if newStart := maxInt(avail.HostID, usedEnd); newStart < availEnd {
+ out = append(out, idtools.IDMap{
+ ContainerID: newStart + avail.ContainerID - avail.HostID,
+ HostID: newStart,
+ Size: availEnd - newStart,
+ })
+ }
+ return out
}
// subtractContainerIDs return the subtraction of the range USED from AVAIL. The range is specified
// by [ContainerID, ContainerID+Size).
// HostID is ignored.
func subtractContainerIDs(avail idtools.IDMap, used idtools.IDMap) []idtools.IDMap {
- switch {
- case used.ContainerID <= avail.ContainerID && used.ContainerID+used.Size >= avail.ContainerID+avail.Size:
- return nil
- case used.ContainerID <= avail.ContainerID && used.ContainerID+used.Size > avail.ContainerID && used.ContainerID+used.Size < avail.ContainerID+avail.Size:
- newContainerID := used.ContainerID + used.Size
- newHostID := avail.HostID + used.Size
- r := idtools.IDMap{
- ContainerID: newContainerID,
- HostID: newHostID,
- Size: avail.Size + avail.ContainerID - newContainerID,
- }
- return []idtools.IDMap{r}
- case used.ContainerID > avail.ContainerID && used.ContainerID < avail.ContainerID+avail.Size && used.ContainerID+used.Size >= avail.ContainerID+avail.Size:
- r := idtools.IDMap{
- ContainerID: avail.ContainerID,
- HostID: avail.HostID,
- Size: used.ContainerID - avail.ContainerID,
- }
- return []idtools.IDMap{r}
- case used.ContainerID > avail.ContainerID && used.ContainerID < avail.ContainerID+avail.Size && used.ContainerID+used.Size < avail.ContainerID+avail.Size:
- r1 := idtools.IDMap{
+ var out []idtools.IDMap
+ availEnd := avail.ContainerID + avail.Size
+ usedEnd := used.ContainerID + used.Size
+ // Intersection of [avail.ContainerID, availEnd) and (-inf, used.ContainerID) is
+ // [avail.ContainerID, newEnd).
+ if newEnd := minInt(availEnd, used.ContainerID); newEnd > avail.ContainerID {
+ out = append(out, idtools.IDMap{
ContainerID: avail.ContainerID,
HostID: avail.HostID,
- Size: used.ContainerID - avail.ContainerID,
- }
- r2 := idtools.IDMap{
- ContainerID: used.ContainerID + used.Size,
- HostID: avail.HostID + (used.ContainerID - avail.ContainerID),
- Size: avail.ContainerID + avail.Size - used.ContainerID - used.Size,
- }
- return []idtools.IDMap{r1, r2}
- default:
- r := idtools.IDMap{
- ContainerID: avail.ContainerID,
- HostID: avail.HostID,
- Size: avail.Size,
- }
- return []idtools.IDMap{r}
- }
+ Size: newEnd - avail.ContainerID,
+ })
+ }
+ // Intersection of [avail.ContainerID, availEnd) and [usedEnd, +inf) is [newStart, availEnd).
+ if newStart := maxInt(avail.ContainerID, usedEnd); newStart < availEnd {
+ out = append(out, idtools.IDMap{
+ ContainerID: newStart,
+ HostID: newStart + avail.HostID - avail.ContainerID,
+ Size: availEnd - newStart,
+ })
+ }
+ return out
}
// subtractAll subtracts all usedIDs from the available IDs.
diff --git a/vendor/github.com/containers/storage/utils.go b/vendor/github.com/containers/storage/utils.go
index 762c3a00d..bd6c4feb1 100644
--- a/vendor/github.com/containers/storage/utils.go
+++ b/vendor/github.com/containers/storage/utils.go
@@ -273,7 +273,11 @@ func defaultStoreOptionsIsolated(rootless bool, rootlessUID int, storageConf str
storageOpts.RunRoot = defaultRootlessRunRoot
}
if storageOpts.GraphRoot == "" {
- storageOpts.GraphRoot = defaultRootlessGraphRoot
+ if storageOpts.RootlessStoragePath != "" {
+ storageOpts.GraphRoot = storageOpts.RootlessStoragePath
+ } else {
+ storageOpts.GraphRoot = defaultRootlessGraphRoot
+ }
}
}
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index a7b35a318..da35fe19a 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -166,7 +166,7 @@ github.com/containers/psgo/internal/dev
github.com/containers/psgo/internal/host
github.com/containers/psgo/internal/proc
github.com/containers/psgo/internal/process
-# github.com/containers/storage v1.23.8
+# github.com/containers/storage v1.23.9
github.com/containers/storage
github.com/containers/storage/drivers
github.com/containers/storage/drivers/aufs