1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

meson: strip various strings before converting them to integers

"9\n" is not intrinsically a number, although some tools might
auto-strip strings before checking if they are a number. It's not
guaranteed, anyway.
This commit is contained in:
Eli Schwartz 2022-07-26 21:13:55 -04:00 committed by Yu Watanabe
parent 6c8892828c
commit 89cdbe1f08

View File

@ -813,7 +813,7 @@ if time_epoch <= 0
time_epoch = run_command(stat, '-c', '%Y', NEWS,
check : true).stdout()
endif
time_epoch = time_epoch.to_int()
time_epoch = time_epoch.strip().to_int()
endif
conf.set('TIME_EPOCH', time_epoch)
@ -874,7 +874,7 @@ if not meson.is_cross_build()
endif
id_result = run_command('id', '-u', nobody_user, check : false)
if id_result.returncode() == 0
id = id_result.stdout().to_int()
id = id_result.stdout().strip().to_int()
if id != 65534
warning('\n' +
'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
@ -893,7 +893,7 @@ if not meson.is_cross_build()
endif
id_result = run_command('id', '-g', nobody_group, check : false)
if id_result.returncode() == 0
id = id_result.stdout().to_int()
id = id_result.stdout().strip().to_int()
if id != 65534
warning('\n' +
'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) +