
Comparisson of different signedness can result in unexpected results due to implicit conversions. ../network.c:81:34: warning: comparison of integer expressions of different signedness: ‘__u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] 81 | if (rheader->nlmsg_seq != seq_nr) | ^~ ../network.c:83:34: warning: comparison of integer expressions of different signedness: ‘__u32’ {aka ‘unsigned int’} and ‘__pid_t’ {aka ‘int’} [-Wsign-compare] 83 | if (rheader->nlmsg_pid != getpid ()) | ^~ ../bind-mount.c:268:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 268 | assert (i < n_lines); | ^ ../bind-mount.c:309:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 309 | assert (i == n_lines); | ^~ ../bind-mount.c:318:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 318 | for (i = 0; i < n_lines; i++) | ^ ../bind-mount.c:321:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 321 | for (i = 0; i < n_lines; i++) | ^ ../utils.c:818:19: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘ssize_t’ {aka ‘long int’} [-Wsign-compare] 818 | while (size - 2 < n); | ^ ../bubblewrap.c:489:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 489 | assert (j < sizeof(dont_close)/sizeof(*dont_close)); | ^ ../bubblewrap.c:994:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uid_t’ {aka ‘unsigned int’} [-Wsign-compare] 994 | if (setfsuid (-1) != real_uid) | ^~ ../bubblewrap.c:1042:61: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 1042 | if (write (privileged_op_socket, buffer, buffer_size) != buffer_size) | ^~ ../bubblewrap.c:1232:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 1232 | for (i = 0; i < N_ELEMENTS (cover_proc_dirs); i++) | ^ ../bubblewrap.c:1260:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 1260 | for (i = 0; i < N_ELEMENTS (devnodes); i++) | ^ ../bubblewrap.c:1272:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 1272 | for (i = 0; i < N_ELEMENTS (stdionodes); i++) | ^ ../bubblewrap.c: In function ‘read_priv_sec_op’: ../bubblewrap.c:1556:15: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare] 1556 | if (rec_len < sizeof (PrivSepOp)) | ^ ../bubblewrap.c:1626:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 1626 | if (*total_parsed_argc_p > MAX_ARGS) | ^ ../bubblewrap.c:1681:40: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 1681 | if (*total_parsed_argc_p > MAX_ARGS) | ^ ../bubblewrap.c:2265:31: warning: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] 2265 | if (opt_sandbox_uid != -1) | ^~ ../bubblewrap.c:2285:31: warning: comparison of integer expressions of different signedness: ‘gid_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] 2285 | if (opt_sandbox_gid != -1) | ^~ ../bubblewrap.c:2678:23: warning: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] 2678 | if (opt_sandbox_uid == -1) | ^~ ../bubblewrap.c:2680:23: warning: comparison of integer expressions of different signedness: ‘gid_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] 2680 | if (opt_sandbox_gid == -1) | ^~ Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
172 lines
4.2 KiB
Meson
172 lines
4.2 KiB
Meson
project(
|
|
'bubblewrap',
|
|
'c',
|
|
version : '0.8.0',
|
|
meson_version : '>=0.49.0',
|
|
default_options : [
|
|
'warning_level=2',
|
|
],
|
|
)
|
|
|
|
cc = meson.get_compiler('c')
|
|
add_project_arguments('-D_GNU_SOURCE', language : 'c')
|
|
common_include_directories = include_directories('.')
|
|
|
|
# Keep this in sync with ostree, except remove -Wall (part of Meson
|
|
# warning_level 2) and -Werror=declaration-after-statement
|
|
add_project_arguments(
|
|
cc.get_supported_arguments([
|
|
'-Werror=shadow',
|
|
'-Werror=empty-body',
|
|
'-Werror=strict-prototypes',
|
|
'-Werror=missing-prototypes',
|
|
'-Werror=implicit-function-declaration',
|
|
'-Werror=pointer-arith',
|
|
'-Werror=init-self',
|
|
'-Werror=missing-declarations',
|
|
'-Werror=return-type',
|
|
'-Werror=overflow',
|
|
'-Werror=int-conversion',
|
|
'-Werror=parenthesis',
|
|
'-Werror=incompatible-pointer-types',
|
|
'-Werror=misleading-indentation',
|
|
'-Werror=missing-include-dirs',
|
|
'-Werror=aggregate-return',
|
|
|
|
# Extra warnings specific to bubblewrap
|
|
'-Werror=switch-default',
|
|
'-Wswitch-enum',
|
|
|
|
# Deliberately not warning about these, ability to zero-initialize
|
|
# a struct is a feature
|
|
'-Wno-missing-field-initializers',
|
|
'-Wno-error=missing-field-initializers',
|
|
]),
|
|
language : 'c',
|
|
)
|
|
|
|
if (
|
|
cc.has_argument('-Werror=format=2')
|
|
and cc.has_argument('-Werror=format-security')
|
|
and cc.has_argument('-Werror=format-nonliteral')
|
|
)
|
|
add_project_arguments([
|
|
'-Werror=format=2',
|
|
'-Werror=format-security',
|
|
'-Werror=format-nonliteral',
|
|
], language : 'c')
|
|
endif
|
|
|
|
bash = find_program('bash', required : false)
|
|
|
|
if get_option('python') == ''
|
|
python = find_program('python3')
|
|
else
|
|
python = find_program(get_option('python'))
|
|
endif
|
|
|
|
libcap_dep = dependency('libcap', required : true)
|
|
|
|
selinux_dep = dependency(
|
|
'libselinux',
|
|
version : '>=2.1.9',
|
|
# if disabled, Meson will behave as though libselinux was not found
|
|
required : get_option('selinux'),
|
|
)
|
|
|
|
cdata = configuration_data()
|
|
cdata.set_quoted(
|
|
'PACKAGE_STRING',
|
|
'@0@ @1@'.format(meson.project_name(), meson.project_version()),
|
|
)
|
|
|
|
if selinux_dep.found()
|
|
cdata.set('HAVE_SELINUX', 1)
|
|
if selinux_dep.version().version_compare('>=2.3')
|
|
cdata.set('HAVE_SELINUX_2_3', 1)
|
|
endif
|
|
endif
|
|
|
|
if get_option('require_userns')
|
|
cdata.set('ENABLE_REQUIRE_USERNS', 1)
|
|
endif
|
|
|
|
configure_file(
|
|
output : 'config.h',
|
|
configuration : cdata,
|
|
)
|
|
|
|
if meson.is_subproject() and get_option('program_prefix') == ''
|
|
error('program_prefix option must be set when bwrap is a subproject')
|
|
endif
|
|
|
|
if get_option('bwrapdir') != ''
|
|
bwrapdir = get_option('bwrapdir')
|
|
elif meson.is_subproject()
|
|
bwrapdir = get_option('libexecdir')
|
|
else
|
|
bwrapdir = get_option('bindir')
|
|
endif
|
|
|
|
bwrap = executable(
|
|
get_option('program_prefix') + 'bwrap',
|
|
[
|
|
'bubblewrap.c',
|
|
'bind-mount.c',
|
|
'network.c',
|
|
'utils.c',
|
|
],
|
|
build_rpath : get_option('build_rpath'),
|
|
install : true,
|
|
install_dir : bwrapdir,
|
|
install_rpath : get_option('install_rpath'),
|
|
dependencies : [selinux_dep, libcap_dep],
|
|
)
|
|
|
|
manpages_xsl = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
|
|
xsltproc = find_program('xsltproc', required : get_option('man'))
|
|
build_man_page = false
|
|
|
|
if xsltproc.found() and not meson.is_subproject()
|
|
if run_command([
|
|
xsltproc, '--nonet', manpages_xsl,
|
|
], check : false).returncode() == 0
|
|
message('Docbook XSL found, man page enabled')
|
|
build_man_page = true
|
|
elif get_option('man').enabled()
|
|
error('Man page requested, but Docbook XSL stylesheets not found')
|
|
else
|
|
message('Docbook XSL not found, man page disabled automatically')
|
|
endif
|
|
endif
|
|
|
|
if build_man_page
|
|
custom_target(
|
|
'bwrap.1',
|
|
output : 'bwrap.1',
|
|
input : 'bwrap.xml',
|
|
command : [
|
|
xsltproc,
|
|
'--nonet',
|
|
'--stringparam', 'man.output.quietly', '1',
|
|
'--stringparam', 'funcsynopsis.style', 'ansi',
|
|
'--stringparam', 'man.th.extra1.suppress', '1',
|
|
'--stringparam', 'man.authors.section.enabled', '0',
|
|
'--stringparam', 'man.copyright.section.enabled', '0',
|
|
'-o', '@OUTPUT@',
|
|
manpages_xsl,
|
|
'@INPUT@',
|
|
],
|
|
install : true,
|
|
install_dir : get_option('mandir') / 'man1',
|
|
)
|
|
endif
|
|
|
|
if not meson.is_subproject()
|
|
subdir('completions')
|
|
endif
|
|
|
|
if get_option('tests')
|
|
subdir('tests')
|
|
endif
|