Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15516 > unrolled thread
| Started by | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| First post | 2019-10-16 15:14 -0400 |
| Last post | 2019-10-17 00:08 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Feature request: save/restore BASH_REMATCH across debug hook calls Chet Ramey <chet.ramey@case.edu> - 2019-10-16 15:14 -0400
Re: Feature request: save/restore BASH_REMATCH across debug hook calls rocky.bernstein@gmail.com - 2019-10-17 00:08 -0700
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Date | 2019-10-16 15:14 -0400 |
| Subject | Re: Feature request: save/restore BASH_REMATCH across debug hook calls |
| Message-ID | <mailman.903.1571253292.9715.bug-bash@gnu.org> |
On 10/16/19 1:34 PM, Rocky Bernstein wrote: > Current in bash 5.0 and earlier, the value of BASH_REMATCH might chanted > inside a debug hook. > > Since BASH_REMATCH is read-only, resetting the value on hook return to the > debugged program is a bit tricky and fragile... How about we just make it not read-only? The shell will still set it when it does regexp matching. -- ``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/
[toc] | [next] | [standalone]
| From | rocky.bernstein@gmail.com |
|---|---|
| Date | 2019-10-17 00:08 -0700 |
| Message-ID | <07975c33-730e-4d71-a3d0-db83cc6cafd9@googlegroups.com> |
| In reply to | #15516 |
On Wednesday, October 16, 2019 at 3:14:54 PM UTC-4, Chet Ramey wrote: > On 10/16/19 1:34 PM, Rocky Bernstein wrote: > > Current in bash 5.0 and earlier, the value of BASH_REMATCH might chanted > > inside a debug hook. > > > > Since BASH_REMATCH is read-only, resetting the value on hook return to the > > debugged program is a bit tricky and fragile... > > How about we just make it not read-only? The shell will still set it when > it does regexp matching. One the one hand, that helps folks writing debug hooks to restore BASH_REMATCH on hook exit. So from my side that is better than the current situations. But now let's also consider the downsides this approach. First, there was a reason it was read-only, and that reason I think still applies. Second, every hook writer will have to know to save and restore BASH_REMATCH. (It took me a while to realize this needed to be done, and in the meantime things were just flaky). And all hook writers basically would add the same bit of code. So why not do it once inside bash? That said, since I'm not doing the work, either is fine.
[toc] | [prev] | [standalone]
Back to top | Article view | gnu.bash.bug
csiph-web