After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 689744 - main: Ensure NMSTATEDIR exists
main: Ensure NMSTATEDIR exists
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-12-05 22:52 UTC by Colin Walters
Modified: 2012-12-06 15:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
main: Ensure NMSTATEDIR exists (1.21 KB, patch)
2012-12-05 22:52 UTC, Colin Walters
none Details | Review
[PATCH] main:ensure NMSTATEDIR exists (1.19 KB, patch)
2012-12-06 15:45 UTC, Jiri Klimes
accepted-commit_now Details | Review

Description Colin Walters 2012-12-05 22:52:01 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.
Comment 1 Colin Walters 2012-12-05 22:52:03 UTC
Created attachment 230854 [details] [review]
main: Ensure NMSTATEDIR exists
Comment 2 Jiri Klimes 2012-12-06 15:45:08 UTC
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.
Comment 3 Colin Walters 2012-12-06 15:47:49 UTC
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.
Comment 4 Jiri Klimes 2012-12-06 15:53:05 UTC
Good.
Pushed to master as e7add58aad1bb5eca28360c9c7a1a3956261c7df