mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
tarfs: Fix backtracking during node creation.
Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39082
This commit is contained in:
parent
e81d55b439
commit
ef184e989b
3 changed files with 14 additions and 13 deletions
|
|
@ -347,6 +347,11 @@ tarfs_lookup_path(struct tarfs_mount *tmp, char *name, size_t namelen,
|
|||
}
|
||||
tnp = parent;
|
||||
parent = tnp->parent;
|
||||
cn.cn_nameptr = tnp->name;
|
||||
cn.cn_namelen = tnp->namelen;
|
||||
do_lookup = true;
|
||||
TARFS_DPF(LOOKUP, "%s: back to %.*s/\n", __func__,
|
||||
(int)tnp->namelen, tnp->name);
|
||||
name += len;
|
||||
namelen -= len;
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#define PROGNAME "mktar"
|
||||
|
||||
#define SUBDIRNAME "directory"
|
||||
#define EMPTYDIRNAME "empty"
|
||||
#define NORMALFILENAME "file"
|
||||
#define SPARSEFILENAME "sparse_file"
|
||||
#define HARDLINKNAME "hard_link"
|
||||
|
|
@ -128,11 +127,6 @@ mktar(void)
|
|||
if (mkdir(SUBDIRNAME, 0755) != 0)
|
||||
err(1, "%s", SUBDIRNAME);
|
||||
|
||||
/* create a second subdirectory which will remain empty */
|
||||
verbose("mkdir %s", EMPTYDIRNAME);
|
||||
if (mkdir(EMPTYDIRNAME, 0755) != 0)
|
||||
err(1, "%s", EMPTYDIRNAME);
|
||||
|
||||
/* create a normal file */
|
||||
verbose("creating %s", NORMALFILENAME);
|
||||
mknormalfile(NORMALFILENAME, 0644);
|
||||
|
|
@ -233,7 +227,7 @@ main(int argc, char *argv[])
|
|||
#if 0
|
||||
"--options", "zstd:frame-per-file",
|
||||
#endif
|
||||
"./" EMPTYDIRNAME "/../" NORMALFILENAME,
|
||||
"./" SUBDIRNAME "/../" NORMALFILENAME,
|
||||
"./" SPARSEFILENAME,
|
||||
"./" HARDLINKNAME,
|
||||
"./" SHORTLINKNAME,
|
||||
|
|
@ -262,8 +256,6 @@ main(int argc, char *argv[])
|
|||
(void)unlink(HARDLINKNAME);
|
||||
verbose("rm %s", SPARSEFILENAME);
|
||||
(void)unlink(SPARSEFILENAME);
|
||||
verbose("rmdir %s", EMPTYDIRNAME);
|
||||
(void)rmdir(EMPTYDIRNAME);
|
||||
verbose("rmdir %s", SUBDIRNAME);
|
||||
(void)rmdir(SUBDIRNAME);
|
||||
verbose("cd -");
|
||||
|
|
|
|||
|
|
@ -58,10 +58,14 @@ tarfs_basic_body() {
|
|||
atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -f%d,%i "${mnt}"/hard_link)"
|
||||
atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -L -f%d,%i "${mnt}"/short_link)"
|
||||
atf_check_equal "$(stat -f%d,%i "${mnt}"/sparse_file)" "$(stat -L -f%d,%i "${mnt}"/long_link)"
|
||||
atf_check_equal "$(sha256 -q "${mnt}"/sparse_file)" ${sum}
|
||||
atf_check_equal "$(stat -f%p "${mnt}"/sparse_file)" 100644
|
||||
atf_check_equal "$(stat -f%l "${mnt}"/sparse_file)" 2
|
||||
atf_check_equal "$(stat -f%l "${mnt}"/hard_link)" 2
|
||||
atf_check -o inline:"${sum}\n" sha256 -q "${mnt}"/sparse_file
|
||||
atf_check -o inline:"2,40755\n" stat -f%l,%p "${mnt}"/directory
|
||||
atf_check -o inline:"1,100644\n" stat -f%l,%p "${mnt}"/file
|
||||
atf_check -o inline:"2,100644\n" stat -f%l,%p "${mnt}"/hard_link
|
||||
atf_check -o inline:"1,120755\n" stat -f%l,%p "${mnt}"/long_link
|
||||
atf_check -o inline:"1,120755\n" stat -f%l,%p "${mnt}"/short_link
|
||||
atf_check -o inline:"2,100644\n" stat -f%l,%p "${mnt}"/sparse_file
|
||||
atf_check -o inline:"3,40755\n" stat -f%l,%p "${mnt}"
|
||||
}
|
||||
tarfs_basic_cleanup() {
|
||||
umount "${mnt}" || true
|
||||
|
|
|
|||
Loading…
Reference in a new issue