Merge pull request #2485 from AkihiroSuda/fix-native-root-permission
native: set '/' permission to 0755
This commit is contained in:
commit
92d147ebde
@ -251,6 +251,9 @@ func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to create temp dir")
|
return nil, errors.Wrap(err, "failed to create temp dir")
|
||||||
}
|
}
|
||||||
|
if err := os.Chmod(td, 0755); err != nil {
|
||||||
|
return nil, errors.Wrapf(err, "failed to chmod %s to 0755", td)
|
||||||
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if td != "" {
|
if td != "" {
|
||||||
|
@ -62,6 +62,7 @@ func SnapshotterSuite(t *testing.T, name string, snapshotterFn func(ctx context.
|
|||||||
|
|
||||||
t.Run("StatInWalk", makeTest(name, snapshotterFn, checkStatInWalk))
|
t.Run("StatInWalk", makeTest(name, snapshotterFn, checkStatInWalk))
|
||||||
t.Run("CloseTwice", makeTest(name, snapshotterFn, closeTwice))
|
t.Run("CloseTwice", makeTest(name, snapshotterFn, closeTwice))
|
||||||
|
t.Run("RootPermission", makeTest(name, snapshotterFn, checkRootPermission))
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeTest(name string, snapshotterFn func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error), fn func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string)) func(t *testing.T) {
|
func makeTest(name string, snapshotterFn func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error), fn func(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string)) func(t *testing.T) {
|
||||||
@ -844,3 +845,18 @@ func closeTwice(ctx context.Context, t *testing.T, snapshotter snapshots.Snapsho
|
|||||||
t.Fatalf("The second close failed: %+v", err)
|
t.Fatalf("The second close failed: %+v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkRootPermission(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) {
|
||||||
|
preparing, err := snapshotterPrepareMount(ctx, snapshotter, "preparing", "", work)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer testutil.Unmount(t, preparing)
|
||||||
|
st, err := os.Stat(preparing)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if mode := st.Mode() & 0777; mode != 0755 {
|
||||||
|
t.Fatalf("expected 0755, got 0%o", mode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user