Public bug reported: Seen on several versions of glib2 and Ubuntu: 12.10 - amd64 libglib2.0-0:amd64 2.34.1-1ubuntu1
12.04 armhf libglib2.0-0 2.32.3-0ubuntu1 g_unix_mount_points_get() returns an empty list when run inside an LXC container. I think this is because it reads /etc/fstab to gather mount info instead of reading /proc/mounts. This means that for LXC containers, it will fail using a default container, returning no mount points. There are other cases where fstab is neither complete up to date or accurate and I think that reading mounts would make more sense. Below is a repro case. /* gcc -g -ggdb -o dt dt.c `pkg-config --cflags --libs glib-2.0 libgtop-2.0 gio-2.0 gio-unix-2.0` */ /* g_unix_mount_points_get() - returns empty set inside a container */ #include <glib.h> #include <gio/gio.h> #include <gio/gunixmounts.h> #include <stdio.h> #include <stdlib.h> int main(void) { GList *points; GList *p; points = g_unix_mount_points_get (NULL); if (points == NULL) { printf("no mounts found!"); } for (p = points; p != NULL; p = p->next) { GUnixMountEntry *mount = p->data; const char *mount_path; mount_path = g_unix_mount_get_mount_path (mount); printf("Found a mount: %s\n", mount_path); } g_list_free (points); } ** Affects: glib2.0 (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to glib2.0 in Ubuntu. https://bugs.launchpad.net/bugs/1136542 Title: g_unix_mount_points_get() won't work in a LXC container unless /etc/fstab is set To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glib2.0/+bug/1136542/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs