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 743836 - test mappedfile.c fails when $HOME/.cache does not exist
test mappedfile.c fails when $HOME/.cache does not exist
Status: RESOLVED DUPLICATE of bug 763344
Product: glib
Classification: Platform
Component: gio
2.43.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-02-02 08:35 UTC by Michael Felt
Modified: 2017-10-24 09:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glib make check log (4.25 KB, text/plain)
2015-12-30 18:58 UTC, David W Holmgren
Details

Description Michael Felt 2015-02-02 08:35:40 UTC
While running make check I had an error for mappedfile that I could 'correct' by creating the directory $HOME/.cache just before running the test.

Note: OS is labeled as AIX - because that is what I have tested. I suspect it is "All"

michael@x065:[/data/prj/gnome/glib/glib-2.43.3]cd glib
michael@x065:[/data/prj/gnome/glib/glib-2.43.3/glib]tests/.libs/mappedfile
/mappedfile/basic: OK
/mappedfile/empty: OK
/mappedfile/device: OK
/mappedfile/nonexisting: OK
/mappedfile/writable: **
GLib:ERROR:mappedfile.c:93:test_writable: assertion failed (error == NULL): Failed to create file '/home/michael/.cache/glib-test-4096-random-bytes.PIH6SX': No such file or directory (g-file-error-quark, 4)
IOT/Abort trap(coredump)

# Assumption is that $HOME/.cache already exists
michael@x065:[/data/prj/gnome/glib/glib-2.43.3/glib]mkdir $HOME/.cache
michael@x065:[/data/prj/gnome/glib/glib-2.43.3/glib]tests/.libs/mappedfile
/mappedfile/basic: OK
/mappedfile/empty: OK
/mappedfile/device: OK
/mappedfile/nonexisting: OK
/mappedfile/writable: OK
/mappedfile/writable_fd: OK
/mappedfile/gbytes: OK

I cannot determine if the test is to blame (e.g., two different filenames) or if the behavior g_set_file_contents() (actually it dependencies - if it creates the file by default, why not the complete path?)

Correcting the test by checking for the existence of $HOME/.cache and creating it would help the test, but not applications dependent on g_set_file_contents() when $HOME/.cache does not exist.

As such, I cannot propose a patch - but leave this to people who know what behavior should be occurring. And, considering the two filenames - not really sure what is being tested here.

Snippet from mappedfiles

   +77  static void
   +78  test_writable (void)
   +79  {
   +80    GMappedFile *file;
   +81    GError *error = NULL;
   +82    gchar *contents;
   +83    gsize len;
   +84    const gchar *old = "MMMMMMMMMMMMMMMMMMMMMMMMM";
   +85    const gchar *new = "abcdefghijklmnopqrstuvxyz";
   +86    gchar *tmp_copy_path;
   +87
   +88    tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
   +89
   +90    g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
   +91    g_assert_no_error (error);
   +92    g_file_set_contents (tmp_copy_path, contents, len, &error);
   +93    g_assert_no_error (error);
   +94
Comment 1 Michael Felt 2015-02-02 08:46:23 UTC
Reporting this separately in the hope it is not seen as a duplicate of https://bugzilla.gnome.org/show_bug.cgi?id=743606

IMHO https://bugzilla.gnome.org/show_bug.cgi?id=743606 has described multiple issues and ideally and bug-report should focus on one point. Feedback from 'moderator' on your preferred approach is appreciated.
Comment 2 Allison Karlitskaya (desrt) 2015-02-02 10:15:03 UTC
Definitely one patch per issue is appreciated, but don't feel too bad about using a single bug for multiple patches that are closely related (ie: "fix the test suite on AIX").  This issue, though, is generic in nature, so a separate bug is totally fine.
Comment 3 Michael Felt 2015-02-02 10:22:39 UTC
Also tested on ubuntu - and same result.

michael@x050:~/gnome/glib-2.43.3$ glib/tests/mappedfile
/mappedfile/basic: OK
/mappedfile/empty: OK
/mappedfile/device: OK
/mappedfile/nonexisting: OK
/mappedfile/writable: **
GLib:ERROR:mappedfile.c:93:test_writable: assertion failed (error == NULL): Failed to create file '/home/michael/.cache/glib-test-4096-random-bytes.NB2VSX': No such file or directory (g-file-error-quark, 4)
Aborted (core dumped)

michael@x050:~/gnome/glib-2.43.3$ mkdir $HOME/.cache
michael@x050:~/gnome/glib-2.43.3$ glib/tests/mappedfile
/mappedfile/basic: OK
/mappedfile/empty: OK
/mappedfile/device: OK
/mappedfile/nonexisting: OK
/mappedfile/writable: OK
/mappedfile/writable_fd: OK
/mappedfile/gbytes: OK


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
Comment 4 David W Holmgren 2015-12-30 18:58:32 UTC
Created attachment 318051 [details]
glib make check log
Comment 5 Philip Withnall 2017-10-24 09:58:27 UTC
Looks like this was fixed by commit 7c6141a546 (bug #763344).

I’ve verified the test now works with:

unset XDG_RUNTIME_DIR
XDG_CACHE_HOME=/tmp/does-not-exist make -C $builddir/glib/glib/tests check TESTS=mappedfile

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