chiark / gitweb /
meson: don't search PATH for telinit (#7770)
authorMike Gilbert <floppymaster@gmail.com>
Thu, 4 Jan 2018 12:14:20 +0000 (07:14 -0500)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:49 +0000 (07:49 +0200)
On a typical system running systemd, the telinit in PATH is very likely to be a symlink
to systemctl. Setting TELINIT to this may result in an infinite recursion if telinit is called
and sd_booted() == 0. This may commonly occur in a chroot environment.

Bug: https://bugs.gentoo.org/642724

[zj:
The path was originally hardcoded as "/lib/upstart/telinit", but was made configurable without
changing the default in 4ad61fd1806dde23d2c99043b4bed91a196d2c82. Then the default was
changed to `/lib/sysvinit/telinit` in abaaabf40a9891014ed4c402d7beb5a67ac256b1. Then it
started being  autodetected when meson support was added in
5c23128daba7236a6080383b2a5649033cfef85c. This patch restores the behaviour that was
implemented in configure.ac at the time of its removal.]

meson.build
meson_options.txt

index 93b27be19c3b1e3b7d1eebe9d0a635fc621c987c..e0e1f84782fc5f1de132bcbf837b0f7b5ba155cf 100644 (file)
@@ -486,7 +486,7 @@ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
                 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
                 ['IFLA_VRF_TABLE',                   'linux/if_link.h'],
                 ['IFLA_MACVLAN_FLAGS',               'linux/if_link.h'],
-                ['IFLA_IPVLAN_MODE',                 'linux/if_link.h'],
+                ['IFLA_IPVLAN_FLAGS',                'linux/if_link.h'],
                 ['IFLA_PHYS_PORT_ID',                'linux/if_link.h'],
                 ['IFLA_BOND_AD_INFO',                'linux/if_link.h'],
                 ['IFLA_VLAN_PROTOCOL',               'linux/if_link.h'],
@@ -501,6 +501,7 @@ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
                 ['IFLA_BRPORT_PROXYARP',             'linux/if_link.h'],
                 ['IFLA_BRPORT_LEARNING_SYNC',        'linux/if_link.h'],
                 ['IFLA_BR_VLAN_DEFAULT_PVID',        'linux/if_link.h'],
+                ['IPVLAN_F_PRIVATE',                 'linux/if_link.h'],
                 ['NDA_IFINDEX',                      'linux/neighbour.h'],
                 ['IFA_FLAGS',                        'linux/if_addr.h'],
                 ['FRA_UID_RANGE',                    'linux/fib_rules.h'],
@@ -517,17 +518,17 @@ foreach ident : ['secure_getenv', '__secure_getenv']
 endforeach
 
 foreach ident : [
-        ['memfd_create',      '''#define _GNU_SOURCE
-//                                 #include <sys/mman.h>'''],
-        ['gettid',            '''#include <sys/types.h>'''],
-        ['pivot_root',        '''#include <stdlib.h>'''],     # no known header declares pivot_root
-        ['name_to_handle_at', '''#define _GNU_SOURCE
-//                                 #include <sys/types.h>
+        ['memfd_create',      '''#include <sys/mman.h>'''],
+        ['gettid',            '''#include <sys/types.h>
+//                                 #include <unistd.h>'''],
+        ['pivot_root',        '''#include <stdlib.h>
+                                 #include <unistd.h>'''],     # no known header declares pivot_root
+        ['name_to_handle_at', '''#include <sys/types.h>
                                  #include <sys/stat.h>
                                  #include <fcntl.h>'''],
-        ['setns',             '''#define _GNU_SOURCE
-//                                 #include <sched.h>'''],
-        ['renameat2',         '''#include <stdio.h>'''],
+        ['setns',             '''#include <sched.h>'''],
+        ['renameat2',         '''#include <stdio.h>
+//                                 #include <fcntl.h>'''],
         ['kcmp',              '''#include <linux/kcmp.h>'''],
         ['keyctl',            '''#include <sys/types.h>
                                  #include <keyutils.h>'''],
@@ -538,11 +539,11 @@ foreach ident : [
         ['explicit_bzero' ,   '''#include <string.h>'''],
 ]
 
-        have = cc.has_function(ident[0], prefix : ident[1])
+        have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
         conf.set10('HAVE_' + ident[0].to_upper(), have)
 endforeach
 
-if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
+if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
         conf.set10('USE_SYS_RANDOM_H', true)
         conf.set10('HAVE_GETRANDOM', true)
 else
@@ -572,8 +573,7 @@ mkdir_p = 'mkdir -p $DESTDIR/@0@'
 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
 # /usr/sbin, /sbin, and fall back to the default from middle column.
 #if 0 /// elogind has a bit different list and some adaptions
-# progs = [['telinit',    '/lib/sysvinit/telinit'],
-#          ['quotaon',    '/usr/sbin/quotaon'    ],
+# progs = [['quotaon',    '/usr/sbin/quotaon'    ],
 #          ['quotacheck', '/usr/sbin/quotacheck' ],
 #          ['kill',       '/usr/bin/kill'        ],
 #          ['kmod',       '/usr/bin/kmod'        ],
@@ -606,6 +606,8 @@ foreach prog : progs
         substs.set(name, path)
 endforeach
 
+conf.set_quoted('TELINIT', get_option('telinit-path'))
+
 if run_command('ln', '--relative', '--help').returncode() != 0
         error('ln does not support --relative')
 endif
@@ -2796,6 +2798,8 @@ install_data('README',
 #endif // 0
              'LICENSE.GPL2',
              'LICENSE.LGPL2.1',
+             'TRANSIENT-SETTINGS.md',
+             'UIDS-GIDS.md',
              'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
              install_dir : docdir)
 
index 4e2f472d6a13fdde53573bb450406f0d8ae084c4..aba8d1c20689f45af72575001f6a67932050bbee 100644 (file)
@@ -30,7 +30,8 @@ option('rootprefix', type : 'string',
 #        description : 'the directory where the SysV init scripts are located')
 # option('sysvrcnd-path', type : 'string', value : '/etc/rc.d',
 #        description : 'the base directory for SysV rcN.d directories')
-# option('telinit-path', type : 'string', description : 'path to telinit')
+# option('telinit-path', type : 'string', value : '/lib/sysvinit/telinit',
+#        description : 'path to telinit')
 # option('rc-local', type : 'string',
 #        value : '/etc/rc.local')
 # option('halt-local', type : 'string',