Skip to content

run_command doesn't use the right environment variables on msys2 #14916

@moi15moi

Description

@moi15moi

Describe the bug
In msys2, if i specify run_command('./autogen.sh', check: true) in a meson.build where autogen.sh use autoreconf (ex: https://github.com/FFMS/ffms2/blob/master/autogen.sh), I get this error aclocal-1.18: error: aclocal: file '/msys64/usr/share/aclocal/progtest.m4' does not exist.

It happen because subprocess won't directly the environment variables from msys2. It will translate them to Windows path.

A good example is ACLOCAL_PATH.
If you execute a printenv from a msys2 shell, ACLOCAL_PATH will be /mingw64/share/aclocal:/usr/share/aclocal.
But, subprocess will use C:\msys64\mingw64\share\aclocal;C:\msys64\usr\share\aclocal.

parse_ACLOCAL_PATH from aclocal expect the separator to be : on cygwin/msys2, but subprocess will use ;.

So, it totally break the path when it parse it which explain the error why we get aclocal-1.18: error: aclocal: file '/msys64/usr/share/aclocal/progtest.m4' does not exist.

Expected behavior
Use the environment variable of msys2, so this error doesn't happen.

Workaround
We can simply use run_command('sh', '-l', 'autogen.sh', check: true) which fix the problem with the environment variable.
If we don't want to fix this bug, I think we should mention to use run_command('sh', '-l', 'autogen.sh', check: true) in cygwin here

system parameters
msys2 (it happen in any environnement)

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS:windowsWinodows OS specific issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions