Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14778
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Great Big Dot <greatbigdot@gmail.com> |
| 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:19:55 -0500 |
| Lines | 52 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.3653.1541690420.1284.bug-bash@gnu.org> (permalink) |
| References | <CAN6vQO8zM7DwE2ftcy2vRTKQxPAKrf9LaQ3EPfaNRGpVjdg+zg@mail.gmail.com> <20181108132705.7xgw4gyxmzwhspk4@eeg.ccf.org> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1541690421 10481 208.118.235.17 (8 Nov 2018 15:20:21 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | 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=joOaSn9Uu63ByVMaMGYmI5JAa8MwkegAqafV4txc2aw=; b=eA/ML+6ZMhO208ZnY6cpcKYvyKoUkHn/YmtXWD895wUUwd2toDE50muTnJcSoh83ks iBnKmeJCmLWej41E9Nj1tg32AfS0ImJagGvKLyODU3El+LT9FYGNMCoJgM/kwpSZ4+Oa 8ILmHAJ21LSVmRONc/8S+jq10rPDmAiIoRJOuiEsMTEAcdaopS2eZXtUfCLWbM6omeqm XS646+ZN3/ov2Q9rfwzLlr7kfGYcFXnKqhDx5w6pkmL434OLJFgufliKCEh0ovP2u1W/ SkG8OKgGkveRa9lsrxpbJS5yOn5b36boVcjY5Zzgb35tv+k4HVBB8s8rwbok4354RAvh QrBA== |
| 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=joOaSn9Uu63ByVMaMGYmI5JAa8MwkegAqafV4txc2aw=; b=ZePOuNMa6OydgXMLNaPL5DiwKDAcIgHU4k4602GQp7G8j9XTbgSlq3SEGmkuvuk7Dv Qn6YqNCxxMI5d2/tqAvOo5TngMdcV5oPf5jketvRGYRosY08xLpYpxPzUjHBYPlIRmTr OxSM89G2OKE2wQ51+OQPSBMEvfxwb0EAInfp7P4wKLDVO205M5C3dRiSOEl7eTs98AUv oUVZePukESOnD1rbvxltpwsmzzgqxQXafm6Ii8B7zGKm+KwiBusnpqmDiVO6lELURXrX SFQedshUMx7nd9RCqJw7HASbdFH4rg/41L7jnDqrHxN0HgGC3Gn/WSZm4R56N4ZMXX4I WoZw== |
| X-Gm-Message-State | AGRZ1gIGz/e2pU7FzrFsWf6ONfJm5L9JDvuXyQsr/isC6YgzfRHIxR5h TeILIowvsoUGW8iRsmL4XiNGVOl5md8GoUH4F0lNtaoHydJXIRMP |
| X-Google-Smtp-Source | AJdET5e5nkDnpnmNX6jou9oIyQweh9gCMfQE3SjclS7V1eUDd5p7PdT9bJEe6VibrLJBhWaQTxLhAZXAJgBNf4xuRpo= |
| X-Received | by 2002:a19:f20:: with SMTP id e32mr3161344lfi.51.1541690409560; Thu, 08 Nov 2018 07:20:09 -0800 (PST) |
| In-Reply-To | <20181108132705.7xgw4gyxmzwhspk4@eeg.ccf.org> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2a00:1450:4864:20::134 |
| 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 <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14778 |
Show key headers only | View raw
> Since your example doesn't show a function being defined or called, I
> would expect it to show only empty strings.
Oh yeah, right. For some reason I thought the part about "main" still
applied. But the actual expected behavior doesn't occur either;
"${FUNCNAME[0]}" and "${FUNCNAME[*]}" are both nonempty! I thought
"${FUNCNAME}" was the incorrect one since it alone was empty, but it turns
out that's the only one that's correct.
> Also, as a side note, "${x}" and "${x[0]}" are always the same. Literally
> always. Doesn't matter what type of variable x is (or isn't).
That's what I thought too, before finding this bug. When executing from a
file, "${FUNCNAME[0]}" exists but "${FUNCNAME}" doesn't. I incorrectly
thought the latter was wrong, but the inconsistency is still there!
On Thu, Nov 8, 2018 at 8:28 AM Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Thu, Nov 08, 2018 at 01:15:56AM -0500, Great Big Dot wrote:
> > 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[*]}"
>
> I don't see any functions there. From the manual:
>
> FUNCNAME
> [...]
> This variable exists only when a shell function is
> executing.
> Assignments to FUNCNAME have no effect. If FUNCNAME is
> unset,
> it loses its special properties, even if it is
> subsequently
> reset.
>
> Since your example doesn't show a function being defined or called, I
> would expect it to show only empty strings.
>
> Also, as a side note, "${x}" and "${x[0]}" are always the same. Literally
> always. Doesn't matter what type of variable x is (or isn't).
>
>
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: The builtin array variable 'FUNCNAME' is considered unset by many expansions, even when set. Great Big Dot <greatbigdot@gmail.com> - 2018-11-08 10:19 -0500
csiph-web