23288 Commits

Author SHA1 Message Date
Руслан Ижбулатов
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
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
Philip Withnall
484531600c Merge branch 'glib-2-68-mr-2032' into 'glib-2-68'
Backport MR !2032 (gkeyfile: Drop a redundant check) into glib-2-68

See merge request GNOME/glib!2034
2021-04-07 13:44:36 +00:00
Benjamin Berg
56fe8cccc5 gsocks5proxy: Handle EOF when reading from a stream
The code did not handle EOF (0 byte read) correctly. This can e.g. cause
an infinite loop if an incorrect socks proxy is configured.

Add the appropriate checks and return an G_IO_ERROR_CONNECTION_CLOSED
error if EOF is encountered.
2021-04-07 16:29:40 +03:00
Bruce Cowan
e0c0342688 Update British English translation 2021-04-02 13:24:48 +00:00
Philip Withnall
3da1f2595f Merge branch 'vs2012-2-68' into 'glib-2-68'
Few fixes and notes for building on Visual Studio 2012 and earlier

See merge request GNOME/glib!2022
2021-03-31 15:52:23 +00:00
Chun-wei Fan
8da16a4f80 README.win32.md: Restore Visual Studio 2008/2010 support
It turns out that it is possible to use the Windows 8.0 SDK in Visual
Studio 2008 and 2010 officially, but requires a special setup in the
build command prompt.

Tell people how that special setup can be achieved, and restore the
extra instructions on building with Visual Studio 2008, as it is now
possible again.
2021-03-31 21:48:52 +08:00
Chun-wei Fan
a54af2f36f README.win32.md: Add info on roapi.h
The roapi.h that is included with the Windows 8.0 SDK mostly works under
plain C with one exception, so let people know the fix for that.  Note
that the Windows 8.1 and 10 SDKs contain copies of roapi.h that is
directly usable under plain C.
2021-03-31 21:48:52 +08:00
Chun-wei Fan
ce660066f2 gsocket.c: Declare variables at the top-of-block
This will allow the code to build on C89 compilers, since they do not
allow declaring a variable within a for loop initializer.
2021-03-31 21:48:52 +08:00
Chun-wei Fan
20bd716d4c option-context.c: Define NAN if not defined on MSVC
This will enable the build to succeed on older Visual Studio versions
that don't support NAN yet.  Other supported compilers should support
this.
2021-03-31 21:47:49 +08:00