GNOME Bugzilla – Bug 734293
automatically pick up parent directories for modified config files when new tree drops them
Last modified: 2014-09-16 16:08:43 UTC
The current /etc merge logic carries modified files, but we error out if the new tree drops a directory that was there. For example, dropping firewalld out of the Fedora Atomic, it creates a file /etc/firewalld/public.xml automatically, and we refuse to upgrade. I can't think of a harm from just picking up the parent directories automatically. The only downside is this will carry cruft forwards, but at least with ostree you can always "config-diff" and discover what's cruft.
Created attachment 286293 [details] [review] deploy: Copy parent directories for modified config files Previously, in the case where a parent directory of a modified config file was removed, we would throw an exception. While it's nice to have this notice that your config file probably no longer applies, there's no need to make it so...fatal. We can just take ownership of the parent directories too. Admins can clean up these files afterwards at any time.
Has test cases, so I assume it fixes the problem. ACK :) Personally I would have tried to do the xopendirat()/etc changes as a separate simple cleanup patch, as it's really confusing what code is moving here, is being deleted and what is new. From what I can tell the main part is that ensure_directory_from_template does a g_mkdir_with_parents type operation for the directory that is being removed? And then the file with all the attributes is copied in?
Split up a helper for the first. For the second question - it's like g_mkdir_with_parents(), except we want to copy over the attributes of the source. We have two directory chains: /etc/foo/bar/baz/blah /etc/foo And we're walking up from baz to bar to foo, finding it exists, and the copying the directory hierarchy. (e.g. if bar is mode 0755 and baz is 0700, or owned by non-root uids, we reproduce that)
Attachment 286293 [details] pushed as 8f4ffa6 - deploy: Copy parent directories for modified config files