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

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