Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14569

Re: History of bash's support for self-modifying shell scripts?

Path csiph.com!fu-berlin.de!usenet.stanford.edu!not-for-mail
From Ángel <angel@16bits.net>
Newsgroups gnu.bash.bug
Subject Re: History of bash's support for self-modifying shell scripts?
Date Tue, 11 Sep 2018 01:11:41 +0200
Lines 29
Approved bug-bash@gnu.org
Message-ID <mailman.618.1536621116.1284.bug-bash@gnu.org> (permalink)
References <20180910052543.GA4482@localhost>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-15"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1536621116 30740 208.118.235.17 (10 Sep 2018 23:11:56 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
In-Reply-To <20180910052543.GA4482@localhost>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x
X-Received-From 199.195.249.9
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14569

Show key headers only | View raw


On 2018-09-09 at 22:25 -0700, Josh Triplett wrote:
> (I don't want to use this mechanism myself; I'm asking because I'm
> working on a project that needs to care about various shells'
> compatibility requirements, and I wanted to find out more about this
> unusual corner case.)

The Thompson shell (up to Sixth Edition UNIX) supported a goto command
that was implemented as an external command(!) that moved the
filepointer to the label location (marked by the : command).

The PWB shell (Mashey shell) initially had if/switch/while, but they
used a goto to move the filepointer.

This tells us that self-modifying scripts would be possible on these
shells, and probably they also worked on th original bourne shell.

With these level of trickery, I wouldn't be surprised if some
self-modifying shell scripts were in use at the time (or were thought to
be) and bash was coded this way in order not to break them
(I can't really come up with a good use case for this feature, though). 

You may find these resources interesting
https://etsh.io/
https://www.in-ulm.de/~mascheck/


Regards

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: History of bash's support for self-modifying shell scripts? Ángel <angel@16bits.net> - 2018-09-11 01:11 +0200

csiph-web