From 44caf21debd445623fb481827fae6fc8a5eb911d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 17 May 2018 23:14:33 +0200 Subject: tests: add "mv broken symlink" test This currently fails because we do not use llistxattr yet. --- tests/defaults/main_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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" -- cgit v1.2.3