Re: heredoc and subshell

2016-02-23 Thread Eric Blake
[adding the Austin Group] On 02/23/2016 03:07 PM, Oleg Bulatov wrote: > Hello, > > trying to minimize a shell code I found an unobvious moment with heredocs and > subshells. Thanks for a cool testcase. > > Is it specified by POSIX how next code should be parsed? dash output for this > code

Re: [BUG] Illegal function names are accepted after being used as aliases

2016-02-23 Thread Eric Blake
On 02/23/2016 11:18 AM, Jan Verbeek wrote: > Function definitions that use a bad function name (such as "-" and "=") > are accepted if the function name already exists as an alias. For example: Not necessarily a bug. > > $ - > dash: 1: -: not found > $ - () { echo hello; } > dash: 2: Syntax

[BUG] Illegal function names are accepted after being used as aliases

2016-02-23 Thread Jan Verbeek
Function definitions that use a bad function name (such as "-" and "=") are accepted if the function name already exists as an alias. For example: $ - dash: 1: -: not found $ - () { echo hello; } dash: 2: Syntax error: Bad function name $ - dash: 2: -: not found $ alias -=true $ - $ - () { echo

Re: [BUG] Illegal function names are accepted after being used as aliases

2016-02-23 Thread Eric Blake
On 02/23/2016 11:44 AM, Harald van Dijk wrote: > This matches bash's behaviour, aside from bash requiring -- to prevent > detection of invalid flags to the alias command: > > bash-4.3$ alias -- -=true Then dash DOES have a bug: # dash $ alias -- -='echo hi' alias: -- not found $ echo $? 1 $ -

Re: [BUG] Illegal function names are accepted after being used as aliases

2016-02-23 Thread Eric Blake
On 02/23/2016 12:21 PM, Harald van Dijk wrote: > On 23/02/2016 19:58, Eric Blake wrote: >> On 02/23/2016 11:44 AM, Harald van Dijk wrote: >> >>> This matches bash's behaviour, aside from bash requiring -- to prevent >>> detection of invalid flags to the alias command: >>> >>> bash-4.3$ alias --

Re: [BUG] Illegal function names are accepted after being used as aliases

2016-02-23 Thread Eric Blake
On 02/23/2016 02:00 PM, Harald van Dijk wrote: > > I was under the impression that the intent from the dash side was to > handle all commands the same, and that impression was based on the fact > that the . command has received additional code to handle -- even though > there's no requirement for

Re: [BUG] Illegal function names are accepted after being used as aliases

2016-02-23 Thread Harald van Dijk
On 23/02/2016 20:33, Eric Blake wrote: exit - fuzzy. exit is a special built-in (unlike getopts); and XCU 2.14 states: "Some of the special built-ins are described as conforming to XBD Utility Syntax Guidelines. For those that are not, the requirement in Utility Description Defaults that

heredoc and subshell

2016-02-23 Thread Oleg Bulatov
Hello, trying to minimize a shell code I found an unobvious moment with heredocs and subshells. Is it specified by POSIX how next code should be parsed? dash output for this code differs from bash and zsh. --- code prefix() { sed -e "s/^/$1:/"; } DASH_CODE() { :; } prefix A