[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: posix vs default mode nonsense
From: |
Chet Ramey |
Subject: |
Re: posix vs default mode nonsense |
Date: |
Tue, 22 Oct 2024 11:30:03 -0400 |
User-agent: |
Mozilla Thunderbird |
On 10/21/24 4:23 PM, Zachary Santer wrote:
On Mon, Oct 21, 2024 at 11:50 AM Chet Ramey <chet.ramey@case.edu> wrote:
On 10/21/24 12:15 AM, Zachary Santer wrote:
The nontrivial stuff I do is still being run by bash 4.2 at the
moment, and I'm not willing to give up procsubs.
Probably something to take up with your distro (Red Hat/Centos, right?)
RHEL 7. Something more recent is coming ... eventually.
Love those end-of-support versions.
That one bash could easily fix if it wanted to, there's never been a
POSIX requirement that only "name"s can be used as function names.
No, the original 1992 standard required it:
"The function is named fname; it shall be a name (see 3.1.5)."
That changed to an application requirement in 2001.
Pardon my ignorance, but as an "application requirement," is that
saying what shell scripts are allowed to do, rather than what bash
itself is allowed to do? That's how I would interpret kre's quote from
the standard. Otherwise, it's contradicting itself.
Yes, now that it says it's an application requirement, the shell can
assume that applications understand they're going off into the wild
west if they use something that's not a `name'.
Lots of shells (yash, dash, ksh93, SVR4.2 sh, gwsh, bash-posix) make trying
to define a function with a name like `f::method' a syntax error. Others
(bash, mksh, netbsd sh, freebsd sh, 9th edition sh) accept it. It's best
not to use it if portability is a concern.
Don't know how much weight the Google Shell Style Guide carries here,
or with the Austin Group, but:
If you’re writing a package, separate package names with :: [in function
names].
https://google.github.io/styleguide/shellguide.html#function-names
Just fine if you use `bash', not `sh' or `bash -o posix'.
So my script might violate POSIX, but POSIX allows shell
implementations to work with those function names anyway? I don't mind
my script violating POSIX. It's probably not going to run in any other
shell than bash anyway.
Maybe it's time for bash-posix to accept the same namespace as bash, but
that won't help with the portability problems.
--
``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/
- Re: 'wait -n' with and without id arguments, (continued)
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Re: 'wait -n' with and without id arguments, Robert Elz, 2024/10/17
- Re: 'wait -n' with and without id arguments, Chet Ramey, 2024/10/20
Re: 'wait -n' with and without id arguments, Chet Ramey, 2024/10/17
- Re: 'wait -n' with and without id arguments, Zachary Santer, 2024/10/20
- Re: 'wait -n' with and without id arguments, Grisha Levit, 2024/10/20
- posix vs default mode nonsense, Zachary Santer, 2024/10/21
- Re: posix vs default mode nonsense, Chet Ramey, 2024/10/21
- Re: posix vs default mode nonsense, Zachary Santer, 2024/10/21
- Re: posix vs default mode nonsense, Lawrence Velázquez, 2024/10/21
- Re: posix vs default mode nonsense, Zachary Santer, 2024/10/21
- Re: posix vs default mode nonsense,
Chet Ramey <=
- Re: posix vs default mode nonsense, Zachary Santer, 2024/10/25
- Re: posix vs default mode nonsense, Chet Ramey, 2024/10/26
Re: posix vs default mode nonsense, Robert Elz, 2024/10/21
Re: posix vs default mode nonsense, Chet Ramey, 2024/10/21
Re: 'wait -n' with and without id arguments, Lawrence Velázquez, 2024/10/20
Re: 'wait -n' with and without id arguments, Chet Ramey, 2024/10/21