summaryrefslogtreecommitdiff
path: root/tests/defaults/main_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-05-15 23:00:47 +0200
committerJakob Unterwurzacher2018-05-15 23:00:47 +0200
commit7b0068180772b9dd7e0b00ca9e1b0f3ce39c9c23 (patch)
tree61d774de8b89e2183dacc78bf3f7e258714dcd9a /tests/defaults/main_test.go
parentf7a6f4d46858dcd049bcf671509bdf42e5d26d09 (diff)
xattr: return EOPNOTSUPP for unsupported attributes
mv is unhappy when we return EPERM when it tries to set system.posix_acl_access: mv: preserving permissions for ‘b/x’: Operation not permitted Now we return EOPNOTSUPP like tmpfs does and mv seems happy.
Diffstat (limited to 'tests/defaults/main_test.go')
-rw-r--r--tests/defaults/main_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 49c6dcf..89d3bfc 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -193,3 +193,42 @@ func TestWrite0200File(t *testing.T) {
t.Fatal("wrong restored permissions")
}
}
+
+// When xattr support was introduced, mv threw warnings like these:
+// mv: preserving permissions for ‘b/x’: Operation not permitted
+// because we returned EPERM when it tried to set system.posix_acl_access.
+// Now we return EOPNOTSUPP and mv is happy.
+func TestMvWarnings(t *testing.T) {
+ fn := test_helpers.TmpDir + "/TestMvWarnings"
+ err := ioutil.WriteFile(fn, nil, 0600)
+ if err != nil {
+ t.Fatalf("creating file failed: %v", err)
+ }
+ cmd := exec.Command("mv", fn, test_helpers.DefaultPlainDir)
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Log(string(out))
+ t.Fatal(err)
+ }
+ if len(out) != 0 {
+ t.Fatalf("Got warnings from mv:\n%s", string(out))
+ }
+}
+
+// See TestCpWarnings.
+func TestCpWarnings(t *testing.T) {
+ fn := test_helpers.TmpDir + "/TestCpWarnings"
+ err := ioutil.WriteFile(fn, []byte("foo"), 0600)
+ if err != nil {
+ t.Fatalf("creating file failed: %v", err)
+ }
+ cmd := exec.Command("cp", "-a", fn, test_helpers.DefaultPlainDir)
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Log(string(out))
+ t.Fatal(err)
+ }
+ if len(out) != 0 {
+ t.Fatalf("Got warnings from cp -a:\n%s", string(out))
+ }
+}