Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Martijn Dekker Newsgroups: gnu.bash.bug Subject: [BUG] 'unset' fails silently under specific conditions Date: Tue, 1 May 2018 18:45:43 +0200 Lines: 33 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1525193155 20685 208.118.235.17 (1 May 2018 16:45:55 GMT) X-Complaints-To: action@cs.stanford.edu To: Chet Ramey , Bug reports for the GNU Bourne Again SHell Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 In-Reply-To: Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 37.59.109.123 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14070 Op 26-04-18 om 04:51 schreef Martijn Dekker: > I've also succeeded in making 'unset -v' fail silently for a variable > that is so exported, but I've so far been unable to track down a > specific reproducer that is simple enough to post here. Here is that reproducer. The following appears to be the minimum necessary to consistently make 'unset' silently fail on bash 4.2.45, 4.3.30, 4.4.19 and current git. (I confirmed the bug is *not* present on bash 4.0.38, 3.2.48, 3.1.0, 3.0.16 and 2.05b.) POSIXLY_CORRECT=y func1() { var=1 var=2 : # or 'var=2 return', or another special builtin } func2() { func1 unset -v var # bug: fails silently } func2 echo ${var+"BUG: still set"} Output: 'BUG: still set' Expected output: none It appears that it must have one function calling another, and that other function having an assignment preceding a special builtin, for 'unset' to fail silently for the variable so assigned. Thanks, - M.