From 8b443c8484f5fdcedbec2a689a7d66d2a277b26e Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 2 Apr 2018 20:25:59 +0200 Subject: fsck: add xattr support With testcases. --- tests/fsck/broken_fs_v1.4/6nGs4Ugr3EAHd0KzkyLZ-Q | 0 .../CMyUifVTjW5fsgXonWBT_RDkvLkdGrLttkZ45T3Oi3A | 0 .../b00sbnGXGToadr01GHZaYQn8tjyRhe1OXNBZoQtMlcQ | 0 tests/fsck/fsck_test.go | 16 ++++++++++++++++ 4 files changed, 16 insertions(+) create mode 100644 tests/fsck/broken_fs_v1.4/6nGs4Ugr3EAHd0KzkyLZ-Q create mode 100644 tests/fsck/broken_fs_v1.4/CMyUifVTjW5fsgXonWBT_RDkvLkdGrLttkZ45T3Oi3A create mode 100644 tests/fsck/broken_fs_v1.4/b00sbnGXGToadr01GHZaYQn8tjyRhe1OXNBZoQtMlcQ (limited to 'tests/fsck') diff --git a/tests/fsck/broken_fs_v1.4/6nGs4Ugr3EAHd0KzkyLZ-Q b/tests/fsck/broken_fs_v1.4/6nGs4Ugr3EAHd0KzkyLZ-Q new file mode 100644 index 0000000..e69de29 diff --git a/tests/fsck/broken_fs_v1.4/CMyUifVTjW5fsgXonWBT_RDkvLkdGrLttkZ45T3Oi3A b/tests/fsck/broken_fs_v1.4/CMyUifVTjW5fsgXonWBT_RDkvLkdGrLttkZ45T3Oi3A new file mode 100644 index 0000000..e69de29 diff --git a/tests/fsck/broken_fs_v1.4/b00sbnGXGToadr01GHZaYQn8tjyRhe1OXNBZoQtMlcQ b/tests/fsck/broken_fs_v1.4/b00sbnGXGToadr01GHZaYQn8tjyRhe1OXNBZoQtMlcQ new file mode 100644 index 0000000..e69de29 diff --git a/tests/fsck/fsck_test.go b/tests/fsck/fsck_test.go index 77f94c3..657ce89 100644 --- a/tests/fsck/fsck_test.go +++ b/tests/fsck/fsck_test.go @@ -6,11 +6,27 @@ import ( "strings" "testing" + "github.com/pkg/xattr" + "github.com/rfjakob/gocryptfs/internal/exitcodes" "github.com/rfjakob/gocryptfs/tests/test_helpers" ) func TestBrokenFsV14(t *testing.T) { + // git does not save extended attributes, so we apply them here. + // xattr_good + xattr.Set("broken_fs_v1.4/6nGs4Ugr3EAHd0KzkyLZ-Q", + "user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2Kg", + []byte("hxnZvXSkDicfwVS9w4r1yYkFF61Qou6NaL-VhObYEdu6kuM")) + // xattr_corrupt_name + xattr.Set("broken_fs_v1.4/CMyUifVTjW5fsgXonWBT_RDkvLkdGrLttkZ45T3Oi3A", + "user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2K0", + []byte("QHUMDTgbnl8Sv_A2dFQic_G2vN4_gmDna3651JAhF7OZ-YI")) + // xattr_corrupt_value + xattr.Set("broken_fs_v1.4/b00sbnGXGToadr01GHZaYQn8tjyRhe1OXNBZoQtMlcQ", + "user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2Kg", + []byte("A0hvCePeKpL8bCpijhDKtf7cIijXYQsPnEbNJ84M2ONW0dd")) + cmd := exec.Command(test_helpers.GocryptfsBinary, "-fsck", "-extpass", "echo test", "broken_fs_v1.4") outBin, err := cmd.CombinedOutput() out := string(outBin) -- cgit v1.2.3