• Fix capitalisation to be consistent
• Use Unicode quotation marks where appropriate
• Move trailing \n characters out of the translable strings and append
them unconditionally
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=695573
Mention that it really is a good idea to save errno before doing
literally anything else after calling a function which could set it.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=785577
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.
errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
int errsv, ret;
ret = some_call_which_might_set_errno ();
errsv = errno;
if (ret < 0)
puts (strerror (errsv));
This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.
https://bugzilla.gnome.org/show_bug.cgi?id=785577
The /etc/mtab file is still used by some distributions (e.g. Slackware),
so it has to be monitored instead of /proc/self/mountinfo in order to
avoid races between g_unix_mounts_get and "mounts-changed" signal. The
util-linux is built with --enable-libmount-support-mtab in that case and
mnt_has_regular_mtab is used for checks. Let's use mnt_has_regular_mtab
also to determine which file to monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=779607
WaitForMultipleObjectsEx() returns the index of the *first* handle that triggered the wakeup, and promises that all handles with lower index are still inactive. Therefore, don't check them, only check the handles with higher index. This removes the need of rearranging the handles (and, now, handle_to_fd) array, it's enough to take a pointer to the next item and use it as a new, shorter array.
https://bugzilla.gnome.org/show_bug.cgi?id=785468
Put all ptrs for GPollFDs that contribute handles into an array, the layout of which mirrors the handles array. This way finding GPollFD for a handle is a simple matter of knowing this handle's index in the handles array (which is something we always know). Removes the need to loop through all fds looking for the right one. And, with the message FD also passed along, it's now completely unnecessary to even pass fds to poll_rest() at all.
https://bugzilla.gnome.org/show_bug.cgi?id=785468
Instead of just indicating that messages should be polled for, save the pointer to GPollFD that contains G_WIN32_MSG_HANDLE, and pass it along. This way it won't be necessary to loop through all fds later on, searching for G_WIN32_MSG_HANDLE.
https://bugzilla.gnome.org/show_bug.cgi?id=785468
WaitForSingleObjectEx() is supposed to be a more efficient sleep method.
It waits on the handle of the current process. That handle will be signaled once the process terminates, and since we're *inside* the process, it'll never happen (and if it does, we won't care anymore).
The use of an alertable wait ensures that we wake up when a completion routine wants to run.
https://bugzilla.gnome.org/show_bug.cgi?id=785468
The original ready < nhandles - 1 can be re-written as ready + 1 < nhandles
which is the same confition that we are checking on the first
itteration of the for loop. This means we can remove the if statement
and let the for loop check the code.
This also has the side effect of removing an invalid check as
WAIT_OBJECT_0 was not subtracted from ready in the if statement.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
It just creates a number of socket pairs, then triggers read-ready status on these pairs in different patterns (none, one, half, all) and checks how much time it takes to g_poll() those. Also sometimes posts a Windows message and polls for its arrival.
The g_main_context_new() is necessary to initialize g_poll() debugging on W32.
Measures minimal and maximal time it takes to g_poll(), as well as the average, over 1000 runs.
Collects the time values into 25 non-linear buckets between 0ns and 1000ns, and displays them at the conclusion of each subtest.
https://bugzilla.gnome.org/show_bug.cgi?id=785468
In case of Python 2 and stdout being redirected to a file, sys.stdout.encoding
is None and it defaults ASCII for encoding text.
To match the behaviour of Python 3, which uses the locale encoding also when
redirecting to a file, wrap sys.stdout with a StreamWriter using the
locale encoding.
https://bugzilla.gnome.org/show_bug.cgi?id=785113
GCC 6.3.1 thinks that tmp is being used uninitialized:
gdatetime.c: In function ‘format_ampm’:
gdatetime.c:2248:7: warning: ‘tmp’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
g_free (tmp);
^~~~~~~~~~~~
It is not an actual problem because the code in question is guarded by
"if (!locale_is_utf8)" and "#if defined (HAVE_LANGINFO_TIME)", and it
does get initialized under those circumstances. Still, it is a small
price to pay for a cleaner build and having actual problems stand out
more prominently.
https://bugzilla.gnome.org/show_bug.cgi?id=785438
Unlike g_application_register, there is no public API to unregister the
GApplication from D-Bus. Therefore, if the GApplication is set up
manually without using g_application_run, then neither can the
GApplicationImpl be destroyed nor can dbus_unregister be called before
destruction.
This is fine as long as no sub-class has implemented dbus_unregister.
If they have, their method method will be called after destruction, and
they should be prepared to deal with the consequences.
As long as there is no public API for unregistering, let's demote the
assertion to a WARNING. Bravehearts who don't use g_application_run
can continue to implement dbus_unregister, but they would have been
adequately notified.
This reverts commit c1ae1170fa.
https://bugzilla.gnome.org/show_bug.cgi?id=725950
Instead of using NamedTemporaryFile, which doesn't take an encoding in Python 2
use mkstemp() to create a file and open it with io.open(), with a proper
encoding set.
https://bugzilla.gnome.org/show_bug.cgi?id=785113
This reverts commit fd329f4853.
The commit changed the Introspection ABI, and it requires a change in
any application using an introspection-based language binding.
Python 2.7 is the last stable release of the 2.x series, as per PEP
404: http://legacy.python.org/dev/peps/pep-0404/
Python 2.7 is also 7 years old, and maintained until 2020.
Invoking the dbus_unregister virtual method during destruction is
problematic. It would happen after a sub-class has dropped its
references to its instance objects, and it is surprising to be asked to
unexport exported D-Bus objects after that.
This problem was masked as a side-effect of commit 21b1c390a3.
Let's ensure that it doesn't regress by asserting that dbus_unregister
has happened before destruction.
Based on a patch by Giovanni Campagna.
https://bugzilla.gnome.org/show_bug.cgi?id=725950
On Windows open() defaults to ANSI and on Python 2 it doesn't take
an encoding. Use io.open() instead which provides the same interface
on both Python versions.
https://bugzilla.gnome.org/show_bug.cgi?id=785113
When using the Freedesktop backend for GNotification, it seems like a
better idea to map G_NOTIFICATION_PRIORITY_HIGH to NOTIFY_URGENCY_NORMAL
(instead of NOTIFY_URGENCY_CRITICAL) provided that the difference
between GNotification's NORMAL and HIGH priorities is minor.
Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
https://bugzilla.gnome.org/show_bug.cgi?id=784815
The Meson build has fallen a bit behind the Autotools one, when it comes
to the internally built tools like glib-mkenums and glib-genmarshals.
We don't need to generate gmarshal.strings any more, and since the
glib-genmarshal tool is now written in Python it can also be used when
cross-compiling, and without indirection, just like we use glib-mkenums.
We can also coalesce various rules into a simple array iteration, with
minimal changes to glib-mkenums, thus making the build a bit more
resilient and without unnecessary duplication.
The old glib-mkenums was more forgiving, and simply ignored any files it
could not find.
We're going to print a warning, as in the future we may want to allow
more strictness.
This is a bit of a hack to maintain some semblance of backward
compatibility with the old, Perl-based glib-mkenums. The old tool had an
implicit ordering on the arguments and templates; each argument was
parsed in order, and all the strings appended. This allowed developers
to write:
glib-mkenums \
--fhead ... \
--template a-template-file.c.in \
--ftail ...
And have the fhead be prepended to the file-head stanza in the template,
as well as the ftail be appended to the file-tail stanza in the
template. Short of throwing away ArgumentParser and going over
sys.argv[] element by element, we can simulate that behaviour by
ensuring some ordering in how we build the template strings:
- the head stanzas are always prepended to the template
- the prod stanzas are always appended to the template
- the tail stanzas are always appended to the template
Within each instance of the command line argument, we append each value
to the array in the order in which it appears on the command line.
This change fixes the libqmi build.
On Visual Studio, the compilation of the check program for va_copy() and
__va_copy() succeeds even though they may not be really available. So,
make sure we include msvc_recommended_pragmas.h which helps us to detect
this situation by bailing out when warning C4013 (which means this
function is really not available) is encountered.
Also make sure that on Visual Studio builds we always include
msvc_recommended_pragmas.h is included so that it helps us to find out
problems in the build, and update comments for dirent.h and sys/time.h
as they are not shipped with any Visual Studio.
https://bugzilla.gnome.org/show_bug.cgi?id=783270
Some of the arguments that affect the generated result in glib-mkenums
can be used multiple times, to avoid embedding unnecessary newlines in
their values.
This change fixes the NetworkManager build.
When using the `--header --body` compatibility mode, we need to emit
things we generally define in the header, such as the aliases for
standard marshallers, and aliases for deprecated tokens.
This fixes dbus-binding-tool, which is using `--header --body` and
deprecated tokens.
See: https://bugs.freedesktop.org/show_bug.cgi?id=101799