Commit Graph

19148 Commits

Author SHA1 Message Date
Simon McVittie
214c991d5b Spelling: fix "every time"
Detected by Debian's Lintian tool.

Also fix the spelling of "linking" in one error message.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:34:48 +01:00
Xavier Claessens
7c8e1f15cc Meson: Do not run tests/refcount with --tap
This is a partial revert of a change introduced in cbc7fbbf7.
2018-09-25 09:33:15 -04:00
Xavier Claessens
b6171b97bf Merge branch '1528-build-time-tap' into 'master'
meson: Run build-time tests with --tap where supported

Closes #1528

See merge request GNOME/glib!351
2018-09-25 11:25:53 +00:00
Simon McVittie
cbc7fbbf7d meson: Run build-time tests with --tap where supported
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>
2018-09-24 23:37:12 +01:00
Xavier Claessens
b803d94366 Merge branch '1541-timeloop-closure' into 'master'
Meson: Install timeloop-closure test

Closes #1541

See merge request GNOME/glib!349
2018-09-24 19:27:38 +00:00
Xavier Claessens
178b943be7 Meson: Install timeloop-closure test 2018-09-24 11:21:27 -04:00
Xavier Claessens
b512135fc6 Merge branch '1535-tap' into 'master'
Meson: Run in TAP mode installed tests that support it

Closes #1535

See merge request GNOME/glib!343
2018-09-24 14:49:40 +00:00
Xavier Claessens
8bfb1d0ea3 Merge branch '1537-fixxref' into 'master'
Meson: doc: fix cross references

Closes #1537

See merge request GNOME/glib!344
2018-09-24 14:49:02 +00:00
Debarshi Ray
0a8f3698a0 docs: Simplify the text for g_array_free
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
2018-09-24 16:34:53 +02:00
Debarshi Ray
30ccd6f01b docs: Use the correct terminology for g_array_free
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
2018-09-24 16:34:49 +02:00
Xavier Claessens
c1999271b5 Merge branch '1538-growing-stack' into 'master'
Meson: define G_HAVE_GROWING_STACK to 0 or 1

Closes #1538

See merge request GNOME/glib!342
2018-09-24 14:28:24 +00:00
Xavier Claessens
bec7e2fa78 Merge branch 'issue1539' into 'master'
Remove unnecessary +x permissions

Closes #1539

See merge request GNOME/glib!341
2018-09-23 20:19:05 +00:00
Xavier Claessens
780f7c64f9 Meson: doc: fix cross references 2018-09-23 16:09:34 -04:00
Xavier Claessens
8391219e4c Meson: Run in TAP mode installed tests that support it 2018-09-23 13:44:15 -04:00
Xavier Claessens
3896bc3659 Meson: define G_HAVE_GROWING_STACK to 0 or 1 2018-09-23 12:59:40 -04:00
Simon McVittie
fa32ee6481 Remove unnecessary +x permissions
None of these files starts with a #! line, and they are not native
binary executables, so if a user attempts to execute them as a program,
Unix shells will run them as /bin/sh scripts. This is not going to end
well, since none of them are shell scripts (the gio bash completion
is for bash, which is not a lowest-common-denominator POSIX shell, and
in any case is designed to be sourced rather than executed).

Fixes: #1539
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-23 17:01:04 +01:00
Emmanuele Bassi
032f1a9782 Merge branch 'gio-fix-build' into 'master'
gio: automake: Add libgmodule dependency

See merge request GNOME/glib!334
2018-09-22 15:49:07 +00:00
Xavier Claessens
66bf585776 Merge branch 'install-tests' into 'master'
Meson: Fix missing files when installing tests

Closes #1527

See merge request GNOME/glib!336
2018-09-21 13:18:32 +00:00
Xavier Claessens
abac67c050 Tests: Fix -Wformat-nonliteral causing build failure with clang 2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
3ae1244ba1 tests W32: ifdef a variable not used on Windows 2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
665677ce5e tests W32: Move timeloop test to the non-Windows section
It just doesn't work on Windows, and that can't be fixed with a quick patch.
2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
4c91334412 tests W32: ugly fix for sscanf() format
As we recently established, G_G*_FORMAT macros are for glib
functions *only*. It's not guaranteed that they will work for
C runtime printf() or scanf() variants, and indeed - in this case
they do not (GCC thinks that MSVCRT sscanf() requires %I64 prefix
for 64-bit values; whether that is true or not is irrelevant at this
point - we need to make the werror go away).
2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
d2c9543f2e tests W32: include process.h for getpid()
At least, MinGW has POSIX names. No idea if this works in MSVC.
2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
190ea6ed10 tests W32: Fix Windows values casting
LPARAM is LONG_PTR which is the same as INT_PTR on Windows.
WPARAM is UINT_PTR.
HWND is a pointer.
(%p prints pointers without 0x prefix, hence the extra 0x).
2018-09-21 08:45:54 -04:00
Руслан Ижбулатов
3cdce16668 tests W32: Cast the MSG struct as (gchar *) for g_io_channel_read 2018-09-21 08:45:54 -04:00
Xavier Claessens
ef1bcc5a04 Rename cxx-test.C to cxx-test.cpp
Meson checks file extension case-insentively, and compiles ".C" as C
source instead of C++.
2018-09-21 08:45:54 -04:00
Xavier Claessens
4b5bc3f459 Meson: build and install remaining tests 2018-09-21 08:45:54 -04:00
Xavier Claessens
96fafcfe92 Meson: Fix missing files when installing tests
Closes #1527
2018-09-21 08:45:02 -04:00
Simon McVittie
f50309a80e Merge branch 'slow-tests' into 'master'
tests: Mark two more tests as slow

See merge request GNOME/glib!340
2018-09-21 12:13:53 +00:00
Philip Withnall
18456b74a6 tests: Mark two more tests as slow
These keep on taking just longer than 30s on my local machine when run
in parallel with the rest of the tests (i.e. with `ninja test`). Testing
them individually, they do terminate correctly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-09-20 17:51:18 +01:00
Will Thompson
63f8294c45
gkeyfile: remain usable after g_key_file_free()
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.
2018-09-20 17:04:00 +01:00
Mikhail Fludkov
1f6db2a5c5 glib/gcharset: fix leaking g_get_language_names_with_category 2018-09-20 16:08:19 +02:00
Руслан Ижбулатов
b9f91437bb Fudge glib fileutils test to pass on Windows
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.
2018-09-18 12:45:06 +00:00
Руслан Ижбулатов
d3d6ef60c6 W32: drop _wstat64(), get stat data manually
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.
2018-09-18 12:45:05 +00:00
Bernhard Walle
0d97c4d20c gio: automake: Add libgmodule dependency
Otherwise I get following compile error:

 libtool: link: /home/builduser/toolchains/linux/tc/2017-12/x86-ncp-linux-gnu/bin/i686-ncp-linux-gnu-gcc -Wall -Wstrict-prototypes -Wmisleading-indentation -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -O2 -Wall -pipe -Wformat -g -fstack-protector-strong -fPIC -fno-strict-aliasing -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-rpath-link=/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/zlib/lib -Wl,-rpath-link=/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/libffi/lib -o .libs/gio gio-tool.o gio-tool-cat.o gio-tool-copy.o gio-tool-info.o gio-tool-list.o gio-tool-mime.o gio-tool-mkdir.o gio-tool-monitor.o gio-tool-mount.o gio-tool-move.o gio-tool-open.o gio-tool-rename.o gio-tool-remove.o gio-tool-save.o gio-tool-set.o gio-tool-trash.o gio-tool-tree.o  -L/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/zlib/lib -L/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/libffi/lib ./.libs/libgio-2.0.so ../gobject/.libs/libgobject-2.0.so ../glib/.libs/libglib-2.0.so -Wl,-rpath -Wl,/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/glib/lib
 /home/builduser/toolchains/linux/tc/2017-12/x86-ncp-linux-gnu/bin/../lib/gcc/i686-ncp-linux-gnu/6.3.0/../../../../i686-ncp-linux-gnu/bin/ld: warning: libgmodule-2.0.so.0, needed by ./.libs/libgio-2.0.so, not found (try using -rpath or -rpath-link)
 ./.libs/libgio-2.0.so: undefined reference to `g_module_error'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_close'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_open'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_supported'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_symbol'
 collect2: error: ld returned 1 exit status
 Makefile:2300: recipe for target 'gio' failed

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
2018-09-18 10:27:19 +02:00
Hans Petter Jansson
171f698ead ghash: Simplify g_hash_table_set_shift()
Even if we're using a prime modulo for the initial probe, our table is
power-of-two-sized, meaning we can set the mask simply by subtracting one
from the size.
2018-09-17 16:17:10 +02:00
Hans Petter Jansson
0dee62973c ghash: Fix poor performance with densely populated keyspaces
Sequential integers would be densely packed in the table, leaving the
high-index buckets unused and causing abnormally long probes for many
operations. This was especially noticeable with failed lookups and
when "aging" the table by repeatedly inserting and removing integers
from a narrow range using g_direct_hash() as the hashing function.

The solution is to multiply the hash by a small prime before applying
the modulo. The compiler optimizes this to a few left shifts and adds, so
the constant overhead is small, and the entries will be spread out,
yielding a lower average probe count.
2018-09-17 15:28:11 +02:00
Philip Withnall
f928dfdf57 Merge branch 'master' into 'master'
Issue #1513: fix g_icon_to_string() regression (doc inconsistency).

Closes #1513

See merge request GNOME/glib!305
2018-09-17 10:32:32 +00:00
Philip Withnall
cf7193ee34 Merge branch 'fix-pkg-config-autotools' into 'master'
Use absolute paths in pkg-config files

Closes #1521

See merge request GNOME/glib!315
2018-09-17 09:54:04 +00:00
Iain Lane
d2a1a4bf55 Merge branch '1523-network-monitor-init-failure' into 'master'
gnetworkmonitornm: Set a GError properly on an error handling path

See merge request GNOME/glib!322
2018-09-13 14:27:56 +00:00
Philip Withnall
5ad226cc78 Merge branch 'wip/netlink-monitor-cleanups' into 'master'
Some cleanups for the netlink GNetworkMonitor

Closes #1518

See merge request GNOME/glib!313
2018-09-13 13:08:33 +00:00
Marek Cernocky
3d3ea42418 Updated Czech translation 2018-09-13 14:01:22 +02:00
Jehan
8519368c0e Fix g_icon_to_string() regression (doc inconsistency).
g_icon_new_for_string() docs states that it should return a single name
when created with a single name. I add a second condition to this case:
the themed icon must not include default fallbacks (i.e. it must not
have been created with `g_themed_icon_new_with_default_fallbacks()`).
Otherwise the return value of `g_icon_new_for_string()` would not
recreate the same icon list when passed to `g_icon_new_for_string()`
(which would be another documentation inconsistency).

g_icon_new_for_string() is now back to old behavior for this specific
case.

I also revert the unit test for this case, and add a new unit test when
using g_themed_icon_new_with_default_fallbacks() with a single name as
well.

Closes #1513.
2018-09-13 13:16:40 +02:00
Iain Lane
6eb5bd8192
network-monitor-race test: Have the subprocess inherit stdout and stderr
If initialising the monitors produces any debug output, it is good to be
able to see it when running this test.
2018-09-13 11:44:16 +01:00
Iain Lane
36c79adb2f
gnetworkmonitornetlink: Pass a GError into read_netlink_messages()
Currently this function calls `g_warning()` explicitly. It would be
nicer to properly propagate these failure up to the caller that tried to
initialise us.
2018-09-13 11:44:16 +01:00
Iain Lane
6629423e7a
gnetworkmonitornetlink: Close the socket after disconnecting its GSources
`read_netlink_messages()` is the callback attached to the netlink socket
(G_IO_IN). It calls `g_socket_receive_message()`. There is a race
condition that if the socket is closed while there is a pending call, we
will try to receive on a closed socket, which fails.

To avoid this, we switch the order of the operations around: first
destroy the source and then close the socket.
2018-09-13 11:14:34 +01:00
Iain Lane
7fe8aa68a2
gnetworkmonitornetlink: Don't check if a passed-in GError ** is NULL
This is not a correct way to check if `g_socket_new_from_fd()` failed.
Instead just see if it returned `NULL` itself.

This was preventing the netlink monitor from being initialised.

Closes #1518
2018-09-13 11:14:34 +01:00
Philip Withnall
c5761146bc gnetworkmonitornm: Set a GError properly on an error handling path
All the other initialisation failure paths set a GError, but this one
didn’t. Set a GError to avoid breaking the invariant that returning
FALSE should always have a GError set.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1523
2018-09-13 10:25:05 +01:00
Michael Catanzaro
5bc35a7245 Merge branch 'mcatanzaro/auto-start-portals' into 'master'
Autostart xdg-desktop-portal if needed

See merge request GNOME/glib!317
2018-09-13 04:43:59 +00:00
Philip Withnall
dbe0572d57 Merge branch 'w32-gio-tests-enable' into 'master'
Enable GIO tests on Windows

See merge request GNOME/glib!312
2018-09-12 22:42:16 +00:00