GNOME Bugzilla – Bug 689744
main: Ensure NMSTATEDIR exists
Last modified: 2012-12-06 15:53:05 UTC
For OSTree/gnome-ostree, the model chosen for /var is that services are responsible for creating any data they need in /var at runtime. There are a few ways to accomplish this - systemd-tmpfiles is one, but it's also really easy to just invoke e.g. mkdir() inside the daemon code. This patch just does that for the NetworkManager state. This is a harmless no-op on Fedora/RHEL, where the RPM contains data for /var.
Created attachment 230854 [details] [review] main: Ensure NMSTATEDIR exists
Created attachment 230897 [details] [review] [PATCH] main:ensure NMSTATEDIR exists Actually, we need something like this. First, g_mkdir_with_parents() would create possible intermediate parent directories. And second, the directory should exist before parse_state_file() that accesses a file in the directory.
Review of attachment 230897 [details] [review]: Well, at least in gnome-ostree, /var/lib is guaranteed to exist - it's just component-specific bits like /var/lib/NetworkManager that need creation. But using g_mkdir_with_parents() doesn't hurt either, and it avoids us having to check EEXIST manually. So, patch looks good to me.
Good. Pushed to master as e7add58aad1bb5eca28360c9c7a1a3956261c7df