diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-11-20 17:39:27 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-11-21 16:45:02 +0100 |
commit | 17cfd43e28c45626b1e0990bd0e51fdc97409ebe (patch) | |
tree | 0d71666fecf1c6c0e370cb0cca4122d588d09fa1 /l10ntools/source | |
parent | fd1b475143572655db18d2f1bc12309e3f5ab8d6 (diff) |
Avoid external processes picking up instdir/program/libxml2.so.2
...which is a problem in ASan builds, as seen with a failing `make check`:
> xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init
> xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init
> xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init
> xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init
> xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init
> Traceback (most recent call last):
> File ".../solenv/bin/uiex", line 25, in <module>
> input = check_output(["xgettext", "--add-comments", "--no-wrap", ifile, "-o", "-"], encoding="UTF-8")
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/usr/lib64/python3.11/subprocess.py", line 465, in check_output
> return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/usr/lib64/python3.11/subprocess.py", line 569, in run
> raise CalledProcessError(retcode, process.args,
> subprocess.CalledProcessError: Command '['xgettext', '--add-comments', '--no-wrap', '.../basctl/uiconfig/basicide/ui/basicmacrodialog.ui', '-o', '-']' returned non-zero exit status 127.
> Error: Failed to execute .../solenv/bin/uiex -i .../basctl/uiconfig/basicide/ui/basicmacrodialog.ui -o .../workdir//pot/basctl/messages.pot
The solution is similar to e854abe076155fc085b56549ced50b3ee9a095d2 "Avoid
external processes picking up instdir/program/libnspr4.so" used in various
tests. And as Executable_localize appears to only be called in that one place
in the recipe of `make translations`, for simplicity make the library path
override a required fourth argument for that executable.
Change-Id: Ia6326ac0bb12ea75a8b3df51f7fbf12b88aca634
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142999
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'l10ntools/source')
-rw-r--r-- | l10ntools/source/localize.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 2ec0123616f4..c5ffd6d5c060 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -46,6 +46,8 @@ namespace { +OString libraryPathEnvVarOverride; + bool matchList( std::u16string_view rUrl, const std::u16string_view* pList, size_t nLength) { @@ -89,6 +91,17 @@ void handleCommand( OStringBuffer buf; if (rExecutable == "uiex" || rExecutable == "hrcex") { +#if !defined _WIN32 + // For now, this is only needed by some Linux ASan builds, so keep it simply and disable it + // on Windows (which doesn't support the relevant shell syntax for (un-)setting environment + // variables). + auto const n = libraryPathEnvVarOverride.indexOf('='); + if (n == -1) { + buf.append("unset -v " + libraryPathEnvVarOverride + " && "); + } else { + buf.append(libraryPathEnvVarOverride + " "); + } +#endif auto const env = getenv("SRC_ROOT"); assert(env != nullptr); buf.append(env); @@ -485,16 +498,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { try { - if (argc != 3) + if (argc != 4) { std::cerr << ("localize (c)2001 by Sun Microsystems\n\n" "As part of the L10N framework, localize extracts en-US\n" "strings for translation out of the toplevel modules defined\n" "in projects array in l10ntools/source/localize.cxx.\n\n" - "Syntax: localize <source-root> <outfile>\n"); + "Syntax: localize <source-root> <outfile> <library-path-env-var-override>\n"); exit(EXIT_FAILURE); } + libraryPathEnvVarOverride = argv[3]; handleProjects(argv[1],argv[2]); } catch (std::exception& e) |