diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-04-03 09:55:06 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-04-03 09:55:06 +0000 |
commit | 584e1c355ae3c994331005b7196cc87a714e5317 (patch) | |
tree | 58733fd528f62e55e8a342dbc8c2b54396e81601 /tests | |
parent | b1fd95c9e24791d44593e611406b41e57826a5b8 (diff) | |
download | src-584e1c355ae3c994331005b7196cc87a714e5317.tar.gz src-584e1c355ae3c994331005b7196cc87a714e5317.zip |
tarfs: Ignore global extended headers.
Previously, we would error out if we encountered a global extended
header, because we don't know what it means. This doesn't really
matter though, and traditionally, tar implementations have either
ignored them or treated them as plain files, so just ignore them.
This allows tarfs to mount tar files created by `git archive`.
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44600
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sys/fs/tarfs/tarfs_test.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/sys/fs/tarfs/tarfs_test.sh b/tests/sys/fs/tarfs/tarfs_test.sh index 5d3fbca2f4ee..f1322033fbad 100644 --- a/tests/sys/fs/tarfs/tarfs_test.sh +++ b/tests/sys/fs/tarfs/tarfs_test.sh @@ -357,6 +357,29 @@ tarfs_long_paths_cleanup() { tarfs_cleanup } +atf_test_case tarfs_git_archive cleanup +tarfs_git_archive_head() { + atf_set "descr" "Verify that tarfs supports archives created by git" + atf_set "require.user" "root" + atf_set "require.progs" "git" +} +tarfs_git_archive_body() { + tarfs_setup + mkdir foo + echo "Hello, world!" >foo/bar + git -C foo init --initial-branch=tarfs + git -C foo config user.name "File System" + git -C foo config user.email fs@freebsd.org + git -C foo add bar + git -C foo commit -m bar + git -C foo archive --output=../tarfs_git_archive.tar HEAD + atf_check mount -rt tarfs tarfs_git_archive.tar "${mnt}" + atf_check -o file:foo/bar cat "${mnt}"/bar +} +tarfs_git_archive_cleanup() { + tarfs_cleanup +} + atf_init_test_cases() { atf_add_test_case tarfs_basic atf_add_test_case tarfs_basic_gnu @@ -374,4 +397,5 @@ atf_init_test_cases() { atf_add_test_case tarfs_checksum atf_add_test_case tarfs_long_names atf_add_test_case tarfs_long_paths + atf_add_test_case tarfs_git_archive } |