Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16745

Re: Dashes in function names: Undocumented?

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: Dashes in function names: Undocumented?
Date Wed, 12 Aug 2020 11:05:40 -0400
Lines 110
Approved bug-bash@gnu.org
Message-ID <mailman.1737.1597244760.2739.bug-bash@gnu.org> (permalink)
References <CAL20dLDNniiOycTe-j6t0ynS+9FG32UgDGJbn+iDEMG7Ls_==Q@mail.gmail.com> <f53f8a84-ac66-6d61-7066-01c14e8f2ce4@archlinux.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NgA9oXRF0usctKK0zI3gjmEQNcEGGqLmX"
X-Trace usenet.stanford.edu 1597244760 5311 209.51.188.17 (12 Aug 2020 15:06:00 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-Spam-BL-Results
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1597244744; bh=oV6tQKdz5aMBbE7+2Va5PLQ2a5sMaqEpd5DOLhmOhgw=; h=Subject:To:References:From:Date:In-Reply-To; b=SeOOokn66Gornk+uMHuX61JjW9Z8g1gpRYJ8VBBVzA6ZZ9EQ8I6bdOOPF8b/88kMO Rn4CfoiB9vyIBPfV/c4yeZmuNl+kAWIuJCyY0gDz+OW8lJ14apwqwOy+TkyEkQxBvD gYq9mFglAHgKy7VyBpy37402VCtnD6VF4cL6QUcjhcgbolRXLYvB3vEH5aI2RYYw1i X/4LZRU0V9Qx/xwWJnK95T0uWj94C3KwdKdrBTwqz44IHtdSeewpHKILa6TwAXO+/3 7yYzxu0eGT3/OEkzMn38tFjnkVYqgShNOPHQAoz8NwdIdqTOpY6KSci4rCoP/jNcF1 SuuH+4fEvevnBIBXFHofXA1ap43tohtl0DolRIt20z6qxxth6XO+CsY77Noa+zGGaI kZEF4vWPhwVBzuBfvgC3iIWUYL6RpE0M3WrqeXC8+jEUaFIGKYyJtRfcDIZLYUVLcN sY/7MJNztRmJT+x3y9/Bgmp9QcHBsP69NxEYb4HiQWm4LV12tMQ9dGozIHieXJ3+8c qXOAaUHNyT/EK7w+UunJhWzcC1CI4lrgLPJYat7pdZOPGnz2syEEzdYrnuCowzQNDh XoR9DnXpC9Q6y2FqHVrk4n64stzIcUDQVRIMo8rMYwbgeqHPt5L9UXgN9lKrDLaz0F /e1KUmfeKoQG1QUD1lzCkZ7Q=
X-Clacks-Overhead GNU Terry Pratchett
In-Reply-To <CAL20dLDNniiOycTe-j6t0ynS+9FG32UgDGJbn+iDEMG7Ls_==Q@mail.gmail.com>
Received-SPF pass client-ip=2a01:4f8:160:6087::1; envelope-from=eschwartz@archlinux.org; helo=orion.archlinux.org
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -53
X-Spam_score -5.4
X-Spam_bar -----
X-Spam_report (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
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 <https://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>
X-Mailman-Original-Message-ID <f53f8a84-ac66-6d61-7066-01c14e8f2ce4@archlinux.org>
X-Mailman-Original-References <CAL20dLDNniiOycTe-j6t0ynS+9FG32UgDGJbn+iDEMG7Ls_==Q@mail.gmail.com>
Xref csiph.com gnu.bash.bug:16745

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 8/12/20 10:51 AM, Matthew Persico wrote:
> I put a bug report into an emacs group because the bash syntax highlighter
> failed to recognize functions whose names have dashes in them.
> 
> The maintainer came back with this:
> 
> I can reproduce this behaviour, but is it really a bug? Aren't the
> names with '-' invalid?
> The Bash Reference Manual says:
> name
>  A word consisting solely of letters, numbers, and underscores, and
>  beginning with a letter or underscore. Names are used as shell
>  variable and function names. Also referred to as an identifier.
> https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html
> 
> I looked at the manual and I didn't see positive or negative
> acknowledgement that dashes can be used in function names. But it does work.
> 
> Update to manual?

The bash-20191127 snapshot updated the manpage documentation for a
function definition (to align with reality). It is now defined as:

function fname [()] compound-command [redirection]

and includes the description:

When in posix mode, fname must be a valid shell name and may not be the
name of one of the POSIX special builtins. In default mode, a function
name can be any unquoted shell word that does not contain $.

For context:

word  -  A sequence of characters considered as a single unit by the
shell. Also known as a token.

name  -  A word consisting only of alphanumeric characters and
underscores, and beginning with an alphabetic character or an
underscore. Also referred to as an identifier.


> name
>  A word consisting solely of letters, numbers, and underscores, and
>  beginning with a letter or underscore. Names are used as shell
>  variables. Also referred to as an identifier.
> 
> function name
>  A word consisting solely of letters, numbers, underscores, dashes, and
>  beginning with a letter or underscore. Function names are used to label
> shell
>  functions.
> 


-- 
Eli Schwartz
Bug Wrangler and Trusted User

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Dashes in function names: Undocumented? Eli Schwartz <eschwartz@archlinux.org> - 2020-08-12 11:05 -0400

csiph-web