[From nobody Sun Apr 19 12:03:06 2026
Received: (at submit) by bugs.debian.org; 18 Apr 2025 20:20:49 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.6-bugs.debian.org_2005_01_02
 (2021-04-09) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-15.1 required=4.0 tests=BAYES_00,
 BODY_INCLUDES_PACKAGE,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,
 DKIM_VALID_EF,FOURLA,FREEMAIL_FROM,HAS_PACKAGE,RCVD_IN_DNSWL_NONE,
 SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no
 version=3.4.6-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 42; hammy, 148; neutral, 104; spammy,
 2. spammytokens:0.951-+--our, 0.948-+--thousand
 hammytokens:0.000-+--dfsg-1, 0.000-+--bindir, 0.000-+--dfsg1,
 0.000-+--mailinglists, 0.000-+--regressions
Return-path: &lt;paebbels@gmail.com&gt;
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:42305)
 by buxtehude.debian.org with esmtps
 (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128)
 (Exim 4.94.2) (envelope-from &lt;paebbels@gmail.com&gt;)
 id 1u5sCf-0082iT-06
 for submit@bugs.debian.org; Fri, 18 Apr 2025 20:20:49 +0000
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-5f63ac6ef0fso442929a12.1
 for &lt;submit@bugs.debian.org&gt;; Fri, 18 Apr 2025 13:20:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1745007643; x=1745612443; darn=bugs.debian.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=DwHBzefCaT3dg1IP4sE/yJ8XxfhTlAcX0ryCKR10qOA=;
 b=E87CvBrouxmn3dIt6guuex0UAZMzM05ziAc7bvsCPWzP+sDNG5c1szY0R7eYEssN9l
 fyk+1Adefr2w/E/bgxu8gLKSbC5ao1t/BID7WkXGJz8pq9F3nf3z4+foo3xOENxquv2r
 mevmN+4VRuhfapLBrdU2BkIq20WbiadTe1NBU2U57vE7S5Kfgli2uXmewRkgQbRZOw7r
 AWbhqy83ykNTpAkYtzDg5Dz98ag2TePvxUgADun2OrRw1x5IBDy8DFe+pGj99fI/Y+UE
 +8w01RVmTDAJmFEfVA0FCI9isIOSvAjBAA4WG4KD/sYVkXvbC13JQWUDCxYlu9y+zgab
 u5gQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1745007643; x=1745612443;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=DwHBzefCaT3dg1IP4sE/yJ8XxfhTlAcX0ryCKR10qOA=;
 b=ENNdWR6mIMTLEtQy8IATnoXnBkHqZVw+auwWGF3+mPAYfkGdE0UhP7YKMCUWO03RVD
 1QN310FhUQCMLNGfKpNQjEbMsZv0Yx+JI/CRyQjfBIilcZbVgx7KZHajHr32CpOQ0UxA
 4y/pmKYFq9LNWzj395mz2I9kbp7WBwzspZwPXli0Z5VsT0Ise3Ms+q2jDQ5ySc5Y4J/v
 PP1fxTgUBNCgQE7viVYe8YQCXFS/p1jA3HWP1OsvT6e4pkGb2dyOmMYVb/+kq0CYLVnU
 ZTWu2804mJMx7jeVFG7q31A/BThgiujMUh+X2Z5faspPHW4E1dvC3L/gezmxbO+hRhzO
 Lp1A==
X-Gm-Message-State: AOJu0Yx0Ay2e0/vBkbR6LwZr/4EVnV8z0L/Vltd8gAng7Z58EBPtMLQm
 NPqCiTzJ9aO0HQENoUeBTvb88LoZ97r9aDKt2mOo1PHTFXF1snv62OClIb9xw3GaZMQF1IKi7h8
 qty2L2Te1Xa7KEvBlekqorAhrmajdlySM5XI=
X-Gm-Gg: ASbGncvado2vIte9f5hw0ZoOs8lnt8gGW24UCO8MwnykLk/xlxivfHTsvs8MWCgu4iS
 KUIHGWnQypD6knjzPLjQSaL7dNlQRyxfJ3kyR9vIlmSv8cLFIqTbOSdk/THHkXK14XPDd5o1sR2
 o1ZmozrDHFP7bf5yu5jAI4BKwKFotNtSLdR9wwpCd/mNyqFuicdtvt9aJ4xNn6n37Q
X-Google-Smtp-Source: AGHT+IGMKqHVQHxBgnT3/YOv0jbjzddwE2qXqpC/0v8NMu9dvep6BVLOZuKh5B25kWKKlsk+Z3FDrj9gtU5l7MIh+z0=
X-Received: by 2002:a05:6402:280d:b0:5e4:95fc:d748 with SMTP id
 4fb4d7f45d1cf-5f6239dca2emr4131578a12.5.1745007642843; Fri, 18 Apr 2025
 13:20:42 -0700 (PDT)
MIME-Version: 1.0
From: Paebbels &lt;paebbels@gmail.com&gt;
Date: Fri, 18 Apr 2025 22:20:30 +0200
X-Gm-Features: ATxdqUEwl_CkmYVo98p9WUS-NMim0OZNNSDfFLLEp_xBhuFpf1THNmjD-2qCceY
Message-ID: &lt;CAMnwGqa=mvZM8q015XhG1-i7N-QT3NDq+FxirFAigWsnJcaUAg@mail.gmail.com&gt;
Subject: Collision of return codes by GHDL backend switching script
To: submit@bugs.debian.org
Content-Type: text/plain; charset=&quot;UTF-8&quot;
Delivered-To: submit@bugs.debian.org

Package: ghdl
Version: 5.0.1+dfsg-1+b1

Hi,

a script was added to switch between GHDL backends.
----------------------------------------------------------------------------------
root@4af06a855805:/# cat /usr/bin/ghdl
#!/bin/sh
set -e

backend=&quot;$GHDL_BACKEND&quot;
bindir=$(dirname $0)

if [ ! -x &quot;${bindir}/ghdl-$backend&quot; ]; 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 &gt;&amp;2 &quot;Error: No installed ghdl backend found. Terminating!&quot;
                exit 2
        fi
fi

exec &quot;${bindir}/ghdl-$backend&quot; &quot;$@&quot;
----------------------------------------------------------------------------------

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 &gt;&amp;2 &quot;Error: No installed ghdl backend '${$backend}' found. Terminating!&quot;

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 !
]