Commit Graph

581 Commits

Author SHA1 Message Date
Benjamin Gilbert
23009aadc6 build: switch back to c_std=gnu99 pending ObjC fix
It's better to warn by default on MSVC (which we were already doing before
we bumped to 1.4.0) than to fail by default on macOS.

Fixes: 51e3e7d9ae ("build: Bump Meson dependency to 1.4.0")
2024-09-25 07:45:06 -07:00
Gleb Popov
dae3b8bd15 Introduce a special mode of operating for the inotify GFileMonitor backend
libinotify-kqueue is a library that implements inotify interface in terms of
kqueue/kevent API available on Mac OS and *BSD systems. The original kqueue
backend seems to be a predecessor version of the code that is currently present
in libinotify-kqueue. Under the hood the library implements a sophisticated
filesystem changes detection algorithm that is derived from the glib backend
code.

Updating the native glib kqueue backend requires substantial work, because code
bases have diverged greatly. Another approach is taken, instead. libinotify-kqueue
can serve as a drop-in replacement for Linux inotify API, thus allowing to
reuse the inotify backend code. The compatibility, however, comes at cost, since
the library has to emulate the inotify descriptor via an unix domain socket.
This means that delivering an event involves copying the data into the kernel
and then pulling it back.

The recent libinotify-kqueue release adds a new mode of operation called "direct".
In this mode the socket pipe is replaced with another kqueue that is used to
deliver events via a kevent(EVFILT_USER) call.
Employing the direct mode requires minor changes to the client code compared
to using plain inotify API, but in return it allows for reusing libinotify's
algorithms without a performance penalty. Luckily, all required changes are
consolidated in one file called inotify-kernel.c

This puts us in the best of possible worlds. On one hand we share a lot of code
with glib inotify backend, which is far more thoroughly tested and widely used.
On the other we support a range of non-Linux systems and consolidate the business
logic in one library. I plan to do the same trick for QFileSystemWatcher which
will give us the same behaviour between Gtk and Qt applications.

The glib test suite passes for both old kqueue backend and new libinotify-kqueue
one. However, the AppStream FileMonitor tests are failing with the old backend,
but pass with the new one, so this is still an observable improvement.

Relevant libinotify-kqueue PR: https://github.com/libinotify-kqueue/libinotify-kqueue/pull/19
2024-09-19 09:54:56 +03:00
Gleb Popov
c7e2ae30f0 Add Meson option that allows selecting GFileMonitor's backend implementation
The option defaults to 'auto' which keeps the current selection behavior, but
also allows user to override the choice.

Also make the chosen backend is reported to the code via CPP defines.
2024-09-18 12:01:27 +03:00
Philip Withnall
7a7d8d548a Merge branch 'wfloat-conversion' into 'main'
build: Enable -Wfloat-conversion and fix warnings

See merge request GNOME/glib!4126
2024-09-17 17:57:11 +00:00
Philip Withnall
0134888d50
build: Bump gvdb subproject dependency and disable tests
This brings in https://gitlab.gnome.org/GNOME/gvdb/-/merge_requests/23,
which is needed for the following few commits.

Unfortunately, one of the other commits it brings in introduces a
sort-of-dependency-loop between GIO and GVDB. To avoid that, we have
to disable the GVDB tests. See
https://gitlab.gnome.org/GNOME/gvdb/-/merge_requests/25 for details.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-09-12 21:15:42 +01:00
Benjamin Gilbert
51e3e7d9ae build: Bump Meson dependency to 1.4.0
Meson 1.5.1 is available in the fd.o SDK and in Debian testing, so the
glib Meson policy says we can update.  Update the minimum only as far as
1.4.0 because we don't yet have a need for 1.5.0.

This allows us to:

- Use file.full_path() to avoid deprecation warnings on str.format(file).
- Set c_std=gnu99,c99 to avoid deprecation warnings with gnu99 on MSVC.

Update all the CI builds to use the latest 1.4.x patch release, 1.4.2.

The FreeBSD runner cannot be updated via `gitlab-ci.yml`, so will be
broken for now.

Similarly, the macOS build will not work unless `-Dc_std=gnu99` is
specified at configure time, due to
https://github.com/mesonbuild/meson/issues/13639.
2024-09-12 19:15:05 +01:00
Evan Welsh
93271385f9 ci: Set gobject-introspection version and build gobject-introspection in tests
The minimum version is now 1.80.0
2024-08-26 12:07:25 +01:00
Philip Withnall
ea44c0e4e0
build: Post-release version bump
This opens up the development cycle for 2.84.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 10:42:32 +01:00
Philip Withnall
fd8ede0b66
build: Check for epoll_create1 rather than epoll_create in meson.build
Because `epoll_create1()` is what the code in `giounix-private.c`
actually uses.

Spotted by Xuntao Chi.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3450
2024-08-25 15:28:21 +01:00
Emmanuele Bassi
77da866407 Post-release version bump to 2.81.2 2024-08-02 12:52:54 +01:00
Emmanuele Bassi
95eafc0738 2.81.1
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2024-08-02 12:41:55 +01:00
Ernesto de Gracia Herranz
38faeca62e replace package.version.Version by internal code
This drops the dependency on the Python `packaging` module.

Signed-off-by: Ernesto de Gracia Herranz <ernestodgh@jfrog.com>
2024-07-04 11:04:38 +00:00
Philip Withnall
692a50b78e
build: Enable -Wfloat-conversion by default
GLib now compiles without emitting any float conversion warnings, so
let’s keep it that way.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3405
2024-06-28 14:44:01 +01:00
Philip Withnall
5fdd6507b4 Merge branch 'ebassi/c11-toolchain-req-docs' into 'main'
docs: Update toolchain requirement to C11

See merge request GNOME/glib!4082
2024-06-14 12:35:06 +00:00
Marco Trevisan (Treviño)
5b0ae99e9a build: Add -Wno-typedef-redefinition to CFLAGS
Without the -Wno-typedef-redefinition option, clang complains if a typedef
gets redefined in gnu99 mode (since this is officially a C11 feature). This
also happened with old versions of GCC.

So, don't break the build on such warn, since we want to support
toolchains that supports C11 anyways.
2024-06-14 12:35:21 +01:00
Philip Withnall
74c6c4c221 Merge branch 'fix-introspection-windows' into 'main'
Introspection: Fix running g-ir-scanner 1.80.x+ on Windows

See merge request GNOME/glib!3988
2024-06-13 20:12:33 +00:00
Emmanuele Bassi
10fd218666 Build HTML versions of the man pages
And install them in the same directory as the API reference, so it's
possible to link them.

Fixes: #2896
2024-06-02 15:15:31 +00:00
Philip Withnall
60845fce0a Merge branch 'dont-rm-rf-root' into 'main'
gtestutils: Don't follow symlinks when deleting tests' tempdir

Closes #3290

See merge request GNOME/glib!4018
2024-05-23 23:08:39 +00:00
Will Thompson
5f6dda5bdc gtestutils: Don't follow symlinks when deleting tests' tempdir
Previously, when cleaning up the temporary directory tree created by
passing G_TEST_OPTION_ISOLATE_DIRS, any symbolic links in that tree
would be followed recursively. If the test case has created a symbolic
link in its temporary directory to a directory outside that tree, this
could lead to unexpected data loss; in particular, if the test case
author has (unwisely) created a symbolic link to /, they could lose all
data on the system.

On systems that have the ftw.h header, replace the current rm_rf()
implementation with one that uses nftw() to perform a depth-first
traversal (FTW_DEPTH) without following symbolic links (FTW_PHYS), and
without crossing mount points (FTW_MOUNT) in case a test has mounted
some other filesystem in the temporary directory.

The callback logs any error to the standard error stream, but returns 0
rather than -1 to allow nftw() to keep walking the tree rather than
terminating immediately. Suppose we are trying to clean up the following
tree:

    tmpdir/
      a/
        f/ (directory not readable for some reason)
        g/
          p
      b/
        c
        d

Since tmpdir/a/f is not readable, we can expect to fail to delete
tmpdir/a/f, tmpdir/a and tmpdir; but it is preferable to (attempt) to
delete the rest of the tree rather than failing outright. The cost is
that three errors will be logged (for tmpdir/a/f, tmpdir/a and tmpdir).

nftw() is part of POSIX.1-2001, SUSv1, and glibc ≥ 2.1, so should be
available on effectively every platform except Windows. (And Windows
does not enable symbolic links by default so the developer error is less
likely to occur there.)

The macOS ftw(3) manpage says:

> These functions are provided for compatibility with legacy code.  New
> code should use the fts(3) functions.

fts(3) does not seem to be part of any standard, but it does seem to be
equally widely supported. The Linux manpages do not indicate that
nftw() is deprecated.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3290
2024-05-22 22:43:42 +01:00
Emmanuele Bassi
4fcdbd6f84 build: Use C89 for the standard version check
The '90' version is for ISO C90, but Meson does not understand it. As
far as GCC and Clang are concerned, `-std=c89` is exactly the same as
`-std=c90`. As of VS 2017, MSVC supports `/std:c11` as the minimum
version of the C standard, with C89 (plus Microsoft extensions) being
the default.

See:

- GCC: https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/C-Dialect-Options.html
- MSVC: https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-170#c-standards-support-1
2024-05-22 17:04:51 +01:00
Michael Catanzaro
153cda6669 Convert systemtap from bool to feature option type
Now systemtap can be enabled by default in distros that use
-Dauto_features=enabled or for developers who already have systemtap
installed, while it's still disabled for developers who do not have
systemtap installed. See #3354
2024-05-17 15:22:41 -05:00
Michael Catanzaro
ed020a688a Convert dtrace from bool to feature option type
Now dtrace can be enabled by default in distros that use
-Dauto_features=enabled or for developers who already have dtrace
installed, while it's still disabled for developers who do not have
dtrace installed. See #3354
2024-05-17 15:22:41 -05:00
Chun-wei Fan
ef73ce4f7f Introspection: Fix running g-ir-scanner 1.80.x+ on Windows
Since we are now building introspection files for GLib while building
GLib, so we want to make sure that we indeed load the freshly-built
DLLs when running g-ir-scanner, so we add the various needed subdirs
(and if needed, subprojects), to set the GI_EXTRA_BASE_DLL_DIRS
envvar so that g-ir-scanner will look for the newly-built GLib DLLs.

Ideally, upstream g-ir-scanner will need to be updated accordingly to do
something similar to what we are doing here, but this is needed until
the time that we require a g-ir-scanner that contains the update.

This will also fix the g-ir-scanner erroring out when there is no
pre-existing GLib on the system, as the needed DLLs are now found.

Related issue: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/499
Related MR in G-I:
https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/458
2024-05-17 18:37:32 +08:00
Marco Trevisan (Treviño)
0eb6c85606 build: Define glib_sanitizers variable to easily get the sanitizers in use
It's an array containing the list of sanitizers in use, normally it
contains a value, but in some cases may have more than one (e.g.
'address' and 'undefined').

And so use it to avoid repeated checks
2024-05-10 02:15:52 +02:00
Fabrice Fontaine
4e6dc4dee0 link with -latomic when needed
Some architecture such as sparc and some flavors of arm needs -latomic
to avoid the following build failure:

gthread-posix.c:(.text+0xda8): undefined reference to `__atomic_compare_exchange_4'

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2024-05-02 17:54:52 +02:00
Philip Withnall
b2f27beb34
build: Enable -Wnull-dereference warning
This enables `NULL` pointer dereference checking in the compiler. This
isn’t as good as static analysis, but it should hopefully catch some
simple errors without too high a false positive rate.

If the false positive rate is too high to be useful, we can always
disable it again.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1767
2024-04-12 18:44:56 +01:00
L. E. Segovia
ffa639f0b7 glib/gthread-posix: Fix name of the futex_time64(2) test in the Meson log 2024-04-02 00:00:21 -03:00
Calvin Walton
013980d839 Use the python found by meson as the interpreter for installed scripts
The python interpreter found by `/usr/bin/env python3` is not
necessarily the same installation as the one that's found by meson's
`pymod.find_installation('python')`. This means that even though meson
is checking that the python installation it found includes the
'packaging' module, the scripts might not have access to that module
when run.

For distribution packaging, it's usually desirable to have python script
interpreters be fully specified paths, rather than use `/usr/bin/env`,
to ensure the scripts run using the expected python installation (i.e.
the one where the python 'packaging' dependency is installed).

The easiest way to fix this is to set the script interpreter to the
`full_path()` of the python interpreter found by meson. The specific
python interpreter that will be used can be selected through the use of
a meson machine file by overriding the "python" program. Many
distributions already have this set up using meson packaging helpers.
2024-03-25 15:17:59 -04:00
Philip Withnall
1c5f5a6914 Merge branch 'wip/chergert/gpoll-for-gmain' into 'main'
Use ppoll() when possible for more precise timeouts

See merge request GNOME/glib!3958
2024-03-22 00:17:21 +00:00
Christian Hergert
368cb7eb7b glib/gmain: use ppoll() when possible
If our GPollFunc is set to g_poll() then we can optionally use a poll()
alternative with higher precision. ppoll() provides poll() equivalence
but with timeouts in nanoseconds.

With more precise polling timouts, frame clocks and other timing sensitive
APIs are not restricted to a minimum of 1 millisecond timeout.
2024-03-21 23:46:20 +00:00
Philip Withnall
0cb5a86745 build: Post-release version bump
This opens up the development cycle for 2.82.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-03-20 11:54:39 +00:00
Philip Withnall
763cc3b238
2.80.0
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-03-07 21:35:05 +00:00
Philip Withnall
0d31fc6df3
2.79.3
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-27 10:11:38 +00:00
Kleis Auke Wolthuizen
72d76922dc girepository: Fix static build under Windows
Properly define `GI_STATIC_COMPILATION` when static build is enabled.
Use `library()` instead of `shared_library()` to allow selecting static builds.
2024-02-21 12:38:40 +01:00
Philip Withnall
342fa9c161
2.79.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-12 23:36:25 +00:00
Philip Withnall
a7a6b93cf6 Merge branch 'th/meson-werror-fixes-2' into 'main'
[th/meson-werror-fixes-2] more workarounds for compiler warnings in meson compiler checks

See merge request GNOME/glib!3904
2024-02-08 10:28:01 +00:00
Philip Withnall
01cf3a03c2 Merge branch 'wip/smcv/lint' into 'main'
Incorporate some lint checks into `meson test`

See merge request GNOME/glib!3898
2024-02-08 01:03:01 +00:00
Simon McVittie
d7601f7eed Incorporate some lint checks into meson test
This will make it easier and more obvious for developers to run them
locally: I'm sure I'm not the only developer who had assumed that
`.gitlab-ci/` is private to the CI environment and inappropriate (or
perhaps even destructive) to run on a developer/user system.

The lint checks are automatically skipped (with TAP SKIP syntax) if we
are not in a git checkout, or if git or the lint tool is missing. They
can also be disabled explicitly with `meson test --no-suite=lint`,
which downstream distributions will probably want to do.

By default, most lint checks are reported as an "expected failure"
(with TAP TODO syntax) rather than a hard failure, because they do not
indicate a functional problem with GLib and there is a tendency for
lint tools to introduce additional checks or become more strict over
time. Developers can override this by configuring with `-Dwerror=true`
(which also makes compiler warnings into fatal errors), or by running
the test suite like `LINT_WARNINGS_ARE_ERRORS=1 meson test --suite=lint`.

One exception to this is tests/check-missing-install-tag.py, which is
checking a functionally significant feature of our build system, and
seems like it is unlikely to have false positives: if that one fails,
it is reported as a hard failure.

run-style-check-diff.sh and run-check-todos.sh are not currently given
this treatment, because they require search-common-ancestor.sh, which
uses Gitlab-CI-specific information to find out which commits are in-scope
for checking.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-08 00:18:23 +00:00
Thomas Haller
89e85717c9 build: workaround compiler warning -Wnon-null in meson detection
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  Working directory:  /data/src/glib/build/meson-private/tmpmw16de74
  Code:
   #include <fcntl.h>
                    #include <sys/types.h>
                    #include <sys/stat.h>
                    void some_func (void) {
                      open(0, O_DIRECTORY, 0);
                    }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpmw16de74/testfile.c -o /data/src/glib/build/meson-private/tmpmw16de74/output.obj -c -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpmw16de74/testfile.c: In function 'some_func':
  /data/src/glib/build/meson-private/tmpmw16de74/testfile.c:5:21: error: argument 1 null where non-null expected [-Werror=nonnull]
      5 |                     open(0, O_DIRECTORY, 0);
        |                     ^~~~
  In file included from /usr/include/features.h:503,
                   from /usr/include/fcntl.h:25,
                   from /data/src/glib/build/meson-private/tmpmw16de74/testfile.c:1:
  /usr/include/fcntl.h:212:12: note: in a call to function 'open' declared 'nonnull'
    212 | extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
        |            ^~~~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "open() option O_DIRECTORY" compiles: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
bcb6431bff build: workaround compiler warning -Wunused-variable in meson detection
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  ...
  Command line: `cc /data/src/glib/build/meson-private/tmplkxa94er/testfile.c -o /data/src/glib/build/meson-private/tmplkxa94er/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmplkxa94er/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmplkxa94er/testfile.c:3:24: error: unused variable 'codeset' [-Werror=unused-variable]
      3 |                  char *codeset = nl_langinfo (CODESET);
        |                        ^~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "nl_langinfo and CODESET" : links: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
509e599eed build: workaround compiler warning in meson detection of nl_langinfo()
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  Working directory:  /data/src/glib/build/meson-private/tmpa3ebpbos
  Code:
   #include <langinfo.h>
                 int main (int argc, char ** argv) {
                   char *str;
                   str = nl_langinfo (PM_STR);
                   str = nl_langinfo (D_T_FMT);
                   str = nl_langinfo (D_FMT);
                   str = nl_langinfo (T_FMT);
                   str = nl_langinfo (T_FMT_AMPM);
                   str = nl_langinfo (MON_1);
                   str = nl_langinfo (ABMON_12);
                   str = nl_langinfo (DAY_1);
                   str = nl_langinfo (ABDAY_7);
                   return 0;
                 }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpa3ebpbos/testfile.c -o /data/src/glib/build/meson-private/tmpa3ebpbos/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpa3ebpbos/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmpa3ebpbos/testfile.c:3:24: error: variable 'str' set but not used [-Werror=unused-but-set-variable]
      3 |                  char *str;
        |                        ^~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "nl_langinfo (PM_STR)" : links: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
4bdadb6ccc build: workaround compiler warning in meson detection of __uint128_t
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Code:
   int main() {
  static __uint128_t v1 = 100;
  static __uint128_t v2 = 10;
  static __uint128_t u;
  u = v1 / v2;
  }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmp451h9ogd/testfile.c -o /data/src/glib/build/meson-private/tmp451h9ogd/output.obj -c -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmp451h9ogd/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmp451h9ogd/testfile.c:4:20: error: variable 'u' set but not used [-Werror=unused-but-set-variable]
      4 | static __uint128_t u;
        |                    ^
  cc1: all warnings being treated as errors
  -----------
  Checking if "__uint128_t available" compiles: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
d0afd2b783 build: drop unused variable from "C99 snprintf" meson check
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  ...
  int
  main(void)
  {
    doit();
    exit(1);
  }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c -o /data/src/glib/build/meson-private/tmp7n5yqh0h/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c: In function 'doit':
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c:10:11: error: unused variable 'args' [-Werror=unused-variable]
     10 |   va_list args;
        |           ^~~~
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c:13:33: error: '1234567' directive output truncated writing 7 bytes into a region of size 5 [-Werror=format-truncation=]
     13 |   r = snprintf(buffer, 5, "1234567");
        |                            ~~~~~^~
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c:13:7: note: 'snprintf' output 8 bytes into a destination of size 5
     13 |   r = snprintf(buffer, 5, "1234567");
        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Could not compile test file /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c: 1

  Checking if "C99 snprintf" runs: DID NOT COMPILE
2024-02-07 20:40:59 +01:00
Philip Withnall
8dee910d77 Merge branch 'th/meson-werror-fixes' into 'main'
[th/meson-werror-fixes] some fixes for meson detection failure with -Werror

See merge request GNOME/glib!3895
2024-02-07 14:26:30 +00:00
Thomas Haller
90817d0fab build: workaround meson's cc.has_member() causing compiler warning.
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails with:

  ...
  #include <sys/stat.h>
          void bar(void) {
              struct stat foo;
              foo.st_mtim.tv_nsec;

          }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpbjjq3ikp/testfile.c -o /data/src/glib/build/meson-private/tmpbjjq3ikp/output.obj -c -O3 -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpbjjq3ikp/testfile.c: In function 'bar':
  /data/src/glib/build/meson-private/tmpbjjq3ikp/testfile.c:45:24: error: statement with no effect [-Werror=unused-value]
     45 |             foo.st_mtim.tv_nsec;
        |             ~~~~~~~~~~~^~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking whether type "struct stat" has member "st_mtim.tv_nsec" : NO
2024-02-07 14:46:51 +01:00
Thomas Haller
8ea0f7d045 build: fix detection of int64_t_typedef in meson build check
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails with:

  Checking for size of "ssize_t" : 8
  Running compile:
  Working directory:  ./glib/build/meson-private/tmpgwlkasyk
  Code:
   #if defined(_AIX) && !defined(__GNUC__)
                      #pragma options langlvl=stdc99
                      #endif
                      #pragma GCC diagnostic error "-Wincompatible-pointer-types"
                      #include <stdint.h>
                      #include <stdio.h>
                      int main () {
                        int64_t i1 = 1;
                        long *i2 = &i1;
                        return 1;
                      }
  -----------
  Command line: `cc ./glib/build/meson-private/tmpgwlkasyk/testfile.c -o ./glib/build/meson-private/tmpgwlkasyk/output.obj -c -O3 -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  ./glib/build/meson-private/tmpgwlkasyk/testfile.c: In function 'main':
  ./glib/build/meson-private/tmpgwlkasyk/testfile.c:9:29: error: unused variable 'i2' [-Werror=unused-variable]
      9 |                       long *i2 = &i1;
        |                             ^~
  cc1: all warnings being treated as errors
2024-02-07 11:49:57 +01:00
Philip Withnall
9eeb8a87d3 glocalfile: Support statvfs.f_type
This is another way to get the file system type from `statvfs()`, newly
added in glibc 2.39
(https://lwn.net/ml/libc-alpha/38790850.J2Yia2DhmK@pinacolada/).

This hasn’t been tested with glibc 2.39 as I don’t have it, but the
change seems fairly straightforward.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-07 10:34:59 +00:00
Philip Withnall
3f4e6ddcd8 Merge branch 'thorough-tests-in-ci' into 'main'
build: Add thorough test setup

See merge request GNOME/glib!3838
2024-02-02 14:33:22 +00:00
Philip Withnall
5f12851312 Merge branch 'wip/oholy/libmnt_monitor' into 'main'
gunixmounts: Use libmnt_monitor API for monitoring

See merge request GNOME/glib!3845
2024-01-31 14:30:09 +00:00
Ondrej Holy
c7254fb3ad gunixmounts: Use mnt_monitor_veil_kernel option
The previous commit enabled the `/run/mount/utab` monitoring. The problem
is that the `mount-changed` signal can be emitted twice for one mount. One
for the `/proc/mounts` file change and another one for the `/run/media/utab`
file change. This is still not ideal because e.g. the `GMount` objects for
mounts with the `x-gvfs-hide` option are added and immediately removed.
Let's enable the `mnt_monitor_veil_kernel` option to avoid this.

Related: https://github.com/util-linux/util-linux/pull/2725
2024-01-31 14:53:42 +01:00