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

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

wants to merge 1 commit into from

Conversation

cyphar
Copy link

@cyphar cyphar commented Sep 14, 2018

In the mtree(8) format, each directory entry is treated as a parent
entry for subsequent entries (which are then considered to be lexically
children of their parent when figuring out what paths to compare for
manifest verification).

'casync mtree' outputs a fairly unconventional "flat" version of the
mtree(8) format, and as a result didn't handle this correctly in the
past. The most trivial way of handling the type=dir problem is to negate
it after each entry with a ".." entry. Because this acts on the node
level, having nodes with names like "a/b/c" doesn't cause an issue.

This is necessary for compatibility with go-mtree. It should be noted
that this change is still not sufficient for compatibility with FreeBSD
mtree(8), which does not permit "/" characters in node names. Supporting
this would require us to make significant changes to how generation
works (because we'd need to output a hierarchy-friendly format which
would require some more housekeeping). This is a stop-gap solution to at
least end up with basic compatibility.

Fixes: #167 vbatts/go-mtree#146
Signed-off-by: Aleksa Sarai [email protected]

In the mtree(8) format, each directory entry is treated as a parent
entry for subsequent entries (which are then considered to be lexically
children of their parent when figuring out what paths to compare for
manifest verification).

'casync mtree' outputs a fairly unconventional "flat" version of the
mtree(8) format, and as a result didn't handle this correctly in the
past. The most trivial way of handling the type=dir problem is to negate
it after each entry with a ".." entry. Because this acts on the node
level, having nodes with names like "a/b/c" doesn't cause an issue.

This is necessary for compatibility with go-mtree. It should be noted
that this change is still not sufficient for compatibility with FreeBSD
mtree(8), which does not permit "/" characters in node names. Supporting
this would require us to make significant changes to how generation
works (because we'd need to output a hierarchy-friendly format which
would require some more housekeeping). This is a stop-gap solution to at
least end up with basic compatibility.

Fixes: #167 vbatts/go-mtree#146
Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar
Copy link
Author

cyphar commented Sep 15, 2018

I'm not sure what's with the build failure -- looks like it had trouble pulling a meson package.

@cyphar
Copy link
Author

cyphar commented Nov 5, 2018

/cc @vbatts

Would you prefer if we fixed this "fully" by making it so that nodes are actually constructed correctly?

@vbatts
Copy link
Contributor

vbatts commented Nov 15, 2018

I definitely thought it was funny that casync mtree choose the outdated BSD mtree flat style. Albeit it is an "easier" approach without requiring any amount of nesting. It ought to not be incompatible staying as the flat style though.

@cyphar
Copy link
Author

cyphar commented Jan 21, 2019

No mtree implementation I've tried supports the format that systemd spits out, so I'm firmly in the "it's not outputting valid mtrees" camp.

@vbatts
Copy link
Contributor

vbatts commented Jan 22, 2019

@poettering PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

mtree: not really format compliant
3 participants