Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2018 12:49:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 232201] sh(1): Using unset variables in here-doc with set -u does not cause the script to exit
Message-ID:  <bug-232201-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D232201

            Bug ID: 232201
           Summary: sh(1): Using unset variables in here-doc with set -u
                    does not cause the script to exit
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: 0mp@FreeBSD.org

The output of sh(1) from the base and of dash from the ports (shells/dash) =
is
different.

Here's the script to reproduce this issue:

```
#! /bin/sh -

set -u

# Unset variable.
cat << EOF > /dev/null && echo ok || echo error
$unsetvar
EOF
```

Output of `sh test.sh`:

> testcase-2.sh: unsetvar: parameter not set
> ok

Output of `dash test.sh`:

> testcase-2.sh: 6: testcase-2.sh: unsetvar: parameter not set
> error

I'm running sh(1) from 12.0-ALPHA6 r338797 and dash 0.5.10.2 from ports.

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



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