On Sun, Mar 08, 2026 at 15:54:06 -0600, Stan Marsh wrote: > From: Matt > Subject: [bug #68131] Shell script misbehaves when edited > Date: Sun, 8 Mar 2026 12:42:13 -0400 (EDT) > > >When a shell script is edited while running, it appears the current > >invocation > >takes the update right away. However, it seems to keep track of its position > >naively rather than based on any parsing of the script itself. Thus, if the > >modification changes the position of text across lines, this results in > >unexpected and potentially dangerous behavior. > > It would be good to see an example case of this.
It would be the work of a few minutes to come up with an example. A lot longer to come up with a *good* example. It's a well-known pitfall, in any case. > Although I have never really thoroughly tested this, it is something > that I often do - that is, I have a long-running script and I will > make changes to it w/o explicitly exiting the running version. Of > course, you have to exit and re-start in order to pick up the changes, > but it is usually easier to defer the exit until after the edits, and > then do the exit/re-start at the same time. The main concern here is how your editor works. If it opens the original file and writes to it, then you will run into the issue described in this bug report. If it opens a temp file, writes to it, sets the permissions, then moves the temp file into the place of the original script, then you will not run into this issue.
