postgres.git / summary / log / commit / refs

commit    294685dcc1b791b7d36030e3314f139fd3a7d012
Author:   Andrew Dunstan <andrew@dunslane.net>
Date:     Mon Jul 13 14:50:54 2026 +0000
First released in: 16.16, 17.12, 18.7, 19.0

    meson: Avoid PATH bloat from NLS .mo targets in tmp_install test
    
    On Windows, meson adds the build directory of every target in a test's
    'depends:' to that test's PATH.  tmp_install depended on
    installed_targets, which with NLS enabled includes several hundred .mo
    targets, pushing PATH past the Windows length limit.  tmp_install and
    initdb_cache then failed with no output.
    
    Fix by depending on a stamp custom_target that itself depends on
    installed_targets.  Meson doesn't walk a custom_target's dependencies
    when building the test PATH, so this adds at most one entry.  This can
    be removed once we mandate a meson version containing the upstream fix
    (expected in 1.13).
    
    Reviewed-by: Tristan Partin <tristan@partin.io>
    Backpatch-through: 16
    Discussion: https://postgr.es/m/CAD5tBcJXAX8bz5q9ngE4znvVLiXaPO89D0yTFhJgEPrPyT-Erw@mail.gmail.com


meson.build | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6949fafefa8..6b86a7684c8 100644 --- a/meson.build +++ b/meson.build @@ -3268,13 +3268,30 @@ meson_install_args = meson_args + ['install'] + { # setup tests should be run first, # so define priority for these setup_tests_priority = 100 + +# Depend on a single stamp custom_target rather than on installed_targets +# directly. On Windows, meson adds the build directory of every target in a +# test's 'depends:' to the test's PATH, and with NLS enabled installed_targets +# includes hundreds of per-locale .mo targets, pushing PATH past the Windows +# length limit. A custom_target's own dependencies are not walked for this +# purpose, so the stamp adds at most one entry, while still forcing +# installed_targets to be built first. This indirection can be removed once +# we mandate a meson version with the upstream fix +# (https://github.com/mesonbuild/meson/pull/16039, expected in 1.13). +installed_targets_stamp = custom_target('installed-targets-stamp', + output: 'installed-targets-stamp', + command: [python, '-c', 'pass'], + depends: installed_targets, + build_always_stale: true, +) + test('tmp_install', meson_bin, args: meson_install_args , env: {'DESTDIR':test_install_destdir}, priority: setup_tests_priority, timeout: 300, is_parallel: false, - depends: installed_targets, + depends: installed_targets_stamp, suite: ['setup']) test('install_test_files', [parent: a2732c98671d]