Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mtree: follow-up all type=dir entries with ".." #168

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/casync-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,19 @@ static int list_one_file(const char *arg0, CaSync *s, bool *toplevel_shown) {
/* End this in a newline — unless this is a regular file,
* in which case we'll print the payload checksum shortly */
putchar('\n');

/*
* After each directory entry, we "go back" to the top-level.
* This is necessary because the mtree(8) format assumes that
* directories are listed hierarchically and that entries
* succeeding a directory are lexically its children. In casync
* we generate full pathnames and don't use this structure, so
* we need to avoid other tools from misunderstanding the paths
* we generate.
*/
if (S_ISDIR(mode))
puts("..");

} else {
const char *target = NULL, *user = NULL, *group = NULL;
uint64_t mtime = UINT64_MAX, size = UINT64_MAX, offset = UINT64_MAX;
Expand Down