casync icon indicating copy to clipboard operation
casync copied to clipboard

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

Open cyphar opened this issue 7 years ago • 5 comments

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: systemd/casync#167 vbatts/go-mtree#146 Signed-off-by: Aleksa Sarai [email protected]

cyphar avatar Sep 14 '18 14:09 cyphar

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

cyphar avatar Sep 15 '18 00:09 cyphar

/cc @vbatts

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

cyphar avatar Nov 05 '18 08:11 cyphar

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.

vbatts avatar Nov 15 '18 20:11 vbatts

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.

cyphar avatar Jan 21 '19 11:01 cyphar

@poettering PTAL

vbatts avatar Jan 22 '19 15:01 vbatts