git: DragonFly_RELEASE_6_4 libexec/customcc: Fix bug with the `[ -n ${X} ]` conditional

Aaron LI aly at crater.dragonflybsd.org
Tue Sep 23 23:28:30 PDT 2025


commit 53045d3c63902290ba41d98efa9f39002d685a15
Author: Aaron LI <aly at aaronly.me>
Date:   Tue Sep 23 09:12:28 2025 +0800

    libexec/customcc: Fix bug with the `[ -n ${X} ]` conditional
    
    Before this fix, command `CCVER=xxx cc --version` failed with a strange
    error:
    ```
    exec: --version: not found
    ```
    which was given by this customcc wrapper script.  The expected error
    should be:
    ```
    xxx_CC undefined, see compilers.conf(5)
    ```
    
    It turned out this was caused by the `[ -n ${X} ]` conditional: `[ -n ]`
    evaluates to *true*, while `[ -n "" ]` evaulates to *false*.
    Interestingly, both `[ -z ]` and `[ -z "" ]` evaulates to *false*.  The
    original version of this wrapper used `[ -z ${X} ]` style and it worked
    fine, but commit 571f588a5c6622ead0ed757b2884a76bb45bdb56 changed it to
    `[ -n ${X} ]` style and thus broke it.

Summary of changes:
 libexec/customcc/cc.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/53045d3c63902290ba41d98efa9f39002d685a15


-- 
DragonFly BSD source repository


More information about the Commits mailing list