Skip to content

checkout: Merge union/add logic for copies during checkout#801

Closed
cgwalters wants to merge 5 commits intoostreedev:masterfrom
cgwalters:checkout-dedup
Closed

checkout: Merge union/add logic for copies during checkout#801
cgwalters wants to merge 5 commits intoostreedev:masterfrom
cgwalters:checkout-dedup

Conversation

@cgwalters
Copy link
Copy Markdown
Member

We really have an astonishing variety of similar functions which write files and
symlinks. I was working on a different PR and the duplication between the
union-mode and add-mode/none-mode checkout functions bothered me.

I realized that the "handle EEXIST" tri-state maps directly to the
GLnxLinkTmpfileReplaceMode, so deduping things makes even more sense.

@rh-atomic-bot
Copy link
Copy Markdown

☔ The latest upstream changes (presumably 50ca653) made this pull request unmergeable. Please resolve the merge conflicts.

We really have an astonishing variety of similar functions which write files and
symlinks. I was working on a different PR and the duplication between the
union-mode and add-mode/none-mode checkout functions bothered me.

I realized that the "handle EEXIST" tri-state maps directly to the
`GLnxLinkTmpfileReplaceMode`, so deduping things makes even more sense.
@cgwalters
Copy link
Copy Markdown
Member Author

🛫 Rebased 🛬

return FALSE;

/* Process any xattrs now that we made the link */
if (xattrs)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the same behaviour though, right? I.e. if we're in ADD_FILES mode, then we should only apply xattrs if it didn't already exist, right? Also, it seems like the chmod bits conditional on user mode got snipped (not that it matters much for symlinks, though I suppose ostree diff would notice). Actually, even applying xattrs should be conditional on user mode.

But now, I'm surprised the testsuite didn't catch this. So either I'm missing something, or we should add a few more tests for these :)

Copy link
Copy Markdown
Member Author

@cgwalters cgwalters Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Yes. In general though, I'm not sure anyone uses xattrs on symlinks aside from SELinux (and possibly SMACK).

Yeah, no test coverage for this bit right now. Hmm. Filed #806

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need the chown bit too, right? Otherwise, I see ostree diff immediately reporting something after a fresh checkout:

# ostree ls symlink-chown-test
d00755 0 0      0 /
l00777 1000 1000      0 /mylink -> mytarget
# mkdir tmp/copy-checkout && mount --bind tmp/copy-checkout tmp/copy-checkout
# ostree checkout symlink-chown-test tmp/copy-checkout/checkout
# ostree diff symlink-chown-test ./tmp/copy-checkout/checkout
M    /mylink

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed. I spent a little bit trying to add a test but it needs 3a794ea

We can add it after this all comes together.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. fixup ⬇️

@jlebon
Copy link
Copy Markdown
Member

jlebon commented Apr 25, 2017

@rh-atomic-bot r+ 8afc474

@rh-atomic-bot
Copy link
Copy Markdown

⌛ Testing commit 8afc474 with merge 511b31c...

@rh-atomic-bot
Copy link
Copy Markdown

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing 511b31c to master...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants