[Bug 233545] bin/sh: "export VAR" always defines VAR unlike other shells

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Nov 26 22:59:03 UTC 2018


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

Jilles Tjoelker <jilles at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugs at FreeBSD.org
           Assignee|bugs at FreeBSD.org            |jilles at FreeBSD.org
             Status|New                         |Open

--- Comment #2 from Jilles Tjoelker <jilles at FreeBSD.org> ---
Good catch. It somewhat surprises me that this has been broken for so long.

The environment() part of the patch looks good, but the exportcmd() part is
redundant since setvar() already sets VUNSET if the value to be set is NULL
(something like  sh -uc 'export thisshouldnotbehere; echo
"$thisshouldnotbehere"'  detects the unset variable as it should). Also, a test
should be added, preferably using env(1) or ${SH} itself only and not
printenv(1) since it's not in POSIX.

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


More information about the freebsd-bugs mailing list