-
Notifications
You must be signed in to change notification settings - Fork 198
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
tempfiles.rs: remove duplicate tmpfiles entries #4697
tempfiles.rs: remove duplicate tmpfiles entries #4697
Conversation
Skipping CI for Draft Pull Request. |
7116fa6
to
7ce3728
Compare
7ce3728
to
12b1ecb
Compare
rpmostreecxx::deduplicate_tmpfiles_entries(tmprootfs_dfd)
to remove duplicate tmpfiles entriesdaf0520
to
4bea24b
Compare
14b460c
to
f51e436
Compare
/holdon |
8c90c75
to
e60d576
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
b6ca110
to
026da33
Compare
The build always get error, but none error on local container, need more investigation.
|
36e450c
to
bb2d372
Compare
rpm-ostree should scan the tmpfiles.d snippets at install time and skip synthesizing entries if they are already specified. As we may have confilicted tmpfile entries, like it will prevent to cleanup of `/var/tmp` by `systemd-tmpfiles-clean.service`: `pkg-filesystem.conf` has `d /var/tmp 1777 root root - -` `systemd's tmp.conf` has `q /var/tmp 1777 root root 30d` It is not as simple because the auto-conversion we do at package import time may be duplicating a tmpfiles.d dropin that lives in a separate package. With Jonathan's suggestion: - the importer code puts the generated tmpfiles.d dropins in e.g. `/usr/lib/rpm-ostree/tmpfiles.d` instead of the canonical place - `deduplicate_tmpfiles_entries()` builds one hashmap from `/usr/lib/rpm-ostree/tmpfiles.d` and another from `/usr/lib/tmpfiles.d` and generates `rpm-ostree-autovar.conf` from the difference - delete_package_from_root() is updated to remove from `/usr/lib/rpm-ostree/tmpfiles.d` See coreos#26 (comment) Fixes coreos#26
bb2d372
to
c5f3e46
Compare
Thanks a lot for @jlebon 's pointer: Create issue rust-lang/impl-trait-initiative#18 to track and remove the |
This is way faster to test than a full compose build.
return FALSE; | ||
if (!glnx_file_replace_contents_at ( | ||
tmpdir.fd, glnx_strjoina ("usr/lib/tmpfiles.d/", "pkg-", pkg_name.c_str (), ".conf"), | ||
tmpdir.fd, | ||
glnx_strjoina ("usr/lib/rpm-ostree/tmpfiles.d/", pkg_name.c_str (), ".conf"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that will be confusing (and slightly problematic) is that today we don't invalidate the cache when the importer logic changes. And so previously imported packages will still have the old path until they stop being cached.
I've been bitten by this in coreos-assembler builds.
Maybe in this case it's OK because we still handle the old semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is a problem, how about checking if there is old path like usr/lib/tmpfiles.d/pkg-{pkg_name}.conf
, then move it to usr/lib/rpm-ostree/tmpfiles.d/{pkg_name}.conf
in earlier of deduplicate_tmpfiles_entries()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good! I had one thing I'd like to fix but it can come later.
While looking at this I ended up writing a unit test because it's way faster to test out changes that way.
Nice work @HuijingHei! |
Thanks @cgwalters @jlebon a lot for the pointer and guidance, also learn a lot about rust closure. |
This is potentially breaking updates on Silverblue: |
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since coreos#4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but also need to handle old `usr/lib/tmpfiles.d`. Fixes: fedora-silverblue/issue-tracker#523
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since coreos#4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but for old `usr/lib/tmpfiles.d`, failed with `error: opendir(usr/lib/ rpm-ostree/tmpfiles.d): No such file or directory`. Also needs coreos#4727. Fixes: fedora-silverblue/issue-tracker#523
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since coreos#4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but for old `usr/lib/tmpfiles.d`, failed with `error: opendir(usr/lib/ rpm-ostree/tmpfiles.d): No such file or directory`. Also needs coreos#4727. Fixes: fedora-silverblue/issue-tracker#523
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since coreos#4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but for old `usr/lib/tmpfiles.d`, failed with `error: opendir(usr/lib/ rpm-ostree/tmpfiles.d): No such file or directory`. With this patch, check if `usr/lib/rpm-ostree/tmpfiles.d` does not exist, will use old `usr/lib/tmpfiles.d` instead. Also needs coreos#4727. Fixes: fedora-silverblue/issue-tracker#523
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since coreos#4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but for old `usr/lib/tmpfiles.d`, failed with `error: opendir(usr/lib/ rpm-ostree/tmpfiles.d): No such file or directory`. With this patch, check if `usr/lib/rpm-ostree/tmpfiles.d` does not exist, will use old `usr/lib/tmpfiles.d` instead. Also needs coreos#4727. Fixes: fedora-silverblue/issue-tracker#523
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since coreos#4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but for old `usr/lib/tmpfiles.d`, failed with `error: opendir(usr/lib/ rpm-ostree/tmpfiles.d): No such file or directory`. With this patch, check if `usr/lib/rpm-ostree/tmpfiles.d` does not exist, will use old `usr/lib/tmpfiles.d` instead. Also needs coreos#4727. Fixes: fedora-silverblue/issue-tracker#523
When removing package, will also remove the generated tmpfile config under the rpm-ostree tmpfiles.d directory. Since #4697, we use the new directory like `usr/lib/rpm-ostree/tmpfiles.d`, but for old `usr/lib/tmpfiles.d`, failed with `error: opendir(usr/lib/ rpm-ostree/tmpfiles.d): No such file or directory`. With this patch, check if `usr/lib/rpm-ostree/tmpfiles.d` does not exist, will use old `usr/lib/tmpfiles.d` instead. Also needs #4727. Fixes: fedora-silverblue/issue-tracker#523
rpm-ostree should scan the tmpfiles.d snippets at install time
and skip synthesizing entries if they are already specified.
As we may have confilicted tmpfile entries, like it will prevent
to cleanup of
/var/tmp
bysystemd-tmpfiles-clean.service
:pkg-filesystem.conf
hasd /var/tmp 1777 root root - -
systemd's tmp.conf
hasq /var/tmp 1777 root root 30d
It is not as simple because the auto-conversion we do at package
import time may be duplicating a tmpfiles.d dropin that lives
in a separate package.
With Jonathan's suggestion:
/usr/lib/rpm-ostree/tmpfiles.d
instead of the canonical placededuplicate_tmpfiles_entries()
builds one hashmap from/usr/lib/rpm-ostree/tmpfiles.d
and another from/usr/lib/tmpfiles.d
and generates
rpm-ostree-autovar.conf
from the difference/usr/lib/rpm-ostree/tmpfiles.d
See #26 (comment)
Fixes #26