Bug report for pretty-printing coprocesses with simple commands

2024-02-27 Thread Seth Sabar
Hi, I'd like to report a bug with the *--pretty-print* feature of bash. When I run the following script: *coproc sleep 5* the pretty-printed result is *coproc COPROC* sleep 5 The reason this happens is because within Bash's AST every *coproc* is given a name regardless of whether the user

Incorrect Printing of esac in pretty-print mode

2024-02-27 Thread Seth Sabar
Hi, I'm reaching out to report a bug with the -*-pretty-print* option in bash. Consider the following script: *case esac in (esac) echo esac;; esac* When bash is run with *--pretty-print* on this script the result is: *case esac in esac)echo esac;;esac* which is no longer

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Chet Ramey
On 2/27/24 6:23 AM, Emanuele Torre wrote: On Tue, Feb 27, 2024 at 04:10:06PM +0700, Robert Elz wrote: Date:Tue, 27 Feb 2024 00:50:46 +0100 From:Emanuele Torre Message-ID: | To use esac as a pattern you need to use the (esac) syntax, Or quote it

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Chet Ramey
On 2/26/24 6:50 PM, Emanuele Torre wrote: Hello. I have noticed that declare -f does not output valid code when a pattern is `esac'. Thanks for the report. More precisely, if the first word in the pattern list is the literal string "esac". "The grammar shows that reserved words can be used

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Emanuele Torre
On Tue, Feb 27, 2024 at 12:23:41PM +0100, Emanuele Torre wrote: > On Tue, Feb 27, 2024 at 04:10:06PM +0700, Robert Elz wrote: > > Date:Tue, 27 Feb 2024 00:50:46 +0100 > > From:Emanuele Torre > > Message-ID: > > > > | To use esac as a pattern you need to use the

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Emanuele Torre
On Tue, Feb 27, 2024 at 04:10:06PM +0700, Robert Elz wrote: > Date:Tue, 27 Feb 2024 00:50:46 +0100 > From:Emanuele Torre > Message-ID: > > | To use esac as a pattern you need to use the (esac) syntax, > > Or quote it > > 'esac') > > (or similar). > > kre

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Robert Elz
Date:Tue, 27 Feb 2024 00:50:46 +0100 From:Emanuele Torre Message-ID: | To use esac as a pattern you need to use the (esac) syntax, Or quote it 'esac') (or similar). kre

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Oğuz
On Tuesday, February 27, 2024, Martin D Kealey wrote: > > I've been thinking for a while now that POSIX made a mistake when it > permitted ';;' before the closing 'esac'. > I think that decision was made before POSIX. Besides it's handy when generating case clauses on the fly, you may not

Re: declare -f does not output esac pattern correctly

2024-02-27 Thread Martin D Kealey
I've been thinking for a while now that POSIX made a mistake when it permitted ';;' before the closing 'esac'. If ';;' were prohibited there, then the parser could be sure that the next word after every ';;' would be a pattern, even if it looks like 'esac'. But as things stand, there's an