Commit Graph

18590 Commits

Author SHA1 Message Date
Philip Withnall
0ea541171d Merge branch '903-deprecate-main-context-wait' into 'master'
gmain: Officially deprecate g_main_context_wait()

Closes #903

See merge request GNOME/glib!139
2018-06-28 16:59:39 +00:00
Xavier Claessens
88d13b4d09 doc: Remove glib.types since glib has not GType 2018-06-28 09:55:56 -04:00
Xavier Claessens
124779be88 doc: Remove gobject.types since gtkdoc-scan rebuild it anyway
I'm not sure why gobject.cI was needed but that looks like hack around
old gtkdoc bug. Works fine without it.
2018-06-28 09:55:56 -04:00
Xavier Claessens
71bc8e797b doc: Remove gio.types since gtkdoc-scan rebuild it anyway
meson.build was already passing --rebuild-types option but not
Makefile.am. Copy the IGNORE_HFILES list from meson.build because it was
outdated in Makefile.am and it's causing build issues when using the
generated gio.types file because it would contain win32 types when
building on linux.
2018-06-28 09:55:56 -04:00
Fabio Tomat
3052d75fde Update Friulian translation 2018-06-28 10:19:27 +00:00
Philip Withnall
c40e8a55b3 Merge branch 'android-28' into 'master'
ci: Add latest Android API level 28

See merge request GNOME/glib!141
2018-06-27 14:34:25 +00:00
Philip Withnall
6db2412b41 gdesktopappinfo: Fix a minor command line leak
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-27 15:01:09 +01:00
Philip Withnall
c1d8b9c806 gbufferedoutputstream: Fix jump conditional on uninitialised data
The flush data structures were not zero-initialised, which meant the
branch in flush_buffer_thread() was based on an uninitialised condition.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-27 15:01:08 +01:00
Philip Withnall
cb2982efe6 Merge branch '1175-source-names' into 'master'
gmain: Add names to various GSources constructed in GLib

Closes #1175

See merge request GNOME/glib!138
2018-06-27 13:45:16 +00:00
Xavier Claessens
cf9613056c ci: Add latest Android API level 28
- Split the download part into a separate script to so docker keeps that
step in cache and avoid redownloading it.

- With API level >= 28 libiconv is not needed anymore because it's part
of Android's libc.

- Generate standalone toolchains to reduce the docker image size. It's
also easier because it doesn't need to pass sysroot args.

- Use clang compiler because gcc is deprecated in this Android NDK and
will be removed in the next release.
2018-06-27 09:23:13 -04:00
Xavier Claessens
b3508123e2 ci: factor out cross compilation jobs definitions 2018-06-27 09:18:05 -04:00
Ting-Wei Lan
064cb2b001 ci: Add FreeBSD CI
We use 'freebsd-11' instead of 'freebsd' as tags here because newer
FreeBSD versions can include API changes which are worth testing.
2018-06-26 23:18:04 +08:00
Philip Withnall
7a34e396ae gmain: Officially deprecate g_main_context_wait()
It’s been de-facto deprecated for a long time, due to emitting a
critical warning when used in a non-internal context. Make that official
in the documentation and with a deprecation annotation.

Split the implementation into an internal helper and an external
wrapper, so the two remaining internal uses don’t emit deprecation
warnings.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/903
2018-06-26 09:30:19 +01:00
Philip Withnall
208a6e815a gmain: Add names to various GSources constructed in GLib
For the purposes of debugging, it is quite useful for every GSource to
have a name set. Ensure that any GSource we construct inside GLib has a
name set. For GSources which are then returned to the caller, this name
can then be overridden with something even more useful by the caller.

Since this data is only used for debugging, avoid doing any allocations
for it; just use static strings.

https://gitlab.gnome.org/GNOME/glib/issues/1175
2018-06-26 09:25:39 +01:00
Emmanuele Bassi
cbfa776fc1 Merge branch 'wip/piotrdrag/unicode-typography-180625' into 'master'
Use Unicode typography in new translatable strings

See merge request GNOME/glib!137
2018-06-25 15:13:35 +00:00
Piotr Drąg
d9fc99256e Use Unicode typography in new translatable strings
See https://developer.gnome.org/hig/stable/typography.html
2018-06-25 16:51:00 +02:00
Philip Withnall
509ced6be5 Merge branch 'source-get-id-docs' into 'master'
gmain: Clarify documentation for g_source_get_id()

See merge request GNOME/glib!128
2018-06-25 13:18:32 +00:00
Philip Withnall
8002928465 Merge branch '1360-mkenums-tests' into 'master'
Add unit tests for glib-mkenums and resolve #1360

Closes #1360

See merge request GNOME/glib!136
2018-06-25 13:10:25 +00:00
Philip Withnall
515dac258c gmain: Clarify documentation for g_source_get_id()
It’s good to know *which* GMainContext is used to determine the ID, and
the preconditions for calling this method.

Using wording suggested by Emmanuele Bassi <ebassi@gmail.com>.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-25 13:46:43 +01:00
Philip Withnall
76083b6530 tests: Add glib-mkenums test for missing nicks
This adds a test to verify the change from issue #1360.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1360
2018-06-25 13:39:13 +01:00
Philip Withnall
e8d755eb8e tests: Add initial test framework for glib-mkenums
This allows running glib-mkenums with different C headers and checking
its output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1360
2018-06-25 13:39:13 +01:00
Peter Kjellerstedt
c0e6fa4f19 glib-mkenums: Ignore other per value options than 'skip' and 'nick'
If some other per value option was present than 'skip' or 'nick' then
a KeyError would occur. Ignoring such options matches the behaviour of
the old, Perl-based glib-mkenums.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>

https://gitlab.gnome.org/GNOME/glib/issues/1360
2018-06-25 13:39:13 +01:00
Philip Withnall
4993f2b7e5 Merge branch 'wip/muktupavels/per-desktop-overrides' into 'master'
GSettings: per-desktop overrides

Closes #1013

See merge request GNOME/glib!105
2018-06-25 10:32:44 +00:00
Emmanuele Bassi
a65ee63c71 Merge branch 'wip/lantw/gspawn-declare-environ' into 'master'
gspawn: Declare environ

See merge request GNOME/glib!134
2018-06-23 13:27:47 +00:00
Ting-Wei Lan
e14c853d9a gspawn: Declare environ
Function do_posix_spawn uses environ, but gspawn.c doesn't declare it.
Since there is no system header declaring this global variable, this
causes compilation error on FreeBSD.

Code added in this commit is copied from genviron.c.
2018-06-23 16:11:19 +08:00
Alberts Muktupāvels
b618ec40a7 Add a test for per-desktop overrides 2018-06-22 22:02:31 +03:00
Philip Withnall
0f77dc847b Merge branch 'wip/Jehan/fopen-modes' into 'master'
glib: Win32 does not accept "wb+" mode for fopen().

See merge request GNOME/glib!119
2018-06-22 17:24:14 +00:00
Philip Withnall
74cde71ceb Merge branch 'android-ndk-r17b' into 'master'
Few updates to the CI

See merge request GNOME/glib!133
2018-06-22 17:19:46 +00:00
Xavier Claessens
ca2fc30dea ci: Add "--push" argument to run-docker.sh help script
Also there is no need to run docker as root, the user just needs to be
in the "docker" group.
2018-06-22 11:49:08 -04:00
Xavier Claessens
94748af0e1 ci: Use shorter job names
Job names in gitlab pipeline view gets truncated to  "fedora-meson-..."
for all jobs which is not really useful. All our CIs are using Meson,
and the host distro is not relevant when doing cross builds.
2018-06-22 11:49:08 -04:00
Xavier Claessens
9a76e08ae1 ci: Update Android NDK to r17b
We should be testing latest NDK release but keep using API level 21 to
ensure GLib does not start using newer APIs. We could also later add a
runner for latest API level 28 which includes iconv API in Android's
libc so we don't need GNU libiconv anymore.
2018-06-22 11:49:08 -04:00
Xavier Claessens
250205a94b ci: Pin meson version to 0.46.1 when generating docker image
Also move it after running setup-android-ndk.sh so docker can keep that
stage in cache and won't run it again when changing meson version.
2018-06-22 11:06:45 -04:00
Jehan
ef4063c74d glib: add test for various modes of fopen().
This is especially to check for Win32 spotty support of "+" modes, such
as "wb+" which has to be replaced by "w+b".
See merge request !119.
2018-06-22 16:40:21 +02:00
Philip Withnall
e5ff26d657 Merge branch 'GVariant-bytestring-docs' into 'master'
gvariant-text: fix bytestring example

See merge request GNOME/glib!132
2018-06-22 10:19:36 +00:00
Will Thompson
2e7d22a3bd
gvariant-text: fix bytestring example
ord('a') == 97 == 0x61 != 0x97.

    >>> GLib.Variant.parse(None, "[byte 0x97, 0x98, 0x99, 0]", None, None)
    GLib.Variant('ay', b'\227\230\231')
    >>> GLib.Variant.parse(None, "[byte 0x61, 0x62, 0x63, 0]", None, None)
    GLib.Variant('ay', b'abc')
2018-06-22 10:01:58 +01:00
Philip Withnall
04c8691208 Revert "build: Look for copied Objective-C files in builddir again"
This reverts commit fe72b8772e.

It still fails on GNOME Continuous:
http://build.gnome.org/continuous/buildmaster/builds/2018/06/21/44/build/.

See https://gitlab.gnome.org/GNOME/glib/merge_requests/129 for
discussion.
2018-06-22 00:21:05 +01:00
Philip Withnall
bdb6af9356 Merge branch 'fix-objc-build' into 'master'
build: Look for copied Objective-C files in builddir again

See merge request GNOME/glib!129
2018-06-21 23:03:16 +00:00
Philip Chimento
fe72b8772e build: Look for copied Objective-C files in builddir again
This reverts commit 03c324c64a and fixes
the original problem with e004d5f397 that
caused the revert.

We use $(builddir) instead of $(abs_builddir) so that Automake's
dependency generation works correctly.

See !127.
2018-06-21 14:48:29 -07:00
Philip Withnall
ca98ce4280 Merge branch 'master' into 'master'
Use posix_spawn for optimized process launching

See merge request GNOME/glib!95
2018-06-21 17:10:43 +00:00
Daniel Drake
2b560457a0 gspawn: use sane_open() for stdin
sane_open() is used for stdout and stderr, but regular open() was being
used for stdin. Spotted by Philip Withnall.
2018-06-21 11:44:59 -05:00
Daniel Drake
86e2b8d427 gspawn: document FD_CLOEXEC behaviour
G_SPAWN_LEAVE_DESCRIPTORS_OPEN must be set to enable the optimized
posix_spawn codepath, so this flag is likely to see more usage now.

Document that FD_CLOEXEC can be used to cause file descriptors to be
automatically closed while this flag is used.
2018-06-21 11:44:59 -05:00
Daniel Drake
156d009696 gdesktopappinfo: add g_desktop_app_info_launch_uris_as_manager_with_fds variant
Add an app-launching function which allows standard file descriptors
to be passed to the child process.

This will be used by gnome-shell to pass systemd journal descriptors
as stdout/stderr. gnome-shell's child_setup function can then be
eliminated, which will enable use of the posix_spawn optimized
gspawn codepath for desktop app launching.
2018-06-21 11:44:59 -05:00
Daniel Drake
742efe6232 gdesktopappinfo: enable fast posix_spawn gspawn codepath
In order to use the new posix_spawn gspawn codepath, for more robust
app launching when available memory is low, we need to meet some
conditions.

child_setup needs to be NULL for this optimization to work, so drop
the internal child_setup that is used here. Replace it with a lightweight
wrapper binary (gio-launch-desktop) that sets GIO_LAUNCHED_DESKTOP_FILE_PID
before executing the app.

Adjust PATH for gio tests so that it can execute the new binary from the
build directory.
2018-06-21 11:44:28 -05:00
Daniel Drake
61f54591ac gspawn: Optimize with posix_spawn codepath
When the amount of free memory on the system is somewhat low, gnome-shell
will sometimes fail to launch apps, reporting the error:
  fork(): Cannot allocate memory

fork() is failing here because while cloning the process virtual address
space, Linux worries that the thread being forked may end up COWing the
entire address space of the parent process (gnome-shell, which is
memory-hungry), and there is not enough free memory to permit that to
happen.

In this case we are simply calling fork() in order to quickly call exec(),
which will throw away the entirity of the duplicated VM, so we should
look for ways to avoid the overcommit check.

The well known solution to this is to use clone(CLONE_VM) or vfork(), which
completely avoids creating a new memory address space for the child.
However, that comes with a bunch of caveats and complications:

  https://gist.github.com/nicowilliams/a8a07b0fc75df05f684c23c18d7db234
  https://ewontfix.com/7/

In 2016, glibc's posix_spawn() was rewritten to use this approach
while also resolving the concerns.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9ff72da471a509a8c19791efe469f47fa6977410

I experimented with a similar approach in glib, but it was not practical
because glibc has several items of important internal knowledge (such as
knowing which signals should be given special treatment because they are
NPTL implementation details) that are not cleanly exposed elsewhere.

Instead, this patch adapts the gspawn code to use posix_spawn() where
possible, which will reap the benefits of that implementation.
The posix_spawn API is more limited than the gspawn API though,
partly due to natural limitations of using CLONE_VM, so the posix_spawn
path is added as a separate codepath which is only executed when the
conditions are right. Callers such as gnome-shell will have to be modified
to meet these conditions, such as not having a child_setup function.

In addition to allowing for the gnome-shell "Cannot allocate memory"
failure to be avoided, this should result in a general speedup in this
area, because fork()'s behaviour of cloning the entire VM space
has a cost which is now avoided. posix_spawn() has also recently
been optimized on OpenSolaris as the most performant way to spawn
a child process.
2018-06-21 11:43:32 -05:00
Daniel Drake
3524de16e4 gspawn: Add g_spawn_async_with_fds variant
Add a new process spawning function variant which allows the caller
to pass specific file descriptors for stdin, stdout and stderr.
It is otherwise identical to g_spawn_async_with_pipes.

Allow the same fd to be passed in multiple parameters. To make this
workable, the child process logic that closes the fd after the first time
it has been dup2'ed needed tweaking; we now just set those fds to be
closed upon exec using the CLOEXEC flag. Add a test for this case.

This will be used by gnome-shell to avoid performing equivalent
dup2 actions in a child_setup function. Dropping use of child_setup will
enable use of an upcoming optimized process spawning codepath.
2018-06-21 11:43:32 -05:00
Philip Withnall
6700101495 Merge branch 'support-tcrypt' into 'master'
Add support for TCRYPT volumes to GMountOperation

See merge request GNOME/glib!120
2018-06-21 14:29:13 +00:00
segfault
76b4d0ab3f Add support for TCRYPT volumes to GMountOperation
Add G_ASK_PASSWORD_TCRYPT flag to GAskPasswordFlags and add the
following properties to GMountOperation:

- hidden_volume [1]
- system_volume [2]
- pim [3]

[1] https://www.veracrypt.fr/en/Hidden%20Volume.html
[2] https://www.veracrypt.fr/en/System%20Encryption.html
[3] https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html
2018-06-21 15:32:04 +02:00
Jehan
2b6bfdb125 glib: Win32 does not accept "wb+" mode for fopen().
Nevertheless it accepts "w+b".
When checking the Win32 documentation of fopen()/_wfopen(), it clearly
states:
> In addition to the earlier values, the following characters can be
> appended to mode to specify the translation mode for newline
> characters.

This implementation expects 'b' or 't' to be appended, and therefore
"wb+" ends up with an error, whereas the alias "w+b" works perfectly
while it is exactly the same thing. So let's just have glib "translate"
the mode when it can to have it working transparently the same way on
every platform.
2018-06-21 13:55:19 +02:00
Philip Withnall
03c324c64a Revert "build: Look for copied Objective-C files in builddir"
This reverts commit e004d5f397.

It broke the GNOME Continuous build, which uses autotools. This wasn’t
caught by CI because we don’t do an autotools CI build.

http://build.gnome.org/continuous/buildmaster/builds/2018/06/21/19/build/

Discussion in https://gitlab.gnome.org/GNOME/glib/merge_requests/127.
2018-06-21 11:52:54 +01:00
Philip Withnall
6e784963f4 Merge branch '1377-g-assert-cmpfloat' into 'master'
Resolve "g_assert_cmpfloat trips -Wdouble-promotion on Clang"

Closes #1377

See merge request GNOME/glib!127
2018-06-21 10:35:37 +00:00