23296 Commits

Author SHA1 Message Date
Goran Vidović
b3023ecc28 Update Croatian translation 2021-10-27 17:15:22 +00:00
Fabio Tomat
a413d98d62 Update Friulian translation 2021-09-25 18:13:16 +00:00
Philip Withnall
d99d7967a2 2.68.4
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2.68.4
2021-08-19 16:25:53 +01:00
Emmanuele Bassi
4e13a16029 Merge branch 'backport-2174-newline-glib-2-68' into 'glib-2-68'
Backport !2174 “data-to-c.py: generate new-line at the end of the file” to glib-2-68

See merge request GNOME/glib!2175
2021-08-19 15:21:54 +00:00
Philip Withnall
94ef9408f7 Merge branch 'glib-2-68-backport-g-win32-app-info-fixes' into 'glib-2-68'
Backport GWin32AppInfo fixes to glib-2-68

See merge request GNOME/glib!2220
2021-08-09 13:01:30 +00:00
Jonathan Boeing
ee94434632
gwin32packageparser: Fix read past end of buffer
g_win32_package_parser_enum_packages() reads beyond the end of a buffer
when doing a memcpy.  With app verifier enabled on Windows, it causes
the application to crash on startup.

This change limits the memcpy to the size of the source string.

Fixes: #2454
2021-08-09 14:13:15 +02:00
Руслан Ижбулатов
771a6e557a
GWin32AppInfo: Fix missing initialization
The value should be initialized to NULL before calling
g_win32_registry_key_get_value_w(), to ensure that cleanup
can be done unconditionally afterward.
2021-08-09 14:12:35 +02:00
Руслан Ижбулатов
d0ef6399d4
GWin32AppInfo: re-trigger registry watcher from the callback
To ensure that the watch is properly re-set every time, call
watch_keys() from the watch callback. Previously the watch was only
renewed after a data update was done in a worker thread, which made
no sense, since the update function was implemented in such a way
that it can (and should) be re-triggered on each key change, until
the changes stop coming, and that can only happen if we renew
the registry watcher right away.
2021-08-09 14:12:16 +02:00
Руслан Ижбулатов
22e5e428de
GWin32RegistryKey: ensure reqeueing works correctly
If a key watch is renewed from the key watch callback, it results
in the callback being NULL, since we clear it after we call it.

Rearrange the function to make sure that the changes done by the
callback function are preserved properly.
2021-08-09 14:12:07 +02:00
Руслан Ижбулатов
d6a734a44c
GWin32RegistryKey: Change STATUS_SUCCESS handling
This function can, in fact, return STATUS_SUCCESS. We shouldn't
assert that it doesn't.

For now interpret it just like STATUS_PENDING (i.e. APC will be called),
see how it goes (it isn't documented how the function behaves in this
case, we have to play it by ear).

Note that while we *can* use a better-documented RegNotifyChangeKeyValue() here,
it communicates back to us via event objects, which means that the registry
watcher would have to interact with the main loop directly and insert its
events (plural; one event per key) there. That would make the API more complicated.
Whereas the internal NT function communicates by calling an APC - we're good
as long as something somewhere puts the thread in alertable state.
2021-08-09 14:11:39 +02:00
Simon McVittie
6d9e493264 Merge branch 'backport-2208-string-replace-loop-glib-2-68' into 'glib-2-68'
Backport !2208 “g_string_replace: Don't replace empty string more than once per location” to glib-2-68

See merge request GNOME/glib!2209
2021-08-02 14:38:02 +00:00
Simon McVittie
4ce606878e g_string_replace: Document behaviour of zero-length match pattern
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 13:49:19 +01:00
Simon McVittie
79fa8db828 test_string_replace: Exercise zero-length replacements
Previously, these would have done 2**32 replacements, and the first one
would have consumed 6GB of memory in the process. They now match what
Python `str.replace()` does.

Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2452
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 13:49:19 +01:00
Simon McVittie
c70eb3f0aa g_string_replace: Don't replace empty string more than once per location
This matches the behaviour of Python `str.replace()`, and avoids carrying
out 2**32 replacements before n wraps around, which is almost certainly
not what we want.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2452
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 13:49:19 +01:00
Simon McVittie
d587690534 test_string_replace: Expand test coverage
These are taken from another project (steam-runtime-tools) where I
implemented a similar replace method before realising that more recent
GLib versions had g_string_replace().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 13:49:19 +01:00
Simon McVittie
5162562903 test_string_replace: Make the test table-driven
This makes it straightforward to add more test-cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 13:49:19 +01:00
Simon McVittie
3798abd5ea test_string_replace: Make types agree
g_string_replace() returns guint, not gint.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 13:49:19 +01:00
Michael Catanzaro
be84555c73 tests: Add missing return value check in string test
Coverity noticed that we were not testing the return value here. Good
Coverity!
2021-08-02 13:49:19 +01:00
Quentin PAGÈS
66a9196329 Update Occitan translation 2021-07-29 17:04:03 +00:00
Ondrej Holy
7cce6b5c7f Merge branch 'backport-2185-trash-fix-glib-2-68' into 'glib-2-68'
Backport !2185 “glocalfile: Fix the global trash dir detection” to glib-2-68

See merge request GNOME/glib!2186
2021-07-12 11:10:23 +00:00
markus
d7ba35360a glocalfile: Fix the global trash dir detection
The `g_file_trash` function fails with the `Unable to find or create trash
directory` error when the global `.Trash` directory exists. This is because
the commit 7f2af262 introduced the `gboolean success` variable to signalize
the detection of the trash folder, but didn't set it in all code branches.
Since for a time this variable was not initialized the bug wasn't visible
when the trash folder existed. The bug became effective after the `success`
variable was initialized with `FALSE` by the commit c983ded0. Let's explicitly
set the `success` variable in all branches to fix the global trash dir
detection.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2439
2021-07-12 11:35:03 +01:00
Chao-Hsiung Liao
ebe1dbd860 Update Chinese (Taiwan) translation 2021-07-10 05:18:32 +00:00
Emmanuele Bassi
63e7864d1a Merge branch 'backport-2180-close_range-glib-2-68' into 'glib-2-68'
Backport !2180 “correctly use 3 parameters for close_range” to glib-2-68

See merge request GNOME/glib!2183
2021-07-09 12:27:02 +00:00
Khem Raj
6e59d21b27 correctly use 3 parameters for close_range
libc implementation has 3 parameter e.g.
https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2&format=html

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-07-09 12:24:56 +01:00
Michael Olbrich
0d236c39ee data-to-c.py: generate new-line at the end of the file
This is necessary when building glib with icecc. Icecc splits the build
process into two parts. The file is locally preprocessed with
-fdirectives-only to resolve any includes. This adds linemarkers to the
intermediate file. Without the new-line at the end of the file this:

 #include "gconstructor_as_data.h"
 #include "glib/glib-private.h"

Is turned into this:

const char gconstructor_code[] = "...";# 1 "glib/glib-private.h"
...

The result is a compile error:

In file included from ../glib/gio/glib-compile-resources.c:45:
gio/gconstructor_as_data.h:1: error: stray '#' in program
gio/gconstructor_as_data.h:1: error: expected identifier or '(' before numeric constant
In file included from ../glib/glib/glib-private.h:22,
                 from gio/gconstructor_as_data.h:2,
                 from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/gwakeup.h:27:1: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:28:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:30:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:32:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:33:42: error: unknown type name 'GWakeup'
In file included from gio/gconstructor_as_data.h:2,
                 from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/glib-private.h:98:3: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:99:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h💯58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:102:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:103:58: error: unknown type name 'GWakeup'
In file included from gio/gconstructor_as_data.h:2,
                 from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/glib-private.h:164:53: warning: file "../glib/gio/glib-compile-resources.c" linemarker ignored due to incorrect nesting

To avoid this, generate gconstructor_as_data.h with a new-line at the end
of the file.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2021-07-02 14:29:29 +01:00
Dingzhong Chen
d3dc7a8727 Update Chinese (China) translation 2021-06-24 23:17:59 +08:00
Simon McVittie
14a1eb525e Merge branch 'backport-2155-local-file-monitor-deadlock-glib-2-68' into 'glib-2-68'
Backport !2155 “glocalfilemonitor: Avoid a deadlock on finalization” to glib-2-68

See merge request GNOME/glib!2158
2021-06-15 18:40:11 +00:00
Philip Withnall
f49710b8aa glocalfilemonitor: Avoid a deadlock on finalization
If `g_file_monitor_source_dispatch()` drops the last reference to its
`GLocalFileMonitor`, a deadlock will occur, because disposing the
`GLocalFileMonitor` causes synchronous disposal of the
`GFileMonitorSource`, and hence an attempt to re-lock the already-locked
mutex in the `GFileMonitorSource`.

Fix that by dropping the reference to the `GLocalFileMonitor` after
unlocking.

Diagnosed by Ting-Wei Lan. The bug was originally introduced by me in
commit 592a13b483.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-15 13:26:23 +01:00
Philip Withnall
8249f624ed 2.68.3
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2.68.3
2021-06-10 19:55:29 +01:00
Emmanuele Bassi
b2c7013fbc Merge branch 'backport-2140-file-replace-contents-etags-glib-2-68' into 'glib-2-68'
Backport !2138 “glocalfileoutputstream: Fix ETag check when replacing through a symlink” to glib-2-68

See merge request GNOME/glib!2141
2021-06-10 12:49:34 +00:00
Philip Withnall
aa4aafe30b glocalfileoutputstream: Fix ETag check when replacing through a symlink
Since commit 87e19535fe, the ETag check when writing out a file through
a symlink (following the symlink) has been incorrectly using the ETag
value of the symlink, rather than the target file. This is incorrect
because the ETag should represent the file content, not its metadata or
links to it.

Fix that, and add a unit test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2417
2021-06-07 14:28:03 +01:00
Emmanuele Bassi
bb6aa99e2c Merge branch 'backport-2128-inotify-leak-glib-2-68' into 'glib-2-68'
Backport !2128 “inotify: Fix a memory leak” to glib-2-68

See merge request GNOME/glib!2133
2021-06-07 13:23:41 +00:00
Emmanuele Bassi
599910dfea Merge branch 'backport-2136-tls-cert-parsing-glib-2-68' into 'glib-2-68'
Backport !2136 “tlscertificate: Avoid possible invalid read” to glib-2-68

See merge request GNOME/glib!2137
2021-06-07 13:22:58 +00:00
Peter Bloomfield
afd31d93b5 tests/tls-certificate: Add context to the new test
Add a comment to `pem_parser_no_sentinel()` to explain what it is
testing and how it works.
2021-06-07 09:38:37 +01:00
Peter Bloomfield
bdd36797fc tlscertificate: Avoid possible invalid read
In various places, do not read past the end of the data.
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2416
2021-06-07 09:38:37 +01:00
Peter Bloomfield
955d376b85 tests/tls-certificate: Add a unit test
Test whether g_tls_certificate_new_from_pem() can handle a
non-nul-terminated PEM.

(Fixed minor conflict when cherry-picking.)

Helps https://gitlab.gnome.org/GNOME/glib/-/issues/2416
2021-06-07 09:38:09 +01:00
Gaël Bonithon
d25d6d70f3 inotify: Fix a memory leak
Fixes: #2311
2021-06-04 11:57:41 +01:00
Philip Withnall
36c2b737fa 2.68.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2.68.2
2021-05-11 11:55:43 +01:00
Sebastian Dröge
942026a2eb Merge branch 'backport-2078-threaded-resolver-flags-glib-2-68' into 'glib-2-68'
Backport !2078 “gthreadedresolver: don't ignore flags in lookup_by_name_with_flags” to glib-2-68

See merge request GNOME/glib!2079
2021-05-03 11:59:57 +00:00
Clayton Craft
9383b9a955 gthreadedresolver: don't ignore flags in lookup_by_name_with_flags
This fixes a bug where the family flag was ignored in lookup_data_new,
causing the resolver to call getaddrinfo with no hints set when clearly
the family hint should have been set.
2021-05-03 11:36:04 +01:00
Pawan Chitrakar
5e00581980 Update Nepali translation 2021-05-02 07:16:50 +00:00
Sebastian Dröge
faac8f7b41 Merge branch 'nacho/gmacros-glib-2-68' into 'glib-2-68'
gmacros: missing check if __STDC_VERSION__ is defined

See merge request GNOME/glib!2068
2021-04-27 11:28:25 +00:00
Ignacio Casal Quinteiro
7d392d7ebc gmacros: missing check if __STDC_VERSION__ is defined
This fixes warnings when compiling on old distros like centos 7
2021-04-27 13:11:03 +02:00
Sebastian Dröge
1816c1e555 Merge branch 'nacho/gmacros' into 'glib-2-68'
gmacros: check that __cplusplus or _MSC_VER is defined

See merge request GNOME/glib!2060
2021-04-23 08:40:31 +00:00
Ignacio Casal Quinteiro
f954aff882 gmacros: check that __cplusplus or _MSC_VER is defined
Otherwise it will fail to compile in old distros like Centos 7
Fixes #2387
2021-04-23 10:09:49 +02:00
Pawan Chitrakar
e9587a480a Update Nepali translation 2021-04-15 22:03:49 +00:00
Мирослав Николић
463b714e8e Update Serbian translation 2021-04-11 18:19:51 +00:00
Philip Withnall
c2954ecb04 2.68.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2.68.1
2021-04-08 14:50:44 +01:00
Philip Withnall
ffc9ac5599 Merge branch 'backport-2026-log-lines-glib-2-68' into 'glib-2-68'
Backport !2026 “Split g_test_log() messages that contain multiple lines” to glib-2-68

See merge request GNOME/glib!2035
2021-04-08 13:41:05 +00:00
Emmanuele Bassi
2e37754261 Split g_test_log() messages that contain multiple lines
When using TAP we want every single line to be one of the following:

 - a valid TAP clause
 - a comment
 - a blank line

Typical explicit test logs are single line comments, but in some cases
we might end up printing debug messages from libraries, and those may
contain multiple lines. When that happens, we break the TAP and fail the
test in conditions entirely outside of our control.

One option to avoid outright failure is to always prepend each line of a
messge with `#`, to ensure that the whole thing is considered a comment.
2021-04-07 16:36:06 +01:00