Path: csiph.com!fu-berlin.de!usenet.stanford.edu!not-for-mail From: Great Big Dot Newsgroups: gnu.bash.bug Subject: Re: The builtin array variable 'FUNCNAME' is considered unset by many expansions, even when set. Date: Thu, 8 Nov 2018 10:28:28 -0500 Lines: 37 Approved: bug-bash@gnu.org Message-ID: References: <6f4639e1-b55c-1d48-94b6-b6d425401ace@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1541690949 11070 208.118.235.17 (8 Nov 2018 15:29:09 GMT) X-Complaints-To: action@cs.stanford.edu To: chet.ramey@case.edu, bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=zF3f05NBRGHngBXbPEqPe+kSPwNX321TjXrevgz2q3s=; b=Du/2nuLCJ0im9QyAm2cw7S4bkRviMmFxoMBjfLmHKpcIvJvRAKtR1Bm2q6qh/lApNV pWFoPQllwxF3M/ReYQMpG2SdYSMELnXqE03f5SnzEdwb3gsUzgldKURI4WtjWSwGzUXm d2XHhhcLaljfPLLvyoi3vwOtCeYmfiuaVkIUrdgjJpl2z4j9QGhEMhm/UNpziwoNF2t6 kv0wUE3lPKm83dMRtIIm46po+MN1wYOyUL3ISf5BitDM4fqIktVDXC8bYZvNKm07sGkp cnTP4oOPMw9YA0nm49waTQH0v9LHA+DiODpDK2zeHr0DKL4L8AX4otemlElTCVe5NODJ 0pWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=zF3f05NBRGHngBXbPEqPe+kSPwNX321TjXrevgz2q3s=; b=p3+ao3WbGPlxITktZ35D6fnoOWnkRO5NhGxoSPiZPkOWeCbuftQaFOHjh4DJ8sAa4V ccVDgIZ0YGfwLUeZq1aLg0jxBt/kw3Rdr5UhuuHh5WjgTuIwgmk0+6IGj9KXZGocU9kQ it/26DSJ69iZsBwPkxeXpEDuduCCaP1kCkv396eMbLPDOo/rdHkphu7sY6H8Ry9mjb8o QkOXMWTzS/suE8NNfHMSkaawNV1kOLIqJtBAabYQXo+Z22bIndUFtt1QE/Pzj+KUZy0+ 6e0KSDseUfRwswOr7rBM7pc8zQYF42uUKDFOX8C6pm0YxCSe2FXGdTAaystV0UiCovJ/ 9fBA== X-Gm-Message-State: AGRZ1gL7eZEtYDQLU9dUIS1a6L2YEcdU1soL7wRGe0MafDoknCOB5tyZ bnjdZlPZbrNMcQO0dDEt65dhLOPIDyNLoaa0Wqk= X-Google-Smtp-Source: AJdET5dPmrtTEkbFILw26zCZYVoSmR0ICJ1Y0A5zQ6QFtn+kxCGya6WuXFgswDKuN8RJ2pw1CCE4sOCToXet1+OC7jk= X-Received: by 2002:a2e:59ca:: with SMTP id g71-v6mr3204469ljf.79.1541690923443; Thu, 08 Nov 2018 07:28:43 -0800 (PST) In-Reply-To: <6f4639e1-b55c-1d48-94b6-b6d425401ace@case.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::235 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 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:14779 > It should expand to the empty string in all these cases. Oh yeah, right, because a function isn't even running. Duh. All my comments about expected behavior should be inverted, then, I guess. Out of curiosity, do you have any idea what's causing bash to *sometimes* correctly conclude that FUNCNAME[0] is empty and other times that FUNCNAME[*] is empty, under seemingly arbitrary circumstances? I can't figure out what could be causing that. On Thu, Nov 8, 2018 at 9:57 AM Chet Ramey wrote: > On 11/8/18 1:15 AM, Great Big Dot wrote: > > > Bash Version: 4.4 > > Patch Level: 23 > > Release Status: release > > > > Description: > > The builtin array variable FUNCNAME (which provides a way to trace the > > stack of functions called so far) appears to be unset according to > certain > > bash expansions, even when it isn't. If the following code is saved to a > > file and executed (this doesn't work at the command line), the problems > > begin to appear: > > > > printf -- '%q\n' "${FUNCNAME}" > > printf -- '%q\n' "${FUNCNAME[0]}" > > printf -- '%q\n' "${FUNCNAME[*]}" > > Thanks for the report. It should expand to the empty string in all these > cases. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/ >