Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Duncan Roe
On Sat, Aug 30, 2025 at 03:51:49AM +1000, Martin D Kealey wrote: > On Sat, 30 Aug 2025, 02:26 Chet Ramey, wrote: > > > There is no specification for how it behaves; > > > I'll buy that when the shell is in POSIX mode, but when talking about > Bash's extensions to POSIX, there's never been a full s

[PATCH] command substitution with trailing newlines (was Re: [PATCH] Add shopts for ...)

2025-08-30 Thread Kevin Pulo
On Fri, 29 Aug 2025 at 01:00, Koichi Murase wrote: > If the feature is really desired by the community as an essential feature, it > should be implemented as a new syntax. I looked at adding alternate syntax for doing command substitution without stripping trailing newlines, and it turned out to

Re: integer variable that unsets itself causes segfault

2025-08-30 Thread Zachary Santer
On Sat, Aug 30, 2025 at 11:41 AM Chet Ramey wrote: > > It occurs to me that bash should print a warning when you attempt something > like this: > > declare -n foo=bar > declare -i foo > > since bash disallows that now by ignoring the attempt to add the integer > attribute The manual explicitly la

Re: A BUG in bash-5.3 and extglob

2025-08-30 Thread Greg Wooledge
On Sat, Aug 30, 2025 at 15:07:10 +0200, pourko--- via Bug reports for the GNU Bourne Again SHell wrote: > After upgrading to bash-5.3, I ran into a strange problem with many of my > scripts: It looks like in bash-5.3, setting the extglob option can crash my > script, if the shopt command is inside

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Thu, 28 Aug 2025 at 00:36, Chet Ramey wrote: > On 8/27/25 10:29 AM, Zachary Santer wrote: > > On Wed, Aug 27, 2025 at 10:19 AM Chet Ramey wrote: > >> On 8/26/25 6:40 PM, Zachary Santer wrote: > > Bash already provides one. You're just leaving it undocumented so > > you're more free to get rid

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Chet Ramey
On 8/29/25 1:26 PM, Martin D Kealey wrote: On Sat, 30 Aug 2025, 01:48 Chet Ramey, > wrote: > What was the rationale for preferring $((…)) over $[…] back when they had a > free choice? See if the POSIX rationale answers your question. https

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Chet Ramey
On 8/29/25 12:32 PM, Connor Wilkins wrote: In theory, since it's never been documented, I could flip the define in config-top.h and disable it by default. This assumption is the root of the problem. If it's not documented, then as far as some ordinary users are concerned, it is NOT deprecat

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Zachary Santer
On Fri, Aug 29, 2025 at 11:25 AM Chet Ramey wrote: > > The upper and lowercase features were user requested. The business of > making them into a parameter expansion with the ability to specify the > modified characters was my invention, and I think it's overkill. $ var="abra cadabra" $ printf '%

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Connor Wilkins
On Friday, August 29, 2025 10:02 AM, Martin D Kealy wrote: > On Thu, 28 Aug 2025, 03:40 Chet Ramey, > mailto:chet.ra...@case.edu>> wrote: >> This has never been documented. > If that's true, how are there scripts using it, and people asking about it? > It's not just documentation that you've writ

patch: (re)enable #ifdef processing within builtin help text

2025-08-30 Thread Martin D Kealey
I tried adding documentation for declare -c but discovered that it wasn't honouring CASEMOD_CAPCASE. Looking at mkbuiltins.c, that appears to be because of the way that single_longdoc_strings is handled. So I figured I should fix that too. Attached herewith a patch to implement both. This will al

A BUG in bash-5.3 and extglob

2025-08-30 Thread pourko--- via Bug reports for the GNU Bourne Again SHell
Greetings, After upgrading to bash-5.3, I ran into a strange problem with many of my scripts: It looks like in bash-5.3, setting the extglob option can crash my script, if the shopt command is inside an if-then-fi structure, or if it's inside a for-do-done loop. For example, here is a snippet t

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Sat, 30 Aug 2025 at 05:26, Chet Ramey wrote: > On 8/29/25 1:26 PM, Martin D Kealey wrote: > > > /In early proposals, a form $[expression] was used. It was functionally > > equivalent to the "$(())" of the current text, but objections were > lodged > > that the 1988 KornShell had already implem

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Sat, 30 Aug 2025, 02:26 Chet Ramey, wrote: > There is no specification for how it behaves; I'll buy that when the shell is in POSIX mode, but when talking about Bash's extensions to POSIX, there's never been a full specification separate from the source code there is no expectation that > i

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Chet Ramey
On 8/29/25 10:02 AM, Martin D Kealey wrote: On Thu, 28 Aug 2025, 03:40 Chet Ramey, > wrote: This has never been documented. If that's true, how are there scripts using it, and people asking about it? People read the source code and wrote about what they fou

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Thu, 28 Aug 2025, 04:20 Chet Ramey, wrote: > It was in early drafts of POSIX.2 (1003.2-1992). > > The feature started out as the compound command ((expr)) (draft 8), evolved > into a word expansion $[...] (draft 9), and then changed to $((...)) > (draft 11, the version I have was published in

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Sat, 30 Aug 2025, 01:48 Chet Ramey, wrote: > > > > What was the rationale for preferring $((…)) over $[…] back when they > had a > > free choice? > > See if the POSIX rationale answers your question. > > > https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_xcu_chap01.html#tag_23_02_06_04

Re: [PATCH] isearch: printable ctrl chars in search string

2025-08-30 Thread Chet Ramey
On 8/26/25 2:21 PM, Grisha Levit wrote: If a control character is used in the isearch search string (using ^V or bracketed paste), it will be printed in the message area, so make it visible to make the prompt display correctly. Thanks for the report and fix. Chet -- ``The lyf so short, the cr

Re: [PATCH] command substitution with trailing newlines (was Re: [PATCH] Add

2025-08-30 Thread Stan Marsh
>> If the feature is really desired by the community as an essential feature, it >> should be implemented as a new syntax. >I looked at adding alternate syntax for doing command substitution without >stripping trailing newlines, and it turned out to be easier than I expected. >This patch adds t

Re: integer variable that unsets itself causes segfault

2025-08-30 Thread Chet Ramey
On 8/28/25 4:07 AM, Martin D Kealey wrote: On 8/23/25 11:40 PM, Martin D Kealey wrote: > In other languages, binding and assignment are clearly different > operations, where this would clearly NOT be "no different". Oh? int x = 0; If we're talking about C, that's initia

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Stan Marsh
>> This has never been documented. >> >If that's true, how are there scripts using it, and people asking about it? >It's not just documentation that you've written that needs to be >considered, because clearly this feature must be mentioned SOMEWHERE. Yeah, that occurred to me as well, but I j

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Thu, 28 Aug 2025, 03:40 Chet Ramey, wrote: > This has never been documented. > If that's true, how are there scripts using it, and people asking about it? It's not just documentation that you've written that needs to be considered, because clearly this feature must be mentioned SOMEWHERE. I

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Martin D Kealey
On Thu, 28 Aug 2025, 01:22 Connor Wilkins, wrote: > On 8/27/25 10:36 AM, Chet Ramey wrote: > > On 8/27/25 10:29 AM, Zachary Santer wrote: > >> Bash already provides one. You're just leaving it undocumented so > >> you're more free to get rid of it in the future? > > I'm leaving it undocumented to

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Chet Ramey
On 8/27/25 2:16 PM, Zachary Santer wrote: On Wed, Aug 27, 2025 at 1:40 PM Chet Ramey wrote: This has never been documented. In theory, since it's never been documented, I could flip the define in config-top.h and disable it by default. I thought about doing that for bash-5.2, but did not. I

Re: [PATCH] doc: missing parameter expansion operators in bash(1)

2025-08-30 Thread Chet Ramey
On 8/29/25 10:31 AM, Martin D Kealey wrote: On Thu, 28 Aug 2025, 04:20 Chet Ramey, > wrote: It was in early drafts of POSIX.2 (1003.2-1992). The feature started out as the compound command ((expr)) (draft 8), evolved into a word expansion $[...] (draft

Re: [PATCH] Add shopts for trailing newlines in command substitution and here strings

2025-08-30 Thread Kevin Pulo
On Fri, 29 Aug 2025 at 01:00, Koichi Murase wrote: > 2025年8月28日(木) 17:20 Kevin Pulo : > > Similar arguments can be made about any behavior-modifying option, but they > > continue to be added to bash (eg. patsub_replacement, localvar_inherit). > > Yes, you are right, and in fact, I raised discussi