forked from opnsense/src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tarfs: Support paths that spill into exthdrs.
MFC after: 3 days Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44599 (cherry picked from commit b1fd95c) 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 (cherry picked from commit 584e1c3) tarfs: Fix 32-bit build. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D44613 (cherry picked from commit 0238d37)
- Loading branch information
1 parent
2ad8333
commit 59c3e7a
Showing
2 changed files
with
91 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,6 +309,77 @@ tarfs_checksum_cleanup() { | |
tarfs_cleanup | ||
} | ||
|
||
atf_test_case tarfs_long_names cleanup | ||
tarfs_long_names_head() { | ||
atf_set "descr" "Verify that tarfs supports long file names" | ||
atf_set "require.user" "root" | ||
} | ||
tarfs_long_names_body() { | ||
tarfs_setup | ||
local a b c d e | ||
a="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
b="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" | ||
c="cccccccccccccccccccccccccccccccccccccccc" | ||
d="dddddddddddddddddddddddddddddddddddddddd" | ||
e="eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" | ||
mkdir -p "${a}" | ||
touch "${a}/${b}_${c}_${d}_${e}_foo" | ||
ln "${a}/${b}_${c}_${d}_${e}_foo" "${a}/${b}_${c}_${d}_${e}_bar" | ||
ln -s "${b}_${c}_${d}_${e}_bar" "${a}/${b}_${c}_${d}_${e}_baz" | ||
tar -cf tarfs_long_names.tar "${a}" | ||
atf_check mount -rt tarfs tarfs_long_names.tar "${mnt}" | ||
} | ||
tarfs_long_names_cleanup() { | ||
tarfs_cleanup | ||
} | ||
|
||
atf_test_case tarfs_long_paths cleanup | ||
tarfs_long_paths_head() { | ||
atf_set "descr" "Verify that tarfs supports long paths" | ||
atf_set "require.user" "root" | ||
} | ||
tarfs_long_paths_body() { | ||
tarfs_setup | ||
local a b c d e | ||
a="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
b="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" | ||
c="cccccccccccccccccccccccccccccccccccccccc" | ||
d="dddddddddddddddddddddddddddddddddddddddd" | ||
e="eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" | ||
mkdir -p "${a}/${b}/${c}/${d}/${e}" | ||
touch "${a}/${b}/${c}/${d}/${e}/foo" | ||
ln "${a}/${b}/${c}/${d}/${e}/foo" "${a}/${b}/${c}/${d}/${e}/bar" | ||
ln -s "${b}/${c}/${d}/${e}/bar" "${a}/baz" | ||
tar -cf tarfs_long_paths.tar "${a}" | ||
atf_check mount -rt tarfs tarfs_long_paths.tar "${mnt}" | ||
} | ||
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 [email protected] | ||
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 | ||
|
@@ -324,4 +395,7 @@ atf_init_test_cases() { | |
atf_add_test_case tarfs_linktodir | ||
atf_add_test_case tarfs_linktononexistent | ||
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 | ||
} |