summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gfileutils: make g_file_set_contents() always fsync()1302-file-set-contents-fsyncWill Thompson2018-10-031-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | Previously, this function only called fsync() if @filename exists and is non-empty. This behaviour was introduced when the function was first written (6cff88ba18b3bc0d118308f109840cb163dcea03) and shortly afterwards (d20a188b1250ab3cf211d684429127d99378e886) respectively, with the latter justified as a performance optimisation. This meant that g_file_set_contents() does not provide the guarantee that developers assume it has, namely that after a call and a crash, @filename will either contain its previous contents or its new @contents. In practice, when it was previously non-existent or empty on a bog-standard ext4 filesystem, it would often contain NUL bytes matching the @length of @contents, requiring application developers to explicitly handle this third case. Given the documentation includes the word "atomic", we make this function provide the guarantee that was previously implied but untrue, and document it. If applications require higher performance at the cost of correctness, they can open-code the old behaviour, or we can add a new function to glib providing weaker guarantees. https://gitlab.gnome.org/GNOME/glib/issues/1302
* Merge branch 'fix-leaking-g_get_language_names_with_category' into 'master'Philip Withnall2018-10-022-3/+17
|\ | | | | | | | | gcharset: fix leaking g_get_language_names_with_category See merge request GNOME/glib!338
| * glib/gcharset: fix leaking g_get_language_names_with_categoryMikhail Fludkov2018-09-202-3/+17
| |
* | Merge branch '1525-task-result' into 'master'Philip Withnall2018-10-022-17/+159
|\ \ | | | | | | | | | | | | | | | | | | gtask: Check an error hasn’t been returned when calling g_task_return*() Closes #1525 See merge request GNOME/glib!368
| * | gtask: Compress GTask struct using a bitfieldPhilip Withnall2018-10-021-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a lot of gbooleans in the private GTask struct, which seems a bit wasteful. Use a bitfield to compress the struct a bit. This reduces the size of the struct from 216 bytes to 168 bytes on my 64-bit machine. One of the fields needs to remain separate, since it’s used from a TRACE() macro which calls typeof() on it. Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * | tests: Add return ordering tests for GTaskPhilip Withnall2018-10-021-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | These are based on an example test program provided by Will Thompson in issue #1525. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1525
| * | gtask: Check an error hasn’t been returned when calling g_task_return*()Philip Withnall2018-10-011-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions already check to see if a successful result has already been returned; expand them to also check to see if an error has been returned. We can’t just check GTask.result_set, as that’s actually an indicator for whether the GTask.result member is filled — when g_task_propagate_*() is called, it’s cleared again. We need a new state bit. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/1525
| * | tests: Fix location of an unref in the GTask testsPhilip Withnall2018-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This method drops the last reference *it* owns to the GTask, but then continues to call methods on the GTask. This wasn’t resulting in failures because a ref in another thread kept the GTask alive, but that’s quite dodgy. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | Merge branch 'win32-gstat-for-ucrt' into 'master'Philip Withnall2018-10-022-5/+160
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | W32: gstat fixes for ucrt Closes #1452 See merge request GNOME/glib!257
| * | | Fudge glib fileutils test to pass on WindowsРуслан Ижбулатов2018-09-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Creating a directory with 0666 does not prevent traversal on Windows (ACL determines the possibility of traversal, and Windows mkdir() does not translate permission bits into ACL). Don't do the traversal check on Windows. 2) Creating a file with 0555 also isn't translated into read-only ACL, Windows sets the read-only attribute instead, which blocks all changes, including changes to file times. Add the write permissions on Windows before changing file times.
| * | | W32: drop _wstat64(), get stat data manuallyРуслан Ижбулатов2018-09-181-5/+148
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that UCRT (which is the C runtime that Visual Studio uses by default these days) quietly changed the semantics for stat() functions and its variants. Previously they provided data for the symlink (if the file queried was a symlink), now they provide data for the target of the symlink. glib used to call _wstat64() to get certain stat-ish data about files, such as st_dev, since it was deemed that computing that data in glib using custom code would be pointless, as _wstat64() worked just fine. With UCRT this is no longer true. This commit drops _wstat64() in favour of a bunch of custom calls that populate the stat buffer manually. This way glib correctly gets information about a symlink, not its target. The _fstat64() call is still being used, as it does not suffer from this problem and thus remains untouched.
* | | Merge branch 'wjt/g_desktop_app_info_get_string_list' into 'master'Philip Withnall2018-10-016-2/+84
|\ \ \ | |_|/ |/| | | | | | | | Add g_desktop_app_info_get_string_list(); fix g_key_file_free() See merge request GNOME/glib!339
| * | gdesktopappinfo: add get_string_list() functionWill Thompson2018-10-014-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The X-Flatpak-RenamedFrom key is used in .desktop files to identify past names for the desktop file. It is defined to be a list of strings. However, there was previously no correct way to retrieve a list of strings from the GKeyFile wrapped by GDesktopAppInfo, short of re-parsing the file with GKeyFile. Note that doing something like: g_strsplit (g_desktop_app_info_get_string (...), ";", -1) is not correct: the raw value "a\;b;" represents the one-element list ["a;b"], but g_key_file_get_string() rejects the sequence "\;", and so g_desktop_app_info_get_string() returns NULL in this case. (Of course, a .desktop file with a semicolon in its name is a pathological case.) Add g_desktop_app_info_get_string_list(), a trivial wrapper around g_key_file_get_string_list(), similar to g_desktop_app_info_get_string() and co. The change from g_key_file_free() to g_key_file_unref() in the test is needed because g_key_file_free() clears the contents of the keyfile. This is fine for all the fields which are eagerly loaded and copied into GDesktopAppInfo, but not when we want to access arbitrary stuff from the keyfile.
| * | gkeyfile: remain usable after g_key_file_free()Will Thompson2018-09-202-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, in the case where 'kf' has more than one ref, calling g_key_file_free(kf) would break it. For example, calling g_key_file_has_key(kf, ...) would hit the following assertion: g_hash_table_lookup: assertion 'hash_table != NULL' failed This is because g_key_file_free() calls g_key_file_clear() which sets self->groups and other fields to NULL; most lookup functions assume these fields are non-NULL. One fix would be to call g_key_file_init() right after g_key_file_clear() in g_key_file_free(). However, in the case where there are no other refs to the keyfile, this would mean allocating many new hash tables which will be immediately destroyed when g_key_file_unref() removes the last ref. Instead, inline the unref, and re-initialize the internal state when the keyfile is still alive.
* | | Merge branch 'non-POSIX-spawn' into 'master'Philip Withnall2018-09-293-0/+5
|\ \ \ | | | | | | | | | | | | | | | | Fix build failure on systems without POSIX spawn See merge request GNOME/glib!345
| * | | Fix build failure on systems without spawn.hRyan Schmidt2018-09-283-0/+5
| | | |
* | | | Merge branch 'wip/lantw/enable-freebsd-ci' into 'master'Philip Withnall2018-09-291-4/+2
|\ \ \ \ | |/ / / |/| | | | | | | | | | | ci: Enable FreeBSD CI See merge request GNOME/glib!364
| * | | ci: Enable FreeBSD CITing-Wei Lan2018-09-291-4/+2
|/ / /
* | | Merge branch '1536-link-whole' into 'master'Xavier Claessens2018-09-282-3/+29
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Meson: Fix static linking of convenience libraries Closes #1536 See merge request GNOME/glib!357
| * | | Meson: Extract objects from convenience libraries to link themSimon McVittie2018-09-282-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids the convenience library being treated as though it was an installed static library (objects not included in the dependent static library, and convenience library being listed in the pkg-config metadata), both of which would make static linking impossible. This is a workaround for meson not having https://github.com/mesonbuild/meson/pull/3939 merged yet. Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1536 Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | Merge branch 'ci-meson-0-48' into 'master'Philip Withnall2018-09-289-172/+157
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Ci meson 0 48 See merge request GNOME/glib!347
| * | | | Meson: Bump dependency to 0.48.0Xavier Claessens2018-09-274-161/+145
| | | | |
| * | | | ci: Upgrade meson to 0.48.0 and use --fatal-meson-warningsXavier Claessens2018-09-275-11/+12
| | | | |
* | | | | Merge branch 'wip/rishi/docs-garray' into 'master'Philip Withnall2018-09-281-7/+7
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | Documentation tweaks for g_array_free See merge request GNOME/glib!348
| * | | | docs: Simplify the text for g_array_freeDebarshi Ray2018-09-241-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The text about deallocation of GArrays with elements containing dynamically-allocated memory was confusing. It initially mentioned clear_func, but later said elements with dynamically allocated memory "should be freed separately". Clarify this by using the same structure as g_ptr_array_free — highlight the need to set a clear_func by consolidating the text about it in a separate paragraph. https://gitlab.gnome.org/GNOME/glib/merge_requests/348
| * | | | docs: Use the correct terminology for g_array_freeDebarshi Ray2018-09-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GArray uses the term clear_func (eg., g_array_set_clear_func), while element_free_func comes from GPtrArray. https://gitlab.gnome.org/GNOME/glib/merge_requests/348
* | | | | Merge branch 'printf' into 'master'Xavier Claessens2018-09-271-3/+2
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | Tests: Mark printf wrappers with G_GNUC_PRINTF See merge request GNOME/glib!363
| * | | | Tests: Mark printf wrappers with G_GNUC_PRINTFSimon McVittie2018-09-271-3/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we tell clang that we're passing the arguments on to a compatible printf call, it can see that we're doing it right, and won't warn us about -Wformat-nonliteral. This follows up from commit abac67c0. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | Merge branch 'cross' into 'master'Emmanuele Bassi2018-09-261-6/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Autotools: Always run glib-genmarshal, even if cross-compiling Closes #1546 See merge request GNOME/glib!362
| * | | | Autotools: Always run glib-genmarshal, even if cross-compilingSimon McVittie2018-09-261-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glib-genmarshal is now written in Python rather than C, so we can always run it directly, even if we're cross-compiling for an architecture whose binaries we can't run. This matches the behaviour of the Meson build system. Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1546 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908334 Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | | Merge branch 'libmount' into 'master'Simon McVittie2018-09-262-2/+6
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Autotools: Move libmount from Libs.private to Requires.private See merge request GNOME/glib!358
| * | | | | Autotools: Move libmount from Libs.private to Requires.privateSimon McVittie2018-09-262-2/+6
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libmount depends on libblkid, so if we statically link a trivial executable to GIO, we need to pull in both libmount and libblkid. Linking with -lmount is not enough to achieve that, but recursing into mount.pc is. This makes the Autotools build a bit more like the Meson build, which already puts mount in Requires.private. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | | Merge branch '1514-appinfo-test' into 'master'Xavier Claessens2018-09-261-2/+9
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | Meson: appinfo tests are racy if run in parallel Closes #1514 See merge request GNOME/glib!356
| * | | | Meson: appinfo tests are racy if run in parallelXavier Claessens2018-09-251-2/+9
|/ / / /
* | | | Merge branch 'speling' into 'master'Xavier Claessens2018-09-2510-14/+14
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Fix spelling mistakes detected by Debian's Lintian tool See merge request GNOME/glib!354
| * | | | Spelling: Fix spelling of "interpreted"Simon McVittie2018-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detected by Debian's Lintian tool. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: avoid the "allows to" patternSimon McVittie2018-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is detected by Debian's Lintian tool, which suggests "allows one to" as a replacement. I've rephrased the documentation in question to avoid both of those. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: Fix spelling of "unknown"Simon McVittie2018-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: Fix spelling of "constructed"Simon McVittie2018-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: Fix spelling of "similarly"Simon McVittie2018-09-253-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detected by Debian's Lintian tool. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: Fix a common en_FR spelling of "information"Simon McVittie2018-09-252-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detected by Debian's Lintian tool. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: fix spelling of specifySimon McVittie2018-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detected by Debian's Lintian tool. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | | | Spelling: fix "every time"Simon McVittie2018-09-252-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detected by Debian's Lintian tool. Also fix the spelling of "linking" in one error message. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | | Merge branch '1544-gtester-report' into 'master'Xavier Claessens2018-09-254-25/+22
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate gtester-report from .in file Closes #1544 See merge request GNOME/glib!352
| * | | | | Generate gtester-report from .in fileSimon McVittie2018-09-254-25/+22
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, it was installed unmodified by the Meson build system. We don't need to define @bindir@, because gtester-report never actually referred to it. We also don't need a definition of GTESTER_REPORT for use by GLib itself, because its last use was removed in 2013 (https://bugzilla.gnome.org/show_bug.cgi?id=709995). Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1544 Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | | Merge branch 'tap-fix' into 'master'Simon McVittie2018-09-251-2/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Meson: Do not run tests/refcount with --tap See merge request GNOME/glib!353
| * | | | | Meson: Do not run tests/refcount with --tapXavier Claessens2018-09-251-2/+1
|/ / / / / | | | | | | | | | | | | | | | This is a partial revert of a change introduced in cbc7fbbf7.
* | | | | Merge branch '1528-build-time-tap' into 'master'Xavier Claessens2018-09-256-6/+14
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | meson: Run build-time tests with --tap where supported Closes #1528 See merge request GNOME/glib!351
| * | | | meson: Run build-time tests with --tap where supportedSimon McVittie2018-09-246-6/+14
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it easier to debug test failures, by ensuring that g_debug() and g_test_message() are printed as TAP diagnostics. Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1528 Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | Merge branch '1541-timeloop-closure' into 'master'Xavier Claessens2018-09-241-36/+39
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Meson: Install timeloop-closure test Closes #1541 See merge request GNOME/glib!349