summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gio-tool: Respect --attributesgio-tool-attributesBenjamin Otte2019-09-301-10/+12
| | | | | Do not add custom attributes when the command-line explicitly specifies some.
* Merge branch '1897-cmpmem-null-handling' into 'master'Sebastian Dröge2019-09-303-3/+26
|\ | | | | | | | | | | | | gtestutils: Allow cmpmem() arguments to be NULL iff lengths are zero Closes #1897 See merge request GNOME/glib!1133
| * gtestutils: Allow cmpmem() arguments to be NULL iff lengths are zeroPhilip Withnall2019-09-303-3/+26
| | | | | | | | | | | | | | | | Document this and add a test. Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1897
* | Merge branch 'python-version' into 'master'Sebastian Dröge2019-09-301-1/+1
|\ \ | |/ |/| | | | | build: Bump Python requirement to ≥ 3.5 See merge request GNOME/glib!1132
| * build: Bump Python requirement to ≥ 3.5Philip Withnall2019-09-301-1/+1
| | | | | | | | | | | | | | | | We already depend on Meson 0.49.2, which depends on Python 3.5, so we’ve actually implicitly had this requirement for a while. Might as well make it explicit. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | Merge branch 'patch-1' into 'master'Sebastian Dröge2019-09-301-1/+1
|\ \ | |/ |/| | | | | gio/gfileinfo: fix param reference in doc comment See merge request GNOME/glib!1131
| * gio/gfileinfo: fix param reference in doc commentDavid Lechner2019-09-291-1/+1
|/ | | | | The actual parameter name in g_file_attribute_matcher_new() attributes, so change the param reference to match. This way, doc tools can create a proper link.
* Merge branch 'gspawn' into 'master'Philip Withnall2019-09-261-27/+100
|\ | | | | | | | | | | | | gspawn: Optimize fd closing on AIX and BSDs Closes #1638 See merge request GNOME/glib!574
| * gspawn: Retry on EBUSY errors from dup2()Philip Withnall2019-09-261-1/+1
| | | | | | | | | | | | | | | | `man dup2` says that on Linux, dup2() can return `EBUSY` if the operation needs to be retried (in addition to returning `EINTR` in other cases where it needs to be retried). Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * gspawn: Rewrite some retry loops to use `while` rather than `goto`Philip Withnall2019-09-261-12/+9
| | | | | | | | | | | | | | This introduces no functional changes, but does make the code easier to understand. Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * gspawn: Use fdwalk provided by system only when it is known to be safeTing-Wei Lan2019-09-261-5/+17
| | | | | | | | | | | | | | | | | | | | All uses of fdwalk in gspawn are between fork and exec, which means only async-signal safe functions can be called if the parent process has multiple threads. Since fdwalk is not a standard API, we should not assume it is safe to use unless the manual of the system explicitly says it is async-signal safe. Fixes: #1638
| * gspawn: Optimize fd closing on AIX and BSDsSebastian Schwarz2019-09-201-17/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of calling close or fcntl on all possible file descriptors, which is slow on systems with very high limit or even no limit on open file descriptors, we can use closefrom or fcntl with F_CLOSEM to close all unwanted file descriptors with a single system call. This change only improves the performance when GSpawnChildSetupFunc is NULL because there are applications known to abuse GSpawnChildSetupFunc to unset FD_CLOEXEC on file descriptors. Since the change mentioned above requires closing file descriptors directly, it cannot be used when the caller may want to keep some of them open. This patch was written by Sebastian Schwarz <seschwar@gmail.com> and uploaded to https://gitlab.gnome.org/GNOME/glib/merge_requests/574. It was later modified by Ting-Wei Lan <lantw@src.gnome.org> to address code review issues. Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1638
* | Merge branch 'diagnosticfix' into 'master'Sebastian Dröge2019-09-261-1/+1
|\ \ | | | | | | | | | | | | Improve GLIB_DEPRECATED_MACRO_FOR output See merge request GNOME/glib!1130
| * | Improve GLIB_DEPRECATED_MACRO_FOR outputStephan Bergmann2019-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See the mailing list thread <https://lists.fedoraproject.org/archives/list/ devel@lists.fedoraproject.org/thread/SZ676IHHSLOQD6UN2I5J5VKXJ5P5SOVO/> "glib-2.0 G_CONST_RETURN causing GCC 'warning: const' on F31", where the GCC diagnostic > test.c:2:13: warning: const > 2 | G_CONST_RETURN char * f(); > | ^~~~~~~ had confused me, and "Deprecated pre-processor symbol, repace with const" is probably a better warning message than just "const". (That recent GCC only prints "Deprecated pre-processor symbol, repace with " appears to be a bug in GCC that GLIB_UNAVAILABLE_MACRO already suffers from, too. Recent Clang correctly prints "Deprecated pre-processor symbol, repace with const".)
* | | Merge branch 'android-warning-fix' into 'master'Sebastian Dröge2019-09-261-2/+2
|\ \ \ | |/ / |/| | | | | | | | gdate: Fix tautological comparison warnings on Android See merge request GNOME/glib!1129
| * | gdate: Fix tautological comparison warnings on AndroidPhilip Withnall2019-09-251-2/+2
|/ / | | | | | | | | | | | | | | Android is emitting `-Wtautological-constant-out-of-range-compare` warnings when compiling the validation functions for the enum types for `GDate`. Fix that by comparing as integers. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | Merge branch 'fileinfo-mention-attr-usecs' into 'master'Philip Withnall2019-09-251-4/+6
|\ \ | | | | | | | | | | | | fileinfo: Mention that usec mtimes are set See merge request GNOME/glib!1126
| * | fileinfo: Mention that usec mtimes are setMatthew Leeds2019-09-251-4/+6
|/ / | | | | | | | | | | | | | | g_file_info_set_modification_time() and g_file_info_set_modification_date_time() set the G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attribute in addition to G_FILE_ATTRIBUTE_TIME_MODIFIED, so microsecond precision is available when provided by the caller, so mention both attributes in the docs.
* | Merge branch 'ossfuzz-17648-date-uninit-variable' into 'master'Sebastian Dröge2019-09-242-0/+3
|\ \ | | | | | | | | | | | | gdatetime: Fix error handling in g_date_time_new_week() See merge request GNOME/glib!1125
| * | gdatetime: Fix error handling in g_date_time_new_week()Philip Withnall2019-09-242-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was possible to pass in (for example) an invalid year to g_date_time_new_week(), which would be passed on to g_date_time_new(), which would (correctly) return `NULL` — but then g_date_time_get_week_number() would try to dereference that. Includes a test case. oss-fuzz#17648 Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | Merge branch '1865-variant-get-child-serialisation' into 'master'Sebastian Dröge2019-09-242-0/+48
|\ \ \ | |/ / |/| | | | | | | | | | | | | | gvariant: Handle empty serialisations in get_child_value() Closes #1865 See merge request GNOME/glib!1043
| * | gvariant: Handle empty serialisations in get_child_value()Philip Withnall2019-08-242-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When g_variant_get_child_value() is called for a child whose serialisation is an empty byte string (which is possible), `bytes_data` will be non-`NULL`, but `data` may be `NULL`. This results in a negative offset being passed to `g_bytes_new_from_bytes()`, and a critical warning. So if `data` is `NULL`, set it to point to `bytes_data` so the offset is calculated as zero. The actual value of the offset doesn’t matter, since in this situation the size is always zero. An offset of zero is never going to cause problems. Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1865
* | | Merge branch 'ossfuzz-12960-markup-attribute-limit' into 'master'Philip Withnall2019-09-243-2/+18
|\ \ \ | | | | | | | | | | | | | | | | gmarkup: Add a limit on the number of attributes in an element See merge request GNOME/glib!1116
| * | | gmarkup: Add a limit on the number of attributes in an elementPhilip Withnall2019-09-183-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the XML specification doesn’t prescribe a limit, no reasonable bit of XML is going to have more than 1000 attributes in a single XML element. Adding a limit reduces the changes of a runaway allocation loop caused by dodgy input. oss-fuzz#12960 Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | | Merge branch '1449-atomic-fallback-safety' into 'master'Sebastian Dröge2019-09-241-4/+40
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gatomic: Reorder memory barriers in fallback atomic operations Closes #1449 See merge request GNOME/glib!1122
| * | | | gatomic: Reorder memory barriers in fallback atomic operationsPhilip Withnall2019-09-211-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the compiler doesn’t provide modern (C++11) atomic builtins (which is now quite unlikely), we implement our own using the `__sync_synchronize()` memory barrier. As Behdad and others have pointed out, though, the implementation didn’t follow the same semantics as we use with the C++11 builtins — `__ATOMIC_SEQ_CST`. Fix the use of memory barriers to provide `__ATOMIC_SEQ_CST` semantics. In particular, this fixes the following common pattern: ``` GObject *obj = my_object_new (); g_atomic_pointer_set (&shared_ptr, obj); ``` Previously this would have expanded to: ``` GObject *obj = my_object_new (); *shared_ptr = obj; __sync_synchronize (); ``` While the compiler would not have reordered the stores to `obj` and `shared_ptr` within the code on one thread (due to the dependency between them), the memory system might have made the write to `shared_ptr` visible to other threads before the write to `obj` — if they then dereferenced `shared_ptr` before seeing the write to `obj`, that would be a bug. Instead, the expansion is now: ``` GObject *obj = my_object_new (); __sync_synchronize (); *shared_ptr = obj; ``` This ensures that the write to `obj` is visible to all threads before any write to `shared_ptr` is visible to any threads. For completeness, `__sync_synchronize()` is augmented with a compiler barrier to ensure that no loads/stores can be reordered locally before or after it. Tested by disabling the C++11 atomic implementation and running: ``` meson test --repeat 1000 atomic atomic-test ``` Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1449
* | | | | Merge branch 'docs-heading-typo' into 'master'Sebastian Dröge2019-09-241-2/+2
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | docs: Fix typo in GConverter{Input,Output}Stream section titles See merge request GNOME/glib!1124
| * | | | | docs: Fix typo in GConverter{Input,Output}Stream section titlesPhilip Withnall2019-09-241-2/+2
|/ / / / / | | | | | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | | | Merge branch '1565-atomic-signs' into 'master'Nirbheek Chauhan2019-09-238-71/+71
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix sign conversion warnings with g_atomic_int_*() calls in GLib Closes #1565 See merge request GNOME/glib!1121
| * | | | | tests: Use g_assert_*() in atomic tests rather than g_assert()Philip Withnall2019-09-211-46/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `g_assert_*()` provide more useful failure messages, and aren’t compiled out when building with `G_DISABLE_ASSERT`, unlike `g_assert()`. Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * | | | | gatomic: Add various casts to use of g_atomic_*()s to fix warningsPhilip Withnall2019-09-218-25/+25
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling GLib with `-Wsign-conversion`, we get various warnings about the atomic calls. A lot of these were fixed by 3ad375a629c91a27d0165a31f0ed298fd553de0a, but some remain. Fix them by adding appropriate casts at the call sites. Note that `g_atomic_int_{and,or,xor}()` actually all operate on `guint`s rather than `gint`s (which is what the rest of the `g_atomic_int_*()` functions operate on). I can’t find any written reasoning for this, but assume that it’s because signedness is irrelevant when you’re using an integer as a bit field. It’s unfortunate that they’re named a `g_atomic_int_*()` rather than `g_atomic_uint_*()` functions. Tested by compiling GLib as: ``` CFLAGS=-Wsign-conversion jhbuild make -ac |& grep atomic ``` I’m not going to add `-Wsign-conversion` to the set of default warnings for building GLib, because it mostly produces false positives throughout the rest of GLib. Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1565
* | | | | Merge branch 'add_g_fsync_function' into 'master'Nirbheek Chauhan2019-09-234-0/+31
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | Add a wrapper for fsync() function Closes #35 See merge request GNOME/glib!1104
| * | | | Add a wrapper for fsync() functionTodd Goyen2019-09-184-0/+31
| |/ / / | | | | | | | | | | | | Closes issue #35
* | | | Merge branch '1843-tsan-atomic-clang-fix' into 'master'Philip Withnall2019-09-212-42/+11
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | gatomic: Fix false positive with Clang+TSAN Closes #1843 See merge request GNOME/glib!1006
| * | | gatomic: Fix false positive with Clang+TSANPeter Wu2019-07-262-42/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __atomic_load_8 and friends do not exist under clang. Use the generic __atomic_load variant instead that are documented here: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html These have the additional benefit that the exact size of gint (4 bytes) or gpointer (4 or 8 bytes) no longer have to be checked. I initially tried `__typeof__(*(atomic)) val;`, but that caused warnings in Clang (-Wincompatible-pointer-types-discards-qualifiers) when "atomic" points to a volatile variable. Aside from that, it is apparently not supported everywhere, see the g_has_typeof macro. Another reason not to use it are new warnings under Clang, including: glib/deprecated/gthread-deprecated.c:683:11: warning: incompatible pointer types initializing 'typeof (*(&mutex->mutex.mutex))' (aka 'union _GMutex *') with an expression of type 'GRecMutex *' (aka 'struct _GRecMutex *') [-Wincompatible-pointer-types] g_atomic_pointer_set (&mutex->mutex.mutex, result); Hence, cast the atomic variable to gint/gpointer pointers, the size was already statically asserted so the cast should be safe. The macros use a (hopefully) rare "gaps_temp" name instead of something like "val" to avoid an issue with GCC builds: glib/tests/once.c:123:test_once4: assertion failed (val == "foo"): (NULL == "foo") Closes #1843
* | | | Merge branch 'utils-doc-annotations' into 'master'Philip Withnall2019-09-201-23/+25
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Annotate the return value of various utility functions See merge request GNOME/glib!1119
| * | | | Annotate the return value of various utility functionsEmmanuele Bassi2019-09-201-23/+25
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the introspection scanner can glean the transfer rule for the return values by looking at their constness, adding an explicit annotation has the advantage of gtk-doc writing out the transfer rule as an additional bit of documentation, making the life of the documentation reader easier.
* | | | Merge branch '767-signal-class-refs' into 'master'Sebastian Dröge2019-09-201-0/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gsignal: Document class init before signals can be looked up Closes #767 See merge request GNOME/glib!1118
| * | | | gsignal: Document class init before signals can be looked upPhilip Withnall2019-09-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #767 Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | | | Merge branch 'gobject-tutorial-no-priv' into 'master'Philip Withnall2019-09-201-7/+7
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | docs: Remove priv pointers from the tutorial example See merge request GNOME/glib!1020
| * | | | docs: Remove priv pointers from the tutorial exampleEmmanuele Bassi2019-09-201-7/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | We define `ViewerFile` as a final type with fields directly in the instance structure. This means we don't have a `priv` pointer to dereference.
* | | | Merge branch 'ossfuzz-16103-ordinal-dates' into 'master'Philip Withnall2019-09-192-0/+4
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | gdatetime: Fix error handling in g_date_time_new_ordinal() See merge request GNOME/glib!1115
| * | | gdatetime: Fix error handling in g_date_time_new_ordinal()Philip Withnall2019-09-182-0/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was possible to pass in (for example) an invalid hour to g_date_time_new_ordinal(), which would be passed on to g_date_time_new(), which would (correctly) return `NULL` — but then g_date_time_new_ordinal() would try to dereference that. Includes some test cases. oss-fuzz#16103 oss-fuzz#17183 Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | Merge branch 'since-2-64' into 'master'Emmanuele Bassi2019-09-175-2/+61
|\ \ \ | | | | | | | | | | | | | | | | Add version macros for GLib 2.64 See merge request GNOME/glib!1112
| * | | gversionmacros: Add version macros for GLib 2.64Philip Withnall2019-09-174-1/+60
| | | | | | | | | | | | | | | | Signed-off-by: Philip Withnall <withnall@endlessm.com>
| * | | build: Post-release version bump to 2.63.0Philip Withnall2019-09-171-1/+1
|/ / / | | | | | | | | | | | | | | | Ready for the new unstable release series. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* | | Merge branch 'wip/oholy/gio-remove-completion' into 'master'Sebastian Dröge2019-09-171-1/+1
|\ \ \ | | | | | | | | | | | | | | | | gio: Add missing "gio remove" option to bash completion script See merge request GNOME/glib!1110
| * | | gio: Add missing "gio remove" option to bash completion scriptOndrej Holy2019-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | Bash completion script allows to complete various options, but "gio remove" is missing. Let's add this missing option.
* | | | Merge branch 'g_utf8_get_char_validated_wrong_return_on_null_byte' into 'master'Sebastian Dröge2019-09-172-0/+11
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a missing check to g_utf8_get_char_validated() Closes #1052 See merge request GNOME/glib!967
| * | | | Add a missing check to g_utf8_get_char_validated()Emmanuel Fleury2019-09-142-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | g_utf8_get_char_validated() was not exactly matching its documentation. The function was not checking if the sequence of unicode characters was free of null bytes before performing a more in-depth validation. Fix issue #1052