[Pkg-electronics-devel] Bug#1103543: Collision of return codes by GHDL backend switching script
Paebbels
paebbels at gmail.com
Fri Apr 18 21:20:30 BST 2025
Package: ghdl
Version: 5.0.1+dfsg-1+b1
Hi,
a script was added to switch between GHDL backends.
----------------------------------------------------------------------------------
root at 4af06a855805:/# cat /usr/bin/ghdl
#!/bin/sh
set -e
backend="$GHDL_BACKEND"
bindir=$(dirname $0)
if [ ! -x "${bindir}/ghdl-$backend" ]; then
if [ -x ${bindir}/ghdl-mcode ]; then
backend=mcode
elif [ -x ${bindir}/ghdl-gcc ]; then
backend=gcc
elif [ -x ${bindir}/ghdl-llvm ]; then
backend=llvm
else
echo >&2 "Error: No installed ghdl backend found. Terminating!"
exit 2
fi
fi
exec "${bindir}/ghdl-$backend" "$@"
----------------------------------------------------------------------------------
This script creates a collision of exit codes with GHDL itself. In
addition, a VHDL simulation itself can return an integer number on
exit via std.env.stop(...);
Further problem I see with this script:
* Performance slow down in regression testing, because GHDL is called
thousand times in a script for each
ghdl -a ....; ghdl -e ....; ghdl -r .... calls. Every call will
result in starting a shell process, checking files and file
permissions.
* There is no official documentation for the environment variable.
How to you want to document it?
* The error message should report the backend used while lookup
operation. This eases debugging.
echo >&2 "Error: No installed ghdl backend '${$backend}' found. Terminating!"
Why don't you use alternatives to switch between variants?
Wasn't it created exactly for that usecase?
Is there really an overwhelming usecase of constantly switching GHDL
backende and even operating multiple backends in parallel (for regular
users), which justifies such a performance penalty?
Yes, I personally have such an environment, but I test and compile
GHDL multiple times a week and I run lot's of tests and regressions.
My environment has its own scripting to find and switch GHDL backends,
versions, etc. I don't believe a regular user needs such a feature.
Actually, I would say we have barely seen parallel installation
questions in our issue tracker since GHDL moved to GitHub 10 years
ago.
Further review notes:
It looks like the coding style tries to use ${...} variable names, but
not all variables use that style.
Kind regards
Patrick
----------------------
Some time ago, I already addressed that question without any technical
response from maintainers and related persons.
So here is an official bug report in the Debian system. Ignoring the
reported bugs in launchpad, mailing-lists etc. doesn't negate their
existence !
More information about the Pkg-electronics-devel
mailing list