-
Notifications
You must be signed in to change notification settings - Fork 403
Various small fixes #4119
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
base: main
Are you sure you want to change the base?
Various small fixes #4119
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -98,6 +98,12 @@ def tree_has_selinux_xattr(path: Path) -> bool: | |||||||||
| ) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def tree_has_ima_xattr(path: Path) -> bool: | ||||||||||
| return any( | ||||||||||
| "security.ima" in os.listxattr(p, follow_symlinks=False) for p in (path, *path.rglob("*")) | ||||||||||
| ) | ||||||||||
|
Comment on lines
+102
to
+104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ruff complains
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c&p from tree_has_selinux_xattr. We may want to generalize the function instead.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ruff complains here because |
||||||||||
|
|
||||||||||
|
|
||||||||||
| def copy_tree( | ||||||||||
| src: Path, | ||||||||||
| dst: Path, | ||||||||||
|
|
@@ -118,9 +124,16 @@ def copy_tree( | |||||||||
| attrs = "mode,links" | ||||||||||
| if preserve: | ||||||||||
| attrs += ",timestamps,ownership" | ||||||||||
| with_xattrs = True | ||||||||||
|
|
||||||||||
| # Trying to copy selinux xattrs to overlayfs fails with "Operation not supported" in containers. | ||||||||||
| if statfs(os.fspath(dst.parent)) != OVERLAYFS_SUPER_MAGIC or not tree_has_selinux_xattr(src): | ||||||||||
| with_xattrs = False | ||||||||||
|
|
||||||||||
| if tree_has_ima_xattr(src): | ||||||||||
| with_xattrs = False | ||||||||||
|
Comment on lines
+133
to
+134
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems problematic, since even if we decided to e.g. copy xattr to keep selinux attributes around, we'd drop them if a file also has these xattrs. Despite being a bit annoying is there any issue with the warning from cp?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cp fails with exit 1
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, but since this is the same as statfs(os.fspath(dst.parent)) != OVERLAYFS_SUPER_MAGIC
or (not tree_has_selinux_xattr(src) and not tree_has_ima_xattr(src))then? |
||||||||||
|
|
||||||||||
| if with_xattrs: | ||||||||||
| attrs += ",xattr" | ||||||||||
|
|
||||||||||
| def copy() -> None: | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.