Commit Graph

19395 Commits

Author SHA1 Message Date
Patrick Griffis
35e41862c2 gnetworkaddress: Implement parallel ipv4 and ipv6 dns lookups
As RFC 8305 recommends we can start multiple DNS queries in parallel
to more quickly make an initial response, especially when one is
particularly slow/broken.
2018-12-11 16:09:29 -05:00
Patrick Griffis
d6afa6c988 gresolver: Add g_resolver_lookup_by_name_with_flags{_async,_finish,}
This allows higher levels to have more control over resolving
(ipv4 or ipv6 for now) which allows for optimizations such
as requesting both in parallel as RFC 8305 recommends.
2018-12-11 16:09:29 -05:00
Philip Withnall
af39a37312 Merge branch 'fix-gdbus-codegen--interface-info' into 'master'
fix gdbus-codegen --interface-info-{header,body}

See merge request GNOME/glib!514
2018-12-11 12:25:31 +00:00
Will Thompson
335a01ebe4
gdbus-codegen: test --interface-info-{header,body}
This test is rudimentary but better than nothing.
2018-12-11 09:49:22 +00:00
Will Thompson
d946bff480
gdbus-codegen: sort input files
This means the output (including lists of filenames) does not depend on
the order of the input files, which may matter if this tool is invoked
with a glob or some other mechanism that doesn't guarantee an order.
2018-12-11 09:49:22 +00:00
Xavier Claessens
bdc9328bdf Merge branch 'meson-dep' into 'master'
Meson: Fix declare_dependency() calls

See merge request GNOME/glib!518
2018-12-10 22:39:32 +00:00
Xavier Claessens
3fadcf9ffa Merge branch 'meson-pkgconfig' into 'master'
Meson: Fix deprecation warning with upcoming 0.49.0 release

See merge request GNOME/glib!517
2018-12-10 20:19:38 +00:00
Philip Withnall
1c8bbab127 Merge branch 'gdatetime-typo' into 'master'
gdatetime: Fix typo in the comment

See merge request GNOME/glib!524
2018-12-10 17:55:35 +00:00
Tomasz Miąsko
db47ab8402 gdatetime: Fix typo in the comment
Follow up on https://gitlab.gnome.org/GNOME/glib/merge_requests/506#note_382186.
2018-12-10 17:54:27 +01:00
Xavier Claessens
475f0a9b67 Meson: Fix deprecation warning with 0.49.0 release
http://mesonbuild.com/Release-notes-for-0-49-0.html#deprecation-warning-in-pkgconfig-generator
2018-12-10 09:08:28 -05:00
Xavier Claessens
afd3f3beda Meson: Fix declare_dependency() calls
Turns out the fix in commit 93555577c wasn't enough, when using glib as
subproject and the parent project uses only libgio_dep, and include
<gi18n.h>, it won't find libintl.h because it's in the
include_directories of libglib_dep. Fix that by declaring dependencies
explicitly, which is the right thing to do since glib and gobject are
public dependencies of gio. That reflects what we do for the pkg-config
file as well.
2018-12-10 09:06:17 -05:00
Philip Withnall
fa80a2d133 Merge branch 'resources.msvc' into 'master'
glib-compile-resources: Fix code generation for MSVC builds (issue #1580)

Closes #1580

See merge request GNOME/glib!503
2018-12-10 12:06:41 +00:00
Philip Withnall
b1f16259fc Merge branch 'issue-1605' into 'master'
gdatetime: Store intermediate result of g_date_time_format in UTF-8

Closes #1605

See merge request GNOME/glib!506
2018-12-10 12:03:17 +00:00
Philip Withnall
af77e47e93 Merge branch 'encoding-prefix' into 'master'
tests: Rename macro to avoid conflict with encoding prefix

See merge request GNOME/glib!521
2018-12-10 11:43:37 +00:00
Tomasz Miąsko
e32342897a tests: Rename macro to avoid conflict with encoding prefix
Use macro name that doesn't conflict with string literal encoding prefix `U`.

```
../glib/tests/fileutils.c(282): warning C4133: 'function': incompatible types - from 'unsigned int [2]' to 'const gchar *'
../glib/tests/fileutils.c(284): warning C4133: 'function': incompatible types - from 'unsigned int [2]' to 'const gchar *'
../glib/tests/fileutils.c(285): warning C4133: 'function': incompatible types - from 'unsigned int [2]' to 'const gchar *'
../glib/tests/fileutils.c(286): warning C4133: 'function': incompatible types - from 'unsigned int [2]' to 'const gchar *'
../glib/tests/fileutils.c(287): warning C4133: 'function': incompatible types - from 'unsigned int [3]' to 'const gchar *'
...
```
2018-12-09 15:10:43 +01:00
Matej Urbančič
e8fb8322ce Updated Slovenian translation 2018-12-08 21:59:20 +01:00
Will Thompson
deafd7256e
gdbus-codegen: don't sort args in --interface-info-body
Previously, method and signal arguments were sorted by name, which
(assuming you don't happen to give your arguments
lexicographically-ordered names) means the generated signatures were
incorrect when there is more than 1 argument.

While sorting the methods and signals themselves (and properties, and
annotations on all these) is fine, it's easiest to not sort anything.
2018-12-06 21:39:27 +00:00
Will Thompson
faa3c319ba
gdbus-codegen: make --interface-info-{header,body} not crash
Since 1217b1bc4f, LICENSE_STR has taken two
parameters, not one. Without this change, running either mode fails
with a traceback like:

    Traceback (most recent call last):
      File "../gdbus-codegen", line 55, in <module>
        sys.exit(codegen_main.codegen_main())
      File ".../codegen_main.py", line 294, in codegen_main
        gen.generate()
      File ".../codegen.py", line 896, in generate
        self.generate_body_preamble()
      File ".../codegen.py", line 682, in generate_body_preamble
        self.outfile.write(LICENSE_STR.format(config.VERSION))
    IndexError: tuple index out of range

8916874ee6, which introduced these flags,
was actually merged after that commit, but I assume it was written
beforehand.
2018-12-06 21:39:17 +00:00
Philip Withnall
3469faf15c Merge branch 'ossfuzz-11576-variant-text-unicode-unescape' into 'master'
gvariant: Fix error handling for parsing Unicode escapes

See merge request GNOME/glib!511
2018-12-06 11:15:24 +00:00
Chun-wei Fan
cd30faae1f gresources: Add a test with resources > 64kb
This is to ensure that the generated code is still compilable by the
running compiler, and see whether we can read the things in there
properly.

See issue #1580.
2018-12-05 18:27:16 +08:00
Chun-wei Fan
6528887534 README.win32: Update workarounds for VS 2008 x64 builds
We need to also update build.ninja after configuration so that builds
don't get stuck on gio/tests/gsubprocess-testprog.c.
2018-12-05 18:10:40 +08:00
Chun-wei Fan
4501807d73 glib-compile-resources: Fix code generation for MSVC builds
glib-compile-resources was updated to generate octal byte
representation in a string, but unfortunately this breaks the build
on Visual Studio when the generated string sequence exceeds 65535
characters, which is the imposed limit on Visual Studio compilers.

To make things work on Visual Studio builds and to not slow down things
on other compilers, generate a code path for Visual Studio an array of
octal byte representations, as well as a code path for other compilers
that use the new string representation of octal values, and let the
compiler take the appropriate code path when compiling the
generated code.

Fixes issue #1580.
2018-12-05 16:17:24 +08:00
Philip Withnall
1ba843b8a0 Merge branch 'master' into 'master'
Add new Linux Testing project version number to configure script

See merge request GNOME/glib!510
2018-12-04 18:15:12 +00:00
Daniel Mustieles
fe13a528d5 Updated Spanish translation 2018-12-04 16:49:15 +01:00
Philip Withnall
d2224b475d gvariant: Fix error handling for parsing Unicode escapes
When parsing an escaped Unicode character in a text format GVariant
string, such as '\U0001F415', the code uses g_ascii_strtoull(). This,
unexpectedly, accepts minus signs, which can cause an assertion failure
when input like '\u-FF4' is presented for parsing.

Validate that there are no leading sign characters when parsing.

This shouldn’t be considered a security bug, because the GVariant text
format parser should not be used on untrusted input.

oss-fuzz#11576

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-04 12:55:21 +00:00
Philip Withnall
ca328615c8 gvariant: Use gsize rather than gint for array lengths
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-04 12:54:39 +00:00
Philip Withnall
96acb49eb1 gstrfuncs: Clarify that g_ascii_string_to_unsigned() rejects signs
Unlike g_ascii_strtoull(), g_ascii_string_to_unsigned() does not permit
leading signs (`+` or `-`). Document that.

It’s already in the unit tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-04 12:53:52 +00:00
Philip Withnall
8d0a163000 gstrfuncs: Clarify that g_ascii_strtoull() accepts signed numbers
It’s perverse, but explicitly documented that strtoull() accepts numbers
with a leading minus sign (`-`) and explicitly casts them to signed
output.

g_ascii_strtoull() is documented to do what strtoull() does (but locale
independently), and its behaviour is correct. However, the documentation
could be a lot clearer about this unexpected behaviour.

Add a unit test for it too.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-04 12:51:09 +00:00
Tomasz Miąsko
8bfa45817e gdatetime: Avoid unnecessary conversions from ASCII to UTF-8 2018-12-04 13:34:33 +01:00
Tomasz Miąsko
bc59892b1a gdatetime: Store intermediate result of g_date_time_format in UTF-8
In date time formatting routine, instead of converting from UTF-8 to
locale charset and then from locale charset to UTF-8, store all
intermediate result in UTF-8.

This solves the issue where user provided UTF-8 format string might be
unrepresentable in the current locale charset.

Fixes issue #1605.
2018-12-04 13:34:18 +01:00
Nirbheek Chauhan
23ed6f4a50 Merge branch 'glib-mkenums-rspfile-support' into 'master'
glib-mkenums: Support reading @rspfiles for arguments

See merge request GNOME/glib!489
2018-12-04 10:58:23 +00:00
Nirbheek Chauhan
17316b2c16 glib-mkenums: Support reading @rspfiles for arguments
This is needed on Windows where the argument list can exceed the
maximum command-line length when lots of sources are passed to
glib-mkenums.
2018-12-04 16:16:00 +05:30
Emmanuel Fleury
ea3d9fbc69 Add new Linux Testing project version number to configure script 2018-12-04 10:48:24 +01:00
Philip Withnall
d4cc0b32fd Merge branch 'ci-locales' into 'master'
ci: Install additional locales used during tests

See merge request GNOME/glib!508
2018-12-03 13:50:05 +00:00
Tomasz Miąsko
ee9f5c5717 ci: Update docker image to master:v11 2018-12-03 14:11:30 +01:00
Philip Withnall
c1b2a38d5a Merge branch 'unset-language' into 'master'
tests: Unset LANGUAGE when running gdatetime tests

See merge request GNOME/glib!504
2018-12-03 11:26:55 +00:00
Tomasz Miąsko
521eba94b9 ci: Install additional locales used during tests
Note that this intentionally does not use glibc-all-langpacks
package since its contents is currently incomplete.
https://bugzilla.redhat.com/show_bug.cgi?id=1624528
2018-12-03 11:40:09 +01:00
Matej Urbančič
ad09bba9e4 Updated Slovenian translation 2018-12-02 18:03:32 +01:00
Tomasz Miąsko
69fbf3ed59 tests: Unset LANGUAGE when running gdatetime tests
In glibc, LANGUAGE is used as highest priority guess for category value.
Unset it to avoid interference with tests using setlocale and translation.

Issue #1357.
2018-11-29 23:35:54 +01:00
Christoph Reiter
4afc203b1f Merge branch 'win32-environ-case-sensitivity' into 'master'
genviron: make g_environ_* case-insensitive on Windows

See merge request GNOME/glib!500
2018-11-28 16:13:19 +00:00
Peter Wu
a51ab0a5ab genviron: make g_environ_* case-insensitive on Windows
g_environ_getenv(env, "PATH") and g_environ_setenv(env, "PATH", newpath)
did not have the intended effect on Windows due to the environment block
containing "Path=". Make these functions case-insensitive for Windows.
2018-11-28 11:04:48 +01:00
Xavier Claessens
4f3216d7c0 Merge branch 'nls' into 'master'
Meson: Add 'nls' option to disable translation

See merge request GNOME/glib!484
2018-11-27 14:32:25 +00:00
Philip Withnall
389087eb11 Merge branch '1600-g_timeout_add_seconds-overflow' into 'master'
Resolve "g_timeout_source_new_seconds overflows when given interval > (G_MAXUINT / 1000)"

Closes #1600

See merge request GNOME/glib!496
2018-11-27 10:53:20 +00:00
Will Thompson
4544dcb788
gmain: test far-future ready_time 2018-11-27 10:40:35 +00:00
Will Thompson
cdc2dd8eb1
gmain: clamp over-large timeouts
g_main_context_prepare() needs to calculate the timeout to pass to
poll(), expressed in milliseconds as a gint.  But since the ready time
for a GSource is represented by gint64 microseconds, it's possible that
it could be more than G_MAXINT * 1000 microseconds in the future, and so
can't be represented as a gint. This conversion to a narrower signed
type is implementation-defined, but there are two possible outcomes:

* the result is >= 0, in which case poll() will time out earlier than we
  might hope (with no adverse consequences besides an unwanted wakeup)
* the result is < 0, in which case, if there are no other sources,
  poll() will block forever

This is extremely unlikely to happen in practice, but can be avoided by
clamping the gint64 value, which we know to be positive, to G_MAXINT.

Thanks to Tomasz Miąsko for pointing this out on !496.
2018-11-27 10:36:20 +00:00
Will Thompson
6490fe7fe8
g_timeout_*_seconds: test an interval that overflowed
This is essentially a C version of the reproducer on #1600. It is based
on the existing test_seconds(), which relates to a similar but distinct
overflow.

I've only actually run this on a system with 32-bit ints, it should work
regardless of the width of an int, since the remainder after wrapping
will by construction be less than 1 second.
2018-11-27 10:36:20 +00:00
Matthias Clasen
98efd7e04d Merge branch 'application-replace' into 'master'
Application replace

See merge request GNOME/glib!250
2018-11-26 20:43:19 +00:00
Matthias Clasen
136f83eefd Add tests for --gapplication-replace
Test the GApplication replacement functionality.
2018-11-26 11:45:30 -05:00
Matthias Clasen
3a4b18f903 GApplication: Add a way to replace a unique instance
While uniqueness is great, sometimes you want to restart
a newer version of the same app. These two flags make that
possible.

We also add a ::name-lost signal, that is emitted when it
happens. The default handler for this signal just calls
g_application_quit(), but applications may want to connect
and do cleanup or state-saving here.
2018-11-26 11:45:29 -05:00
Will Thompson
4ff3734ff5
g_timeout_*_seconds: don't overflow for large intervals
Previously, the `guint interval` parameter, measured in seconds, was
multiplied by 1000 and stored in another `guint` field. For intervals
greater than (G_MAXUINT / 1000) seconds, this would overflow; the
timeout would fire much sooner than intended.

Since GTimeoutSource already keeps track of whether it was created at
millisecond or second resolution, always store the passed interval
directly. We later convert the interval to microseconds, stored in a
gint64, so can move the `* 1000` to there.

The eagle-eyed reader might notice that there is no obvious guarantee
that the source's expiration time in microseconds won't overflow the
gint64, but I don't think this is a new problem. Previously, the
monotonic time would have to reach (2 ** 63 - 2 ** 32) microseconds for
this overflow to occur; now it would have to reach approximately (2 **
63 - 2 ** 42) microseconds. Both of these are 292.47 millennia to 5
significant figures.

Fixes #1600.
2018-11-26 16:04:10 +00:00