NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/49595: unset built-in exits with failure if parameter not set
The following reply was made to PR bin/49595; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/49595: unset built-in exits with failure if parameter not set
Date: Mon, 10 Oct 2016 01:13:00 +0000
On Thu, Jan 22, 2015 at 04:10:00AM +0000, william%25thandclement.com@localhost wrote:
> NetBSD's /bin/sh is the only shell with this behavior I've
> found. I've tested /bin/sh on AIX 7, Solaris 11.1, OpenBSD 5.5, OS
> X 10.2 (BETA), FreeBSD 9.0, and Ubuntu 14.04.
>
> I suppose one could interpret NetBSD's behavior as conforming. But
> I find it leads to unnecessarily complex code like `unset FOO ||
> true` or `[ "${FOO-unset}" = "unset" ] || unset FOO`
>
> >How-To-Repeat:
> Following script should print "OK".
>
> #!/bin/sh
> FOO=bar
> unset FOO
> set -e
> unset FOO
> printf "OK\n"
ok, all this is about sh, but...
> >Fix:
> Remove the following from c_unset in ksh/c_sh.c:
>
> if (!(vp->flag & ISSET))
> ret = 1;
...that's about ksh.
So are you talking about sh or ksh? Currently, sh does not exhibit
this behavior, but ksh does.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index