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 743840 - GLib:ERROR:fileutils.c:864:test_stdio_wrappers: assertion failed: (errno == EACCES) when run as root
GLib:ERROR:fileutils.c:864:test_stdio_wrappers: assertion failed: (errno == E...
Status: RESOLVED DUPLICATE of bug 766390
Product: glib
Classification: Platform
Component: gio
2.43.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-02-02 10:35 UTC by Michael Felt
Modified: 2018-04-12 11:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Felt 2015-02-02 10:35:45 UTC
While examining AIX test-suite errors determined that this is not unique to AIX.

michael@x050:~/gnome/glib-2.43.3$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:        12.04
Codename:       precise

root@x050:/home/michael/gnome/glib-2.43.3# glib/tests/fileutils                                                                                                 
/fileutils/build-path: OK
/fileutils/build-pathv: OK
/fileutils/build-filename: OK
/fileutils/build-filenamev: OK
/fileutils/mkdir-with-parents: OK
/fileutils/format-size-for-display: OK
/fileutils/errors: OK
/fileutils/basename: OK
/fileutils/dir-make-tmp: OK
/fileutils/file-open-tmp: OK
/fileutils/mkstemp: OK
/fileutils/mkdtemp: OK
/fileutils/set-contents: OK
/fileutils/read-link: OK
/fileutils/stdio-wrappers: **
GLib:ERROR:fileutils.c:864:test_stdio_wrappers: assertion failed: (errno == EACCES)
Aborted (core dumped)
root@x050:/home/michael/gnome/glib-2.43.3# find . -name mkdir-test -ls                                                                                              
684103    4 drw-r--r--   2 root     root         4096 Feb  2 10:26 ./mkdir-test
root@x050:/home/michael/gnome/glib-2.43.3# ls -l mkdir-test
total 0
root@x050:/home/michael/gnome/glib-2.43.3# rmdir mkdir-test
root@x050:/home/michael/gnome/glib-2.43.3# 

root@x050:/home/michael/gnome/glib-2.43.3# logout
michael@x050:~/gnome/glib-2.43.3$ find . -name mkdir-test
michael@x050:~/gnome/glib-2.43.3$ glib/tests/fileutils
/fileutils/build-path: OK
/fileutils/build-pathv: OK
/fileutils/build-filename: OK
/fileutils/build-filenamev: OK
/fileutils/mkdir-with-parents: OK
/fileutils/format-size-for-display: OK
/fileutils/errors: OK
/fileutils/basename: OK
/fileutils/dir-make-tmp: OK
/fileutils/file-open-tmp: OK
/fileutils/mkstemp: OK
/fileutils/mkdtemp: OK
/fileutils/set-contents: OK
/fileutils/read-link: OK
/fileutils/stdio-wrappers: OK
michael@x050:~/gnome/glib-2.43.3$ find . -name mkdir-test
michael@x050:~/gnome/glib-2.43.3$ 

Snippet from glib/tests/fileutils.c

  +840  static void
  +841  test_stdio_wrappers (void)
  +842  {
  +843    GStatBuf buf;
  +844    gchar *cwd, *path;
  +845    gint ret;
  +846    struct utimbuf ut;
  +847    GError *error = NULL;
  +848
  +849    g_remove ("mkdir-test/test-create");
  +850    g_rmdir ("mkdir-test");
  +851
  +852    ret = g_stat ("mkdir-test", &buf);
  +853    g_assert (ret == -1);
  +854    ret = g_mkdir ("mkdir-test", 0666);
  +855    g_assert (ret == 0);
  +856    ret = g_stat ("mkdir-test", &buf);
  +857    g_assert (ret == 0);
  +858    g_assert (S_ISDIR (buf.st_mode));
  +859
  +860    cwd = g_get_current_dir ();
  +861    path = g_build_filename (cwd, "mkdir-test", NULL);
  +862    g_free (cwd);
  +863    ret = g_chdir (path);
  +864    g_assert (errno == EACCES);
  +865    g_assert (ret == -1);
  +866    ret = g_chmod (path, 0777);

NOTE: on failure the directory mkdir-test may be remaining (on AIX including the core file, which causes a false error - according to test-logic - because rmdir fails when a directory is not empty). IMHO, either at beginning of test, or at end, should verify that mkdir-test is removed (probably at beginning).
Comment 1 Michael Felt 2015-02-02 10:42:44 UTC
Paying better attention to above:

perhaps adding
        g_remove("mkdir-test/core");

between
  +849    g_remove ("mkdir-test/test-create");
  +850    g_rmdir ("mkdir-test");

will resolve the problem with a core dump in a previous run.
Comment 2 Philip Withnall 2018-04-12 11:45:31 UTC
Thanks for taking the time to report this.
This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 766390 ***