Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 May 2026 18:01:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 295086] /bin/sh undefined variable in heredoc triggers assertion
Message-ID:  <bug-295086-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295086

            Bug ID: 295086
           Summary: /bin/sh undefined variable in heredoc triggers
                    assertion
           Product: Base System
           Version: 15.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: editor@callfortesting.org

More verbose: /bin/sh undefined variable reference inside of heredoc variable
assignment inside command expansion triggers assertion

This shell script triggers an assertion that probably should be caught by the
pre-processor:

#!/bin/sh
set -u
thing="$(cat << eol)"
Hello! $_some_unset_variable
eol

Output
test.sh: _some_unset_variable: parameter not set
Unsafe ckmalloc() call
Abort trap (core dumped)

bin/sh/memalloc.c
62:             badalloc("Unsafe ckmalloc() call\n");

Verified on 15.0R, 14.x AMD64, 15.1-BETA1 ARM64

Discovered by: Alexey Laurentsyeu
Verified by: Hayzam S, Jan B, Michael D

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-295086-227>