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?

From Ángel <angel@16bits.net>
Newsgroups gnu.bash.bug
Subject Re: History of bash's support for self-modifying shell scripts?
Date 2018-09-11 01:11 +0200
Message-ID <mailman.618.1536621116.1284.bug-bash@gnu.org> (permalink)
References <20180910052543.GA4482@localhost>

Show all headers | 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