diff options
author | Jakob Unterwurzacher | 2021-07-31 13:24:25 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-07-31 13:24:25 +0200 |
commit | 1bc1db620b061aabf59469a5eb4fb60e3e1701a3 (patch) | |
tree | d569e213c3a046cdb1fa01fe089fbab048a6fdfe /tests | |
parent | eecbcbb0905320fc8a030fb716bee259bf6dd00f (diff) |
fusefrontend: -sharedstorage: present stable inode numbers
Use the Gen field (inode generation) to distinguish hard links
while passing the real inode numbers to userspace.
Fixes https://github.com/rfjakob/gocryptfs/issues/584
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cli/cli_test.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index df36822..33c9e7b 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -929,8 +929,8 @@ func TestInitNotEmpty(t *testing.T) { } } -// TestSharedstorage checks that `-sharedstorage` hands out arbitrary inode -// numbers (no hard link tracking) +// TestSharedstorage checks that `-sharedstorage` shows stable inode numbers to +// userpsace despite having hard link tracking disabled func TestSharedstorage(t *testing.T) { dir := test_helpers.InitFS(t) mnt := dir + ".mnt" @@ -944,7 +944,7 @@ func TestSharedstorage(t *testing.T) { if err := os.Link(foo1, foo2); err != nil { t.Fatal(err) } - var st1, st2, st3 syscall.Stat_t + var st1, st2 syscall.Stat_t if err := syscall.Stat(foo1, &st1); err != nil { t.Fatal(err) } @@ -952,12 +952,8 @@ func TestSharedstorage(t *testing.T) { if err := syscall.Stat(foo2, &st2); err != nil { t.Fatal(err) } - // Stat()'ing again should give us again a new inode number - if err := syscall.Stat(foo2, &st3); err != nil { - t.Fatal(err) - } - if st1.Ino == st2.Ino || st2.Ino == st3.Ino || st1.Ino == st3.Ino { - t.Error(st1.Ino, st2.Ino, st3.Ino) + if st1.Ino != st2.Ino { + t.Errorf("unstable inode number: changed from %d to %d", st1.Ino, st2.Ino) } // Check that we we don't have stat caching. New length should show up // on the hard link immediately. |