summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-05-17 23:14:33 +0200
committerJakob Unterwurzacher2018-05-17 23:14:33 +0200
commit44caf21debd445623fb481827fae6fc8a5eb911d (patch)
tree4354ba0e6fef5133390add4db7a07cae71745109
parente25d551e18ffcbd10d3e56d8ac76e14aa80f2f8b (diff)
tests: add "mv broken symlink" test
This currently fails because we do not use llistxattr yet.
-rw-r--r--tests/defaults/main_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 89d3bfc..3eae919 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"runtime"
+ "strings"
"sync"
"testing"
@@ -215,6 +216,30 @@ func TestMvWarnings(t *testing.T) {
}
}
+// Check for this bug in symlink handling:
+// $ ln -s /asd/asdasd/asdasd b/foo
+// $ mv b/foo .
+// mv: listing attributes of 'b/foo': No such file or directory
+// strace shows:
+// llistxattr("b/foo", NULL, 0) = -1 ENOENT (No such file or directory)
+func TestMvWarningSymlink(t *testing.T) {
+ fn := test_helpers.DefaultPlainDir + "/TestMvWarningSymlink"
+ err := os.Symlink("/foo/bar/baz", fn)
+ if err != nil {
+ t.Fatal(err)
+ }
+ cmd := exec.Command("mv", fn, test_helpers.TmpDir)
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Log(string(out))
+ t.Fatal(err)
+ }
+ if len(out) != 0 {
+ t.Log(strings.TrimSpace(string(out)))
+ t.Fatal("Got warnings")
+ }
+}
+
// See TestCpWarnings.
func TestCpWarnings(t *testing.T) {
fn := test_helpers.TmpDir + "/TestCpWarnings"