Re: bug: illegal function name?

2019-01-21 Thread Chet Ramey
On 1/20/19 10:56 PM, pepa65 wrote: > On 20/1/2019 19:50, Eduardo A. Bustamante López wrote: >> Changing the behavior of `unset f' to only ever unset variables means >> potentially breaking existing scripts. Is the inconsistency reported severe >> enough to make this change? > > The alternative

Re: bug: illegal function name?

2019-01-21 Thread Andrey Butirsky
On 21.01.2019 05:26, Robert Elz wrote: > I think his point is that if unset "unset f" (no flags) works to unset > function f, if f is not a (set) variable, then it should work every time > "f" is not a set variable, not only the times when the word "f" happens > to be of the correct syntax to be

Re: bug: illegal function name?

2019-01-20 Thread pepa65
On 20/1/2019 19:50, Eduardo A. Bustamante López wrote: > Changing the behavior of `unset f' to only ever unset variables means > potentially breaking existing scripts. Is the inconsistency reported severe > enough to make this change? The alternative would be to allow anything (that is not a

Re: bug: illegal function name?

2019-01-20 Thread Robert Elz
Date:Sun, 20 Jan 2019 19:50:35 -0800 From:Eduardo =?iso-8859-1?Q?A=2E_Bustamante_L=F3pez?= Message-ID: <20190121035035.gc31...@system76-pc.vc.shawcable.net> | Changing the behavior of `unset f' to only ever unset variables means | potentially breaking existing

Re: bug: illegal function name?

2019-01-20 Thread Eduardo A . Bustamante López
On Mon, Jan 21, 2019 at 09:26:59AM +0700, Robert Elz wrote: (...) > I think his point is that if unset "unset f" (no flags) works to unset > function f, if f is not a (set) variable, then it should work every time > "f" is not a set variable, not only the times when the word "f" happens > to be

Re: bug: illegal function name?

2019-01-20 Thread Robert Elz
Date:Sun, 20 Jan 2019 16:02:51 -0500 From:Chet Ramey Message-ID: | You should not ignore the variable names case. The behavior of unset | without arguments is to check for a variable first, then optionally | check for a function name. That's fine. | The

Re: bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
On 21.01.2019 00:02, Chet Ramey wrote: > On 1/20/19 1:46 PM, Andrey Butirsky wrote: >> I'm not quite understand what exactly is "intentional". >> The problem is inconsistent behavior of unset '-f' flag for "normal" and >> "not-normal" function names (I'm not considering conflicting with >>

Re: bug: illegal function name?

2019-01-20 Thread Chet Ramey
On 1/20/19 4:03 PM, Andrey Butirsky wrote: > Chet, the sample was run in normal, not POSIX, mode. > So it allows '1a' but disallows '1'. Pretty odd. Yeah, it should not reject all digits when not in posix mode. I'll take a look there. -- ``The lyf so short, the craft so long to lerne.'' -

Re: bug: illegal function name?

2019-01-20 Thread Chet Ramey
On 1/20/19 1:46 PM, Andrey Butirsky wrote: > I'm not quite understand what exactly is "intentional". > The problem is inconsistent behavior of unset '-f' flag for "normal" and > "not-normal" function names (I'm not considering conflicting with > variable names case). You should not ignore the

Re: bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
Chet, the sample was run in normal, not POSIX, mode. So it allows '1a' but disallows '1'. Pretty odd. On 20.01.2019 23:55, Chet Ramey wrote: > On 1/20/19 10:46 AM, Andrey Butirsky wrote: >> `1' is not a valid identifier, still: >> $ function 1 () { :; } >> bash: `1': not a valid identifier >> >>

Re: bug: illegal function name?

2019-01-20 Thread Chet Ramey
On 1/20/19 1:22 PM, Ilkka Virta wrote: > The manual could of course mention something about the accepted function > names, e.g.  "Function names can contain the characters [...], except in > POSIX mode, where they must be valid shell /names/."  I'm not exactly sure > what the accepted characters

Re: bug: illegal function name?

2019-01-20 Thread Chet Ramey
On 1/20/19 10:26 AM, Andrey Butirsky wrote: > Andreas, I know it will work with the '-f' flag. > But for others function names, the '-f' unset flag is not required. > Moreover, it seem confronts with Open Group Base Specification. When posix mode is enabled, bash restricts function names to valid

Re: bug: illegal function name?

2019-01-20 Thread Chet Ramey
On 1/20/19 10:46 AM, Andrey Butirsky wrote: > `1' is not a valid identifier, still: > $ function 1 () { :; } > bash: `1': not a valid identifier > > So that is pretty messy.. In posix mode, bash restricts function names to be valid shell identifiers, as the standard specifies. -- ``The lyf so

Re: bug: illegal function name?

2019-01-20 Thread Eduardo Bustamante
On Sun, Jan 20, 2019 at 11:05 AM Andrey Butirsky wrote: > > Eduardo, the question is about inconsistent, error-prone implementation. > Not about the workarounds. What's the error prone part? - Declare a function name - Unset it with 'unset -f'

Re: bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
Eduardo, the question is about inconsistent, error-prone implementation. Not about the workarounds. On 20.01.2019 21:59, Eduardo Bustamante wrote: >> The problem is inconsistent behavior of unset '-f' flag for "normal" and >> "not-normal" function names (I'm not considering conflicting with >>

Re: bug: illegal function name?

2019-01-20 Thread Eduardo Bustamante
On Sun, Jan 20, 2019 at 10:46 AM Andrey Butirsky wrote: > > I'm not quite understand what exactly is "intentional". Accepting different sets of function names (when POSIX mode is either on/off). > The problem is inconsistent behavior of unset '-f' flag for "normal" and > "not-normal" function

Re: bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
I'm not quite understand what exactly is "intentional". The problem is inconsistent behavior of unset '-f' flag for "normal" and "not-normal" function names (I'm not considering conflicting with variable names case). This is just confusing and makes the scripts error-prone, IMO. On 20.01.2019

Re: bug: illegal function name?

2019-01-20 Thread Eduardo A . Bustamante López
On Sun, Jan 20, 2019 at 06:26:43PM +0300, Andrey Butirsky wrote: > Andreas, I know it will work with the '-f' flag. > But for others function names, the '-f' unset flag is not required. > Moreover, it seem confronts with Open Group Base Specification. > So I consider it as a bug still. > It is

Re: bug: illegal function name?

2019-01-20 Thread Ilkka Virta
In POSIX mode, Bash disallows names like '1a': 13. Function names must be valid shell names. That is, they may not contain characters other than letters, digits, and underscores, and may not start with a digit. Declaring a function with an invalid name causes a fatal syntax error in

Re: bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
`1' is not a valid identifier, still: $ function 1 () { :; } bash: `1': not a valid identifier So that is pretty messy.. Bug report: https://savannah.gnu.org/support/?109632 On 20.01.2019 18:26, Andrey Butirsky wrote: > Andreas, I know it will work with the '-f' flag. > But for others function

Re: bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
Andreas, I know it will work with the '-f' flag. But for others function names, the '-f' unset flag is not required. Moreover, it seem confronts with Open Group Base Specification. So I consider it as a bug still. On 20.01.2019 18:18, Andreas Schwab wrote: > On Jan 20 2019, Andrey Butirsky

Re: bug: illegal function name?

2019-01-20 Thread Andreas Schwab
On Jan 20 2019, Andrey Butirsky wrote: > |$ unset 1a || > ||bash: unset: `1a': not a valid identifier Use `unset -f'. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely

bug: illegal function name?

2019-01-20 Thread Andrey Butirsky
Hello, seems like bash allows illegal function names, but refuses to unset them then: |$ function 1a () { :; }|| | |$ declare -f 1a    || ||1a () || ||{ || ||    :|| ||}|| | |$ unset 1a || ||bash: unset: `1a': not a valid identifier $ GNU bash, version 4.3.48(1)-release