The following list describes the changes made to the original source code for the Version 6 (V6) UNIX Thompson shell and global command in porting them to run on modern UNIX systems. ------------------------------------------------------------------------------- [etsh-current] (development): * Work In Progress ( see https://etsh.nl/src/current/ ) ------------------------------------------------------------------------------- [etsh-5.4.0] (latest): * Please see CHANGES as well. sh.h: * Changed struct tnode . LICENSE defs.h fd2.c if.c: * Updated LICENSE as needed. * defs.h: Added SIZE_T_EOVERFLOW(num, siz), a macro derived from the OpenBSD malloc(3) manual to check for size_t overflow and do an error exit if/when true. It could be that it's not needed here, as the code in the etsh project that uses malloc(3) and friends is generally limited in the maximum size sense by other arbitrary size limits in the shell (e.g., PATH_MAX, ARG_MAX, LINEMAX, WORDMAX, TREEMAX). Still, it's better to be safe than sorry. * fd2.c: Changed to use SIZE_T_EOVERFLOW(num, siz) as an example. * if.c: Changed to use SIZE_T_EOVERFLOW(num, siz) as an example. glob.c goto.c: * Replaced instances of UChar with u_char, UCHAR with U_CHAR, and UCPTR with U_CPTR to sync with defs.h . goto.c: * Moved CONFIG_BROKEN blog post to https://etsh.nl/blog/ubuntu-16/ , and changed the associated comment; this problem has been fixed; thus, it is no longer a problem. ------------------------------------------------------------------------------- [etsh-5.3.1]: * Please see CHANGES. pexec.c sh_err.h: * Added a missing error message, ": too large", found in the original V6 Thompson shell source code; see History/sh.c for more information. * C: This error message is available in both etsh & tsh. ------------------------------------------------------------------------------- [etsh-5.3.0]: * Please see CHANGES. scratch/tes: * Synced with v6scripts/tes.tsh; (date: 2018/08/06 03:39:46 UTC) tsh.1: * Changed communicat(e|ed) to convey(ed) for better word flow. (date: 2018/08/05 13:57:37 UTC) tsh.c: * Fixed having added a call to setenv_tes() in main() before tsh(1) ended up calling rpx_line() for its normal read/parse/execute a command line sequence. Doing so stopped the tes script from working correctly. (date: 2018/07/03 20:07:21 UTC) ------------------------------------------------------------------------------- [etsh-5.2.0]: * Please see CHANGES. tsh.[1c]: * tsh now sets its current exit status as TES in the environment in order to communicate it to the user as an unsigned decimal integer. I also added scratch/tes here, which is identical to the new tes.tsh (installs as tes) found in v6scripts-current. Having copied scratch/tes to a directory in your PATH, you can do the following (assuming you've updated recompiled & reinstalled tsh): % '' : not found % tes -v TES=127 127 % / /: cannot execute % tes -v TES=126 126 % false % tes 1 % : ' ... and this is true (0), as : always is, of course ... ' % tes 0 . * Added a description of TES to the ENVIRONMENT section of tsh(1). ------------------------------------------------------------------------------- [etsh-5.1.5]: * Please see CHANGES. ------------------------------------------------------------------------------- [etsh-5.1.0]: * Please see CHANGES. ------------------------------------------------------------------------------- [etsh-5.0.2]: tsh.1: * Changed where etsh(1) appears in `SEE ALSO' so that it is a little more alphabetical. ------------------------------------------------------------------------------- [etsh-5.0.1]: tsh.1: * Substituted @LIBEXECDIRSH6@ with @LIBEXECDIRTSH@ so that the installed manual contains the correct directory name instead of an unexpanded macro. ------------------------------------------------------------------------------- [etsh-5.0.0]: * Trimmed CHANGES6 ( see https://etsh.io/src/CHANGES6-trim as noted below ), and moved CHANGES6 to CHANGES-tsh+ . * Moved sh6.[1c] to tsh.[1c], and made all associated changes that this required (e.g., to the Makefile and so forth). See CHANGES for more details about the Makefile changes. * C: Removed (+) from `Broken pipe' termination message in etsh.1, and added `Broken pipe' termination message to tsh.1 and tsh.c for compatibility reasons. The original V6 Thompson shell did not print this termination message when its process received a SIGPIPE signal. It was documented but not implemented. For etsh and tsh though, it is both documented and implemented. ------------------------------------------------------------------------------- [etsh-4.9.0]: sh6.c, defs.h: * Increased size of line buffer & word pointer array. Previously, line only allowed a maximum of 2042 characters in each command line. It now allows 2063 and gives a "Too many characters" error at 2064 and beyond. For word, instead of allowing a maximum of 1018 arguments/words per command line and giving "Too many args" at 1019 and beyond, it now allows 1026 and errors at 1027 and beyond. glob.c, sh6.c, sh.h, err.h, defs.h: * Had what amounted to being a cleanup fest of sorts... Without going into too much detail, this provided a good opportunity to revisit, check, and fix a couple of problems (not problems). Many of the cleanups were because of reports by splint(1) only when the shell was in full DEBUG mode. This gave me a chance to change some splint annotations. if.[1c]: * For the if(1) - conditional command of sh6/tsh, made == a synonym for =. 1) The rationale is simple; 'if s1 == s2 echo equal' evaluates the expression for equality; 'if s1 = s2 echo equal' does too, but it looks like an assignment. 2) In effect, this improves if(1) syntax compatibility between sh6/tsh and csh/tcsh. ------------------------------------------------------------------------------- [etsh-4.8.0]: sh6.c: * Added 3 comments in main() to allow easier comparison with osh.c . ------------------------------------------------------------------------------- [etsh-4.7.0]: *: * Changed v6shell (dot) org references to etsh (dot) io, and v6shell.org references to etsh.io too, almost a s/v6shell.org/etsh.io/ in effect, but not quite. * No code changes. sh6.1: * Reworded the description of how an interactive shell prompts the user for the sake of clarity. ------------------------------------------------------------------------------- [etsh-4.6.0]: if.1, if.c: * Added two new primaries, -n to test for non-zero length string & -z to test for zero length string, like the same primaries found in test(1). ------------------------------------------------------------------------------- [etsh-4.5.1]: * No changes. ------------------------------------------------------------------------------- [etsh-4.5.0]: * See CHANGES. ------------------------------------------------------------------------------- [osh-4.4.0]: [fgis]*.1: * Changed osh and sh6 references to match their binary names set in *.1.out by configure. fd2.c, glob.c, goto.c, if.c, sh6.c: * No code changes. ------------------------------------------------------------------------------- [osh-4.3.2]: * No changes. ------------------------------------------------------------------------------- [osh-4.3.1]: [fgis]*.1: * s/General Commands/General Commands Manual/ fd2.c, glob.c, goto.c, if.c, sh6.c: * No code changes. ------------------------------------------------------------------------------- [osh-4.3.0]: * Changed LIBEXECDIR layout to support both sh6 & osh. The sh6(1) external utilities moved into a new sh6 subdirectory. A new osh subdirectory exists for osh support scripts & files; these files came (and will be removed) from the V6Scripts Collection. mkconfig, sh6.c, goto.c: * Disabled sh6 compilation on Ubuntu 16.(04|10). sh6.c: * Updated sh_magic() & xgetc() to make it behave more like osh. This protects the user and her / his terminal from getting fouled up if/when accidentally trying to execute binary files as shell scripts / command files. ------------------------------------------------------------------------------- [osh-4.2.1 - osh-060124]: * Changes for these releases are at https://etsh.io/src/CHANGES6-trim . ------------------------------------------------------------------------------- [Unreleased]: The following ports of the original Sixth Edition UNIX source code were never released to the public. sh6.c 1.1 (jneitzel) 2004/01/26: * Changed the source file name from `sh.c' to `sh6.c' and the resulting binary name from `sh' to `sh6' to avoid name conflict and confusion with the system shell, sh(1), on modern UNIX systems. * Transformed the source code from K&R C into ANSI C. * This is nothing more than a simple port to modern UNIX systems. It is now 64-bit clean. At least, this is true for the 64-bit systems to which the porter has access. * Removed support for the shell's accounting of process times (see times(3)) which allowed the shell to record command execution data in a log file. * Fixed a buffer overflow in the word() function. glob6.c 1.1 (jneitzel) 2004/01/26: * Changed the source file name from `glob.c' to `glob6.c' and the resulting binary name from `glob' to `glob6', matching the similar change to the name of the shell (see above). * Transformed the source code from K&R C into ANSI C. * This is nothing more than a simple port to modern UNIX systems. * Fixed possible overflow of the argument-list buffers in the cat() function. ------------------------------------------------------------------------------- [Original]: Here is some pertinent information about the original files. The following description refers to Sixth Edition (V6) UNIX obtained from: http://www.tuhs.org/Archive/Distributions/Research/Dennis_v6/ ... A portion of the `http://www.tuhs.org/Archive/Distributions/DETAILS' file reads as follows: Dennis_v6 --------- v6root.gz, v6src.gz and v6doc.gz are a set of three RK05 images of Sixth Edition with root, /usr and documentation, from Dennis Ritchie. The tape bootstraps are not included. The most recent timestamp on any file is July 19th 1975. v6root.tar.gz, v6src.tar.gz and v6doc.tar.gz are tar archives of the three RK05 images. ... The following files and the corresponding manual pages were all obtained from the tar archives described above: sh.c: What: Original source code for the Sixth Edition (V6) UNIX Thompson shell Date: July 17, 1975 From: Sixth Edition UNIX /usr/source/s2/sh.c glob.c: What: Original source code for the Sixth Edition (V6) UNIX global command Date: May 14, 1975 From: Sixth Edition UNIX /usr/source/s1/glob.c Jeffrey Allen Neitzel 2019/03/28 @(#)$Id: CHANGES-tsh+,v 1.10.2.1 2019/03/27 06:08:05 jneitzel Exp $