summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-checkout.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-07-06 21:33:59 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-07-07 15:01:51 +0000
commit9d941dcebbbbe0cab1f40adf3269a1562760f9ac (patch)
treedde860f478040ce0136e079beb9f57e316fec01e /src/libostree/ostree-repo-checkout.c
parentd2a05e5a090f446e0738dafd93299177d6d02f79 (diff)
downloadostree-9d941dcebbbbe0cab1f40adf3269a1562760f9ac.tar.gz
checkout: Don't set dir mtime to 0 when doing a force copy checkout
When we [switched to using checkout + force_copy](https://github.com/ostreedev/ostree/commit/e8efd1c8dcaad8fbd3b05c400972d237406263e7), a side effect that went unnoticed at the time is that we started setting directory mtimes to zero. See the below bug where we long ago set the file times to zero, which got fixed, so let's not regress things by setting the directory times to zero either. (Even though AFAICS GNU tar doesn't complain about those) This semantic is somewhat "overloaded" onto `force_copy`, but it avoids adding yet another boolean; we don't have that many reserved boolean slots left. I can't really think of many good use cases for `force_copy` *other* than the `/etc` merge anyways. https://bugzilla.redhat.com/show_bug.cgi?id=1229160 Closes: https://github.com/ostreedev/ostree/issues/995 Closes: #997 Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-repo-checkout.c')
-rw-r--r--src/libostree/ostree-repo-checkout.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c
index 9ab9a623..7942d607 100644
--- a/src/libostree/ostree-repo-checkout.c
+++ b/src/libostree/ostree-repo-checkout.c
@@ -770,9 +770,11 @@ checkout_tree_at_recurse (OstreeRepo *self,
}
/* Set directory mtime to OSTREE_TIMESTAMP, so that it is constant for all checkouts.
- * Must be done after setting permissions and creating all children.
+ * Must be done after setting permissions and creating all children. Note we skip doing
+ * this for directories that already exist (under the theory we possibly don't own them),
+ * and we also skip it if doing copying checkouts, which is mostly for /etc.
*/
- if (!did_exist)
+ if (!did_exist && !options->force_copy)
{
const struct timespec times[2] = { { OSTREE_TIMESTAMP, UTIME_OMIT }, { OSTREE_TIMESTAMP, 0} };
if (TEMP_FAILURE_RETRY (futimens (destination_dfd, times)) < 0)