Skip to content

Unscoped GHDL environment variable causes ghdl failure #1149

@sigmuha

Description

@sigmuha

OS: Windows 11
vunit-version: 4.7.0, 5.0.0dev6

Issue

In my build system I have a script that calls VUnit, which set up multiple environment variables, like toolchain paths etc. For ghdl it was GHDL. This causes an environment variable override in vunit/sim_if/ghdl.py line 35:

executable = environ.get("GHDL", "ghdl")

This caused the simulation to fail, as the attempted ghdl path was mangled when trying to find the ghdl version:

    output = cls._get_version_output(prefix)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<project_path>\.venv\Lib\site-packages\vunit\sim_if\ghdl.py", line 135, in _get_version_output
    return subprocess.check_output(temp).decode()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python312\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [WinError 5] Access is denied

Proposed fix

The root issue is that GHDL is an overly generic environment variable. A better name would use a VUNIT_, or similar prefix, and even specifying its purpose like _EXECUTABLE_NAME or similar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions