Commit Graph

18318 Commits

Author SHA1 Message Date
Will Thompson
0c5f084200
fileinfo: make UNIX_IS_MOUNTPOINT be TRUE for /
The previously implementation considered a file to be a mountpoint if
its parent is on a different device. / is its own parent, so by this
definition it is not a mountpoint.

But / is (generally) listed in fstab, and fstab(5) defines the
directories it contains to be mountpoints. This attribute should follow
that definition (and reasonable expectation): the root directory is a
mountpoint.

So, add a special-case for the case where the file's parent has the same
st_dev and st_ino as the file, which is true only at the root.

Test this attribute at / (only on POSIX), /proc (but only on Linux), and
at many files and directories created by the test suite (which cannot be
mountpoints).
2018-06-07 06:38:23 +01:00
Philip Withnall
e0f82b9494 Merge branch '1374-array-tests' into 'master'
Resolve "Fix g_array_insert_vals() with an index off the end of the array"

Closes #1374

See merge request GNOME/glib!12
2018-06-04 10:34:28 +00:00
Philip Withnall
80243e65b6 tests: Expand GArray test coverage to cover all construction forms
Previously, there was very little coverage of GArray behaviour with
either of the zero_terminated or clear_ arguments to g_array_new() set
to TRUE.

Parameterise the tests and exhaustively expand the coverage to cover all
possible GArray configurations.

This was made possible by the online code coverage report for GLib which
we now have:
https://gnome.pages.gitlab.gnome.org/glib/coverage/glib/garray.c.gcov.html.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795975
2018-06-04 11:11:26 +01:00
Philip Withnall
89f45e96b2 garray: Allow over-allocation in g_array_insert_vals()
Previously, g_array_insert_vals() would crash if called with an index
off the end of the array. This is inconsistent with the behaviour of
other methods (like g_array_set_size()), which will expand the array as
necessary.

Modify g_array_insert_vals() to expand the array as necessary. New array
elements will be cleared to zero if the GArray was constructed with
(clear_ == TRUE).

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

https://bugzilla.gnome.org/show_bug.cgi?id=795975
2018-06-04 11:11:26 +01:00
Philip Withnall
3eeec77800 garray: Fix (nullable) annotation on GArray.[prepend|insert]_vals()
They do both accept NULL value arrays, but only if the number of
elements in the value array is zero. Fix the annotations and mention
this in the documentation.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795975
2018-06-04 11:11:26 +01:00
Xavier Claessens
05fe110635 Merge branch 'remove-disable-mem-pools' into 'master'
build: Remove the --disable-mem-pools build option and the DISABLE_MEM_POOLS macro

See merge request GNOME/glib!52
2018-06-03 03:22:18 +00:00
Christoph Reiter
3aa23078ac build: Remove the --disable-mem-pools build option and the DISABLE_MEM_POOLS macro
It's mostly not used anymore and doesn't do what it says it does.

The docs state that it affects GList, GSList, GNode, GMemChunks, GSignal,
GType n_preallocs and GBSearchArray while:

* GList, GSList and GNode use GSlice and are not affected
* GMemChunks is gone
* GType npreallocs is ignored

It also states that it can be used to force the usage of g_malloc/g_free,
which is handled by G_SLICE=always-malloc now.

The only places where it's used is in signal handling through GBSearchArray
and in GValueArray (deprecated). Since it's unlikely that anyone wants to
reduce allocation sizes just for those cases remove the build option.
2018-06-02 09:45:55 +02:00
Christoph Reiter
553df9dcaf Merge branch 'fix-gdbus-unix-addresses-test' into 'master'
Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set

See merge request GNOME/glib!50
2018-06-01 15:31:25 +00:00
Nirbheek Chauhan
b1ce8344b7 Merge branch 'patch-1' into 'master'
Fix a warning reported by static analyser tool

See merge request GNOME/glib!44
2018-06-01 14:30:14 +00:00
Xavier Claessens
f929d14826 Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set
This test assumes the subprocess does not print anything else on stdout
other than the dbus address, otherwise g_test_trap_assert_stdout()
fails to match. But if the env running tests has G_MESSAGES_DEBUG=all
then it will also print "PATH=%s".
2018-06-01 10:23:12 -04:00
Xavier Claessens
a3c061a814 Merge branch 'remove-gc-friendly-default' into 'master'
Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option

See merge request GNOME/glib!43
2018-05-31 17:36:25 +00:00
Xavier Claessens
09b8c6d24b Merge branch 'remove-secure-libc' into 'master'
Remove unused HAVE_LIBC_ENABLE_SECURE  and add a glibc implementation for g_check_setuid

See merge request GNOME/glib!45
2018-05-31 16:20:12 +00:00
Emmanuele Bassi
54db9d3fc3 Merge branch 'remove-posix-memalign-compl-check' into 'master'
Remove posix_memalign() checks for an old glibc bug

See merge request GNOME/glib!47
2018-05-31 13:03:41 +00:00
Emmanuele Bassi
dd4f44fd04 Merge branch 'remove-no-fd-set' into 'master'
Remove NO_FD_SET and assume fd_set exists

See merge request GNOME/glib!46
2018-05-31 12:42:38 +00:00
Christoph Reiter
fe59a18f89 Remove posix_memalign() checks for an old glibc bug
POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS was added in
https://bugzilla.gnome.org/show_bug.cgi?id=328254
to work around a glibc bug where it wrongly checked the size argument
to be a power of two instead of the alignment.

This was fixed in glibc in
https://sourceware.org/git/?p=glibc.git;a=commit;h=b2bffca2e3b59dd882039e3b0ab835d127bdaf7a
about 16 years ago.
2018-05-31 14:29:33 +02:00
Christoph Reiter
b6c81d139c Remove NO_FD_SET and assume fd_set exists
gspawn.c is using fd_set without checks for 17 years now and the NO_FD_SET check was added
19 years ago.
2018-05-31 13:31:55 +02:00
Christoph Reiter
a7fefb0e4e g_check_setuid: implement using getauxval(AT_SECURE) with glibc
See commit 4c2928a544 for why checking AT_SECURE is preferable compared
to UID checks as currently done in the fallback case.

getauxval() was added with glibc 2.16

While glibc <2.19 didn't provide a way to differentiate a 0 return value from an error,
passing AT_SECURE should always succeed according to
https://sourceware.org/ml/libc-alpha/2014-07/msg00407.html
I've added an errno check anyway, to be on the safe side.
2018-05-31 12:02:36 +02:00
Christoph Reiter
41165b2a7e Remove unused HAVE_LIBC_ENABLE_SECURE
It was added in 4c2928a544 to potentially enable accessing
AT_SECURE through __libc_enable_secure, but was never enabled.

Newer glibc provides getauxval(AT_SECURE) which should be used instead.
Add a TODO note for that.
2018-05-31 10:58:27 +02:00
Gaurav
593eeff55e Fix a warning reported by static analyser tool:
Assignment of a signed value which has type 'time_t' to a variable of a bigger integer type 'guint64'
2018-05-31 08:25:31 +00:00
Christoph Reiter
118332dd5c Remove unused ENABLE_GC_FRIENDLY_DEFAULT and its build option
ENABLE_GC_FRIENDLY_DEFAULT was supposed to set the default for the gc friendliness
while still allowing to force enable it at runtime with G_DEBUG=gc-friendly.

With commit 943a18b564 (6 years ago) things were changed to always set it
according to the content of G_DEBUG in glib_init(), making the default unused.

Since nobody complained since then just remove the macro and the build option.
2018-05-31 07:19:12 +02:00
Philip Withnall
e03f83212d Merge branch '796385-indentation' into 'master'
Fix misleading indentation (bug #796385)

See merge request GNOME/glib!42
2018-05-30 09:33:56 +00:00
Philip Withnall
61b2f5c8e1 build: Always enable -Wmisleading-indentation
Try and ensure that people don’t push code with misleading indentation
in future. This should give fairly few false positives.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-30 10:12:01 +01:00
Iain Lane
51d566ba6e test_paths: Reindent to avoid tripping -Wmisleading-indentation
This fixes:

glib/tests/testglib.c: In function ‘test_paths’:
glib/tests/testglib.c:955:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
   if (g_test_verbose ())
   ^~
glib/tests/testglib.c:958:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
     {
     ^

https://bugzilla.gnome.org/show_bug.cgi?id=796385
2018-05-30 10:07:35 +01:00
Philip Withnall
2dce3ce125 Merge branch 'win-date-fixes' into 'master'
gdate: Use a more recent year when fetching the month names. Fixes #1386

Closes #1386

See merge request GNOME/glib!40
2018-05-29 16:35:12 +00:00
Philip Withnall
42a9e80ab1 Merge branch 'remove-winxp-comapt-code' into 'master'
Remove winxp compat code

See merge request GNOME/glib!41
2018-05-29 16:07:48 +00:00
Christoph Reiter
a2aa91ae5d win32: Remove all remaining WinXP compat code
Remove all code which is no longer built with Windows 7+
2018-05-29 17:16:38 +02:00
Christoph Reiter
cce2957938 gthread-win32: Remove WinXP compat code 2018-05-29 17:11:32 +02:00
Christoph Reiter
0458f4728f gdate: Use a more recent year when fetching the month names. Fixes #1386
g_date_strftime() on Windows uses the SYSTEMTIME structure which requires the
year to be >=1601. Passing 1 results in a negative SYSTEMTIME.wYear
which makes GetDateFormatW() fail and crashes due to missing error handling.

Just use 1976 as that's already used a few lines down.
2018-05-29 15:42:19 +02:00
Philip Withnall
6054d11001 Merge branch 'nirbheek/windows-7-not-vista' into 'master'
meson: We actually support 7+, not Vista+

See merge request GNOME/glib!39
2018-05-29 12:25:08 +00:00
Nirbheek Chauhan
2e5454f892 meson: We actually support 7+, not Vista+
https://gitlab.gnome.org/GNOME/glib/issues/504#note_225707
2018-05-29 17:41:29 +05:30
Philip Withnall
4100c84c06 Merge branch 'msys2-export-meson-logs-artifacts' into 'master'
ci: Export meson-logs from msys2-mingw32 build as artifacts

See merge request GNOME/glib!33
2018-05-29 10:45:28 +00:00
Philip Withnall
91208e8d3f ci: Clarify artifact naming
Put the job name and commit identifier in the artifact names.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-29 10:54:29 +01:00
Philip Withnall
a53d74e078 ci: Always export artifacts from Fedora build
The default `when: on_success` means no artifacts are exported when the
tests fail, which is precisely when we want to see the artifacts.

Always export them, and rely on GitLab to garbage collect them as
appropriate (typically after 30 days, I think).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-29 10:53:41 +01:00
Philip Withnall
1041504099 ci: Export meson-logs from msys2-mingw32 build as artifacts
This means that compilation and test failures will leave logs on the CI
machines which we can use to debug the failures.

Always export the artifacts. The default `when: on_success` is
appropriate for now, but won’t be in future when the tests actual report
their success value correctly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-29 10:52:01 +01:00
Philip Withnall
a077746e4e Merge branch 'wip/rishi/issue-914' into 'master'
Add fuzzy comparison macros

See merge request GNOME/glib!35
2018-05-29 09:31:59 +00:00
Emmanuele Bassi
0b4c2eefce Add fuzzy floating point comparison macro
Add a test macro that allows comparing two floating point values for
equality within a certain tolerance.

This macro has been independently reimplemented by various projects:

 * Clutter
 * Graphene
 * colord

https://gitlab.gnome.org/GNOME/glib/issues/914
2018-05-29 10:02:47 +01:00
Emmanuele Bassi
24e98e38d6 Add a macro for checking approximate values
A macro like this is useful to avoid direct comparisons between floating
point values.

https://gitlab.gnome.org/GNOME/glib/issues/914
2018-05-29 09:55:47 +01:00
Emmanuele Bassi
61ccf733cc Merge branch 'wip/rishi/issue-1073' into 'master'
Revert "Return folder as icon for directories"

See merge request GNOME/glib!36
2018-05-29 07:43:56 +00:00
Xavier Claessens
cd47f8d8de Revert "Add macosx CI"
Disable macosx CI until we get proper hosting, the test machine we had
is too old and slow.

This reverts commit 042b057e4d.
2018-05-28 13:58:06 -04:00
Philip Withnall
c3846b33d7 Merge branch 'identifier-typo-fix' into 'master'
gio: Fix some typos in the documentation

See merge request GNOME/glib!31
2018-05-28 16:58:13 +00:00
Philip Withnall
6730309826 Merge branch 'wip/hadess/g-drive-identifier' into 'master'
gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE

See merge request GNOME/glib!10
2018-05-28 16:31:42 +00:00
Daniel Mustieles
0b98fa5f3b Updated Spanish translation 2018-05-28 17:55:16 +02:00
Philip Withnall
fbcf7f7088 Merge branch 'macosx-ci' into 'master'
Add macosx CI

Closes #1389

See merge request GNOME/glib!19
2018-05-28 15:37:30 +00:00
Bastien Nocera
75950d70c9 gio: Deprecate G_VOLUME_IDENTIFIER_KIND_HAL_UDI
HAL itself has long been deprecated.
2018-05-28 17:20:21 +02:00
Debarshi Ray
25af5ad1da Revert "Return folder as icon for directories"
This workaround is no longer necessary because it was fixed in
shared-mime-info three years ago:
https://bugs.freedesktop.org/show_bug.cgi?id=89150

This reverts commit 90025254fd.

https://gitlab.gnome.org/GNOME/glib/issues/1073
2018-05-28 17:19:59 +02:00
Xavier Claessens
042b057e4d Add macosx CI
Fixes #265.
2018-05-28 11:15:01 -04:00
Bastien Nocera
4c84eac38e gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE
It's a synonym of G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE.
It doesn't change anything except not feeling dirty from using a wrongly
prefixed constant for the object type.

See: #182
2018-05-28 17:13:30 +02:00
Xavier Claessens
d16d37bc10 Merge branch 'mingw-ci' into 'master'
Add mingw64 ci

Closes #1387

See merge request GNOME/glib!16
2018-05-28 14:39:34 +00:00
Xavier Claessens
e0a3b0edd5 Merge branch 'android-ci' into 'master'
Add android CI

Closes #1385

See merge request GNOME/glib!15
2018-05-28 14:24:08 +00:00
Philip Withnall
137ae066fe Merge branch 'wip/oholy/gio-mount-stop' into 'master'
gio-tool: Add support for stopping drives

See merge request GNOME/glib!17
2018-05-28 14:03:37 +00:00