Commit Graph

16813 Commits

Author SHA1 Message Date
Philip Withnall
a079de930e gmessages: Add doc cross-refs about enabling structured logging
Ensure that all the old log handler documentation includes
cross-references to a new section about how to enable structured logging
(tl;dr: #define G_LOG_USE_STRUCTURED).

https://bugzilla.gnome.org/show_bug.cgi?id=769785
2016-08-12 14:14:54 +02:00
Philip Withnall
f7825f98e7 gmessages: Drop one of the documentation sections
It was short, unhelpful, and easy to confuse with the longer and more
informative documentation sections.

https://bugzilla.gnome.org/show_bug.cgi?id=769785
2016-08-12 11:54:45 +02:00
Jordi Mas
599bb6eaf3 Update Catalan translation 2016-08-12 04:41:31 +02:00
Dušan Kazik
3b20acecc6 Updated Slovak translation 2016-08-08 11:52:47 +00:00
Yosef Or Boczko
ad2da25693 Updated Hebrew translation 2016-08-07 13:42:32 +03:00
Philip Withnall
371078b6a3 gmessages: Expand documentation on log domains and G_MESSAGES_DEBUG
Give some example log domains, and recommend that G_MESSAGES_DEBUG is
used universally as the way to enable debug output (rather than having a
separate environment variable per library).

https://bugzilla.gnome.org/show_bug.cgi?id=682794
2016-08-07 08:10:31 +01:00
Philip Withnall
0e132b8ac5 gmessages: Document g_test_expect_message() doesn’t like structured logs
It’s effectively deprecated if G_LOG_USE_STRUCTURED is defined, or if
the structured logging API is used directly. See the documentation for
rationale.

https://bugzilla.gnome.org/show_bug.cgi?id=769486
2016-08-07 08:07:42 +01:00
Philip Withnall
4e66036b82 Revert "Make g_test_expect_message work for structured logs"
This reverts commit df02e8f47c.

We are going to make g_test_expect_message() only work for the old
logging API.

https://bugzilla.gnome.org/show_bug.cgi?id=769486
2016-08-07 08:07:42 +01:00
Philip Withnall
2a5d9f8898 Revert "Add a test for expected messages with structured logging"
This reverts commit bc40c7a05c.

We are going to make g_test_expect_message() only work for the old
logging API.

https://bugzilla.gnome.org/show_bug.cgi?id=769486
2016-08-07 08:07:42 +01:00
Philip Withnall
5c3205f2fb gmessages: Don’t require is_journald() call before writer_journald()
g_log_writer_is_journald() works out whether the process’ stderr or
stdout are redirected to journald. While the default writer function
uses this in conjunction with g_log_writer_journald(), that does not
always have to be the case — other writer functions might want to always
write to the journal, and never write to stderr (for example).

Consequently, automatically open the journal socket in
writer_journald(), rather than is_journald().

https://bugzilla.gnome.org/show_bug.cgi?id=769507
2016-08-04 14:33:34 +01:00
Emmanuele Bassi
5ff8579527 Fix debug builds under MSVC
The C spec leaves conditional evaluation inside a macro expansion as
undefined behaviour. This means we cannot use constructs like:

  GOBJECT_IF_DEBUG(OBJECTS, {
    ...
  #ifdef BLAH
    ...
  #endif
    ...});

Because compilers are entirely justified to ignore the conditional, or,
like in the case of MSVC, error out.

https://bugzilla.gnome.org/show_bug.cgi?id=769504
2016-08-04 10:18:46 +01:00
Aurimas Černius
64f6d14d0c Updated Lithuanian translation 2016-08-03 22:07:51 +03:00
Philip Withnall
04bbf9df37 gdatagrambased: Clarify that connection-oriented ≠ stream-based
GDatagramBased allows connection-oriented and connection-less sockets,
but does not allow stream-based sockets (because it’s datagram-based).
So it supports SCTP and UDP, but not TCP.

Clarify that in the documentation, and people sometimes confuse
connection-oriented with stream-based, due to the prevalence of TCP.
2016-08-03 18:46:29 +01:00
Colin Walters
555c5a6376 gvariant: Fix typo in previous commit 2016-08-03 11:34:43 -04:00
Yury Usishchev
1be86b3d18 glib/gvariant.c: Fix NULL pointer check in is_valid_heap_iter
https://bugzilla.gnome.org/show_bug.cgi?id=769245
2016-08-03 11:27:12 -04:00
Matthias Clasen
bc40c7a05c Add a test for expected messages with structured logging
This tests the fix in the previous commit.
2016-08-02 23:16:04 -04:00
Matthias Clasen
df02e8f47c Make g_test_expect_message work for structured logs
This is used in GTK+ tests, and GTK+ has switched to
G_LOG_USE_STRUCTURED, so we need this to keep working.
2016-08-02 23:16:04 -04:00
Daniel Mustieles
1b711d9b4a Updated Spanish translation 2016-08-02 16:46:35 +02:00
Mario Sanchez Prada
fbf72a31b1 Don't enable libmount by default for now
This is causing trouble with flatpaks because the org.gnome.Platform
runtime does not bundle libmount, while the org.gnome.Sdk does it.

As this probably requires a change in the freedesktop.org Yocto base,
we disable this support by default for now as a temporary measure
until it can be properly reviewed by someone who knows those bits
better, probably Alex Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=769284
2016-07-28 12:24:14 -06:00
Mario Sanchez Prada
ed75b1623d gunixmounts: Ensure that libmount's context gets freed on early returns
Otherwise, it will be leaked in case the relevant table (mtab, fstab)
could not be retrieved for some reason.

https://bugzilla.gnome.org/show_bug.cgi?id=769238
2016-07-28 08:24:57 -06:00
Mario Sanchez Prada
b28c76b0d8 gunixmounts: Do not leak libmount tables in _g_get_unix_mounts()
Use mnt_context_get_mtab instead of using mnt_context_get_table(), since
that's the recommended way of accessing mtab/mountinfo information, and
also because that way the (struct libmnt_table *) will get automatically
deallocated when calling mnt_free_context()

https://bugzilla.gnome.org/show_bug.cgi?id=769238
2016-07-28 08:24:57 -06:00
Chun-wei Fan
7cf037ec16 gmessages.h: Use G_STRFUNC instead of __func__
We have G_STRFUNC which takes care of __func__, which may not be available
depending on compiler, so we ought to make use of it.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-28 16:04:02 +08:00
Chun-wei Fan
48317b199b gio/gappinfo.c: Include gtask.h
This avoids warning/error C4013 (aka implicit declaration of ...) as we
need APIs from gtask.h.
2016-07-27 16:06:21 +08:00
Chun-wei Fan
6d6b97aa59 gmessages.c: Fix build on non-Linux
journald is a part of systemd which is Linux-only at this time, so only
compile the journald items on Linux only, and just return FALSE for
g_log_writer_is_journald() and G_LOG_WRITER_UNHANDLED for
g_log_writer_journald() on non-Linux.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-27 10:45:00 +08:00
Matthias Clasen
c1e8f705dd Add async variant of g_app_info_launch_default_for_uri
This is useful in the portalized case, when the portal may
present an app chooser dialog to the user.

https://bugzilla.gnome.org/show_bug.cgi?id=768752
2016-07-26 16:05:29 -04:00
Mario Sanchez Prada
f885c4dd0d Monitor /proc/self/mountinfo when using libmount
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
97f799b53a Refactor common code into create_unix_mount_point ()
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
44f4309e3b Implemented _g_get_unix_mount_points() based on libmount
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
2051ee7678 Refactor common code into create_unix_mount_entry ()
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
030594777a Implemented _g_get_unix_mounts() based on libmount
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
8d5cf2df10 Use libmount to find the path of the fstab file
https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Mario Sanchez Prada
4f9cddaeb8 Added autotools support for libmount
Check whether libmount is available at configuration time and provide
an option to explicitly enable or disable it, similar to libelf.

https://bugzilla.gnome.org/show_bug.cgi?id=522053
2016-07-26 08:09:27 -06:00
Matthias Clasen
496c52ec79 Avoid htole64 altogether
GLib ships its own api for this, lets use it.
2016-07-25 12:31:52 -04:00
Matthias Clasen
ad285d9bd2 Handle EINTR when sending logs to the journal
Ray pointed out that we might well get interrupted here,
and should not loose logs due to that.
2016-07-25 10:25:40 -04:00
Matthias Clasen
34cb9c7de1 Explicitly include endian.h
htole64 is defined here.

https://bugzilla.gnome.org/show_bug.cgi?id=769139
2016-07-25 10:15:08 -04:00
Matthias Clasen
a2d5d1f119 Use SOCK_CLOEXEC if available
Ray pointed out that we can avoid the race here.
2016-07-25 09:47:26 -04:00
Thiago Macieira
a5f209bc65 Fall back for overflow-checked arithmetic with Intel compiler
The Intel compiler does not have intrinsics like `__builtin_uadd_overflow`.

https://bugzilla.gnome.org/show_bug.cgi?id=769104
2016-07-23 09:27:52 -04:00
Matthias Clasen
df457c9110 Update logging tests
We now treat the PRIORITY field like other string fields, and
set its length to -1. Adapt the tests for this.
2016-07-22 23:06:52 -04:00
Matthias Clasen
6a07885a98 Drop libsystemd dependency
Talk to the journal ourselves using sendmsg() instead of linking
against libsystemd for sd_journal_sendv(). At the same time, we
can also avoid excessive copying.

The motivation for dropping the dependency is that we can
then use structured logging e.g. in a flatpak sandbox where
libsystemd may not be present in the runtime.

The code here is inspired by similar code in libvirt.
2016-07-22 23:04:51 -04:00
Matthias Clasen
ca775518d8 Add more structured logging tests
In particular, add a test to ensure that passing NULL
as log_domain has no negative consequences.
2016-07-22 15:12:42 -04:00
Matthias Clasen
e7ee56dd1d Make g_log_set_writer_func work more than once
It is fine to document that you shall only call this once,
but for tests, it is important that we can call it multiple
times.
2016-07-22 15:12:42 -04:00
Matthias Clasen
97a38dc586 Fix a small typo 2016-07-22 15:12:42 -04:00
Emilio Pozuelo Monfort
38317cf746 Use a uint64 to unpack a 64 bit value
https://bugzilla.gnome.org/show_bug.cgi?id=769089
2016-07-22 19:20:30 +02:00
Ray Strode
f414cddc1f gmessages: support NULL log domain
It's possible that a project may not define the G_LOG_DOMAIN but
still use g_log functions.  In such cases, we now crash.

This commit fixes that.

https://bugzilla.gnome.org/show_bug.cgi?id=769087
2016-07-22 11:33:14 -04:00
Matthias Clasen
f38845c116 Expand g_log_structured docs a bit
Mention two possible pitfalls that were pointed out by Ray Strode.
2016-07-21 14:52:46 -04:00
Matthias Clasen
d5efa64539 Deal with lack of O_CLOEXEC
Some platforms don't have it. We fall back to fcntl() in other
places, so do it here as well.

https://bugzilla.gnome.org/show_bug.cgi?id=769042
2016-07-21 11:54:14 -04:00
Alberts Muktupāvels
ad669500a6 gobject: add g_autoptr support for GTypeModule
https://bugzilla.gnome.org/show_bug.cgi?id=769033
2016-07-21 17:03:06 +03:00
Krzesimir Nowak
d5a16fbd2d gvariant: Avoid anonymous struct and union members
C++ does not like them for various reasons.

https://bugzilla.gnome.org/show_bug.cgi?id=766370
2016-07-21 14:06:58 +02:00
Daniel P. Berrange
b9934f16b6 gchecksum: annotate when G_CHECKSUM_SHA512 was introduced
Currently the docs for GChecksumType are simpy annotated
with 'Since 2.16' which is when GChecksumType was first
introduced. No mention is made of the fact that the
G_CHECKSUM_SHA512 constant was only added much later
in 2.36.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=769027
2016-07-21 08:03:26 -04:00
Víctor Manuel Jáquez Leal
d311177948 gmessage: Suppress string format literal warning
https://bugzilla.gnome.org/show_bug.cgi?id=769029
2016-07-21 07:12:46 -04:00