Blame SOURCES/0001-meson-set-D_GNU_SOURCE-for-updwtmpx.patch

eb421d
From 5a2d5dbdf8c6f6d3c896082a5a07b4292f5fb410 Mon Sep 17 00:00:00 2001
eb421d
From: Sam James <sam@gentoo.org>
eb421d
Date: Tue, 5 Jul 2022 01:47:35 +0100
eb421d
Subject: [PATCH 1/2] meson: set -D_GNU_SOURCE for updwtmpx
eb421d
MIME-Version: 1.0
eb421d
Content-Type: text/plain; charset=UTF-8
eb421d
Content-Transfer-Encoding: 8bit
eb421d
eb421d
Without setting GNU_SOURCE, we end up getting:
eb421d
```
eb421d
../gdm-42.0/daemon/gdm-session-record.c:200:9: error: implicit declaration of function ‘updwtmpx’; did you mean ‘updwtmp’? [-Werror=implicit-function-declaration]
eb421d
updwtmpx (GDM_NEW_SESSION_RECORDS_FILE, &session_record);
eb421d
```
eb421d
eb421d
This ended up exposing a bug in updwtmp(3) (which is now fixed
eb421d
thanks to the man-pages maintainers!) as it didn't mention that updwtmpx
eb421d
is a GNU extension (and hence needs GNU_SOURCE in order to be available).
eb421d
eb421d
Alternatively, we could just #define _GNU_SOURCE in gdm-session-record.c
eb421d
for updwtmpx.
eb421d
eb421d
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=216168
eb421d
---
eb421d
 meson.build | 3 +++
eb421d
 1 file changed, 3 insertions(+)
eb421d
eb421d
diff --git a/meson.build b/meson.build
eb421d
index 8328dd97..4a286f97 100644
eb421d
--- a/meson.build
eb421d
+++ b/meson.build
eb421d
@@ -1,44 +1,47 @@
eb421d
 project('gdm', 'c',
eb421d
   version: '40.0',
eb421d
   license: 'GPL2+',
eb421d
   meson_version: '>= 0.50',
eb421d
 )
eb421d
 
eb421d
 # Modules
eb421d
 gnome = import('gnome')
eb421d
 pkgconfig = import('pkgconfig')
eb421d
 i18n = import('i18n')
eb421d
 
eb421d
 # Compiler
eb421d
 cc = meson.get_compiler('c')
eb421d
 
eb421d
+# Use GNU extensions if available
eb421d
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
eb421d
+
eb421d
 # Options
eb421d
 gdm_prefix = get_option('prefix')
eb421d
 
eb421d
 gdmconfdir = (get_option('sysconfsubdir') == '')? gdm_prefix / get_option('sysconfdir') : gdm_prefix / get_option('sysconfdir') / get_option('sysconfsubdir')
eb421d
 dmconfdir = (get_option('dmconfdir') != '')? get_option('dmconfdir') : gdm_prefix / get_option('sysconfdir') / 'dm'
eb421d
 udev_dir = get_option('udev-dir')
eb421d
 at_spi_registryd_dir = (get_option('at-spi-registryd-dir') != '')? get_option('at-spi-registryd-dir') : gdm_prefix / get_option('libexecdir')
eb421d
 lang_config_file = (get_option('lang-file') != '')? get_option('lang-file') : gdm_prefix / get_option('sysconfdir') / 'locale.conf'
eb421d
 pam_mod_dir = (get_option('pam-mod-dir') != '')? get_option('pam-mod-dir') : gdm_prefix / get_option('libdir') / 'security'
eb421d
 dbus_sys_dir = (get_option('dbus-sys') != '')? get_option('dbus-sys') : get_option('sysconfdir') / 'dbus-1' / 'system.d'
eb421d
 gdm_defaults_conf = (get_option('defaults-conf') != '')? get_option('defaults-conf') : gdm_prefix / get_option('datadir') / 'gdm' / 'defaults.conf'
eb421d
 gdm_custom_conf = (get_option('custom-conf') != '')? get_option('custom-conf') : gdmconfdir / 'custom.conf'
eb421d
 gnome_settings_daemon_dir = (get_option('gnome-settings-daemon-dir') != '')? get_option('gnome-settings-daemon-dir') : gdm_prefix / get_option('libexecdir')
eb421d
 gdm_run_dir = (get_option('run-dir') != '')? get_option('run-dir') : gdm_prefix / get_option('localstatedir') / 'run' / 'gdm'
eb421d
 gdm_runtime_conf = (get_option('runtime-conf') != '')? get_option('runtime-conf') : gdm_run_dir / 'custom.conf'
eb421d
 gdm_pid_file = (get_option('pid-file') != '')? get_option('pid-file') : gdm_run_dir / 'gdm.pid'
eb421d
 ran_once_marker_dir = (get_option('ran-once-marker-dir') != '')? get_option('ran-once-marker-dir') : gdm_run_dir
eb421d
 working_dir = (get_option('working-dir') != '')? get_option('working-dir') : gdm_prefix / get_option('localstatedir') / 'lib' / 'gdm'
eb421d
 gdm_xauth_dir = (get_option('xauth-dir') != '')? get_option('xauth-dir') : gdm_run_dir
eb421d
 gdm_screenshot_dir = (get_option('screenshot-dir') != '')? get_option('screenshot-dir') : gdm_run_dir / 'greeter'
eb421d
 
eb421d
 # Common variables
eb421d
 config_h_dir = include_directories('.')
eb421d
 
eb421d
 # Dependencies
eb421d
 udev_dep = dependency('udev')
eb421d
 
eb421d
 glib_min_version = '2.56.0'
eb421d
 
eb421d
 glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
eb421d
-- 
eb421d
2.31.1
eb421d