Commit Graph

19179 Commits

Author SHA1 Message Date
Руслан Ижбулатов
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
Philip Withnall
3f10c8b059 Merge branch 'gdbus-codegen-type-punned-pointer-warnings' into 'master'
codegen: Change pointer casting to remove type-punning warnings

See merge request GNOME/glib!309
2018-09-12 22:31:54 +00:00
Michael Catanzaro
04989cfafb Autostart xdg-desktop-portal if needed
This is a speculative fix for epiphany#533, which we think might be
caused by xdg-desktop-portal not ever being started. This service is
started on-demand, not automatically.
2018-09-12 15:38:44 -05:00
Matthias Clasen
54074a3187 Merge branch 'mcatanzaro/gdbus-error' into 'master'
gdbus: Improve error when well-known name is unowned

See merge request GNOME/glib!316
2018-09-12 19:40:01 +00:00
Michael Catanzaro
0e0b94d635 gdbus: Improve error when well-known name is unowned
We should indicate the name, so that we have some chance of debugging
this problem.
2018-09-12 11:32:55 -05:00
Руслан Ижбулатов
ad3694b82a Enable GIO tests on Windows
1) Remove the non-Windows-only condition for subdir('tests').
2) Add libiphlpapi, libws2_32 and libsecur32 deps, needed for W32 tests.
3) Remove the -no-undefined argument (gcc doesn't understand it,
   it *does* understand -Wl,-no-undefined; either way, the test
   compiles without this argument just fine; maybe meson adds it
   by itself - you can hardly build shared modules without it).
4) Add or fix a number of includes
5) Disable gdbus-objectmanager tests when building with MSVC
   (right now these tests don't work on Windows anyway, so the fact
    that MSVC can't even build them properly is irrelevant;
    most likely gdbus-codegen needs changes to put _GLIB_EXTERN
    before each function)
2018-09-12 15:42:11 +00:00
LRN
cf4ea5ef75 Merge branch 'w32-gfileinfo-improvements' into 'master'
W32 GFileInfo improvements

See merge request GNOME/glib!238
2018-09-12 15:15:00 +00:00
Руслан Ижбулатов
157dfc8aae test_internal_enhanced_stdio: don't use g_assert()
g_assert() can be disabled, use more specific assertion macros.
2018-09-12 14:35:20 +00:00
Руслан Ижбулатов
c24d3b0fc3 W32: extend the g-file-info test with new DOS attributes 2018-09-12 14:35:18 +00:00
Руслан Ижбулатов
c6b4eff09e W32: new GFileInfo attributes
G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT allows mountpoints
(NTFS reparse points with IO_REPARSE_TAG_MOUNT_POINT tag) to
be told apart from symlinks (NTFS reparse points with
IO_REPARSE_TAG_SYMLINK tag), even though both are reported
by glib as "symlinks".

G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG allows the exact
reparse tag value to be obtained by the user. This way
even more exotic reparse points can be identified and
handled by the user (glib itself currently has no code
to work with any reparse points that are not symlinks
or mountpoints).
2018-09-12 14:35:16 +00:00
Руслан Ижбулатов
256e741248 W32: tighten access rights requested to read symlink
According to
http://blog.kalmbach-software.de/2008/02/28/howto-correctly-read-reparse-data-in-vista/
we only need FILE_READ_EA, and should also use wider share flags.
2018-09-12 14:35:14 +00:00
Руслан Ижбулатов
a86eb1a8b6 W32: test the private path-stripping function 2018-09-12 14:35:13 +00:00
Руслан Ижбулатов
05fdd09740 W32: Don't always strip path prefixes
Extended path prefix looks like "\\?\",
and NT object path prefix looks like "\??\".
Strip them only if they are followed by a character
(any character) and a colon (:), indicating that
it's a DOS path with a drive.
Otherwise stripping such prefix might result in a patch
that looks like a relative path.

For example, "\\?\Volume{GUID}\" becomes "Volume{GUID}\",
which is a valid directory name.

Currently it's up to the user to make sense of such paths.
2018-09-12 14:35:09 +00:00
Jonas Witschel
201cdd74f0 Use absolute paths in pkg-config files
According to https://www.bassi.io/articles/2018/03/15/pkg-config-and-paths/,
pkg-config files should use absolute paths in variables. This fixes
commit 47692845c0.

Closes #1521
2018-09-11 17:26:33 +02:00
Xavier Claessens
d6da69f07d Merge branch 'issue-1520' into 'master'
Install m4 macros unconditionally

Closes #1520

See merge request GNOME/glib!314
2018-09-10 13:02:48 +00:00
Emmanuele Bassi
e8fde0b9e7 Install m4 macros unconditionally
Partial revert of commit a7a6449f4d.

Checking for the availability of m4 for installing m4 macro files
creates an implicit dependency on m4 even if GLib does not need it; this
prevents building GLib and then installing Autotools in order to build a
project that depends on GLib.

Closes #1520
2018-09-10 12:44:59 +01:00
Anders Jonsson
b7fba1a5e3 Update Swedish translation 2018-09-07 18:15:20 +00:00
Iain Lane
d0aba9363e Merge branch '1119-volume-monitor-main-loop-docs' into 'master'
gvolumemonitor: Document the need to run a main loop

Closes #1119

See merge request GNOME/glib!310
2018-09-07 12:28:44 +00:00
Philip Withnall
83cd2f6204 gvolumemonitor: Document the need to run a main loop
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1119
2018-09-07 12:18:44 +01:00
Robert Ancell
64b76c7ca5 codegen: Change pointer casting to remove type-punning warnings
The existing code was generating code with undefined results that modern compilers warn about:

accounts-generated.c:204:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     (GDBusArgInfo **) &_accounts_accounts_method_info_list_cached_users_OUT_ARG_pointers,
2018-09-07 10:19:05 +12:00