1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Increase shcomp bytecode header version; doc updates

src/cmd/ksh93/include/version.h:
- Centrally define the 93u+m copyright (SH_RELEASE_CPYR) for adding
  to the original AT&T copyright in 'ksh --man' and 'shcomp --man'.
- Centrally define the binary header version number for bytecode
  generated by shcomp: SHCOMP_HDR_VERSION.
- Bump SHCOMP_HDR_VERSION from 3 to 4. Converting all the preset
  aliases to builtin commands has caused new bytecode to be
  incompatible with old ksh. (However, old bytecode runs fine on
  93u+m, because shcomp pre-expands the preset aliases.)

src/cmd/ksh93/sh/shcomp.c:
- Instead of keeping its own version date (not changed since 2003),
  use the same version string as ksh itself (SH_RELEASE).
- Use SH_RELEASE_CPYR for the extra 93u+m copyright string.
- Use SHCOMP_HDR_VERSION for the bytecode header.

src/cmd/ksh93/sh/parse.c: sh_parse():
- Use SHCOMP_HDR_VERSION for the bytecode version check.

src/cmd/ksh93/data/builtins.c: opt_ksh[]:
- Use SH_RELEASE_CPYR for the extra 93u+m copyright string.

src/cmd/ksh93/COMPATIBILITY:
- Mention that 93u+m shcomp bytecode won't run on older ksh.
- Document changes in printf %T (re: 9526b3fa).

src/cmd/ksh93/README:
- Mention that we run on UnixWare (with major regressions).
  https://github.com/ksh93/ksh/pull/159#issuecomment-764667929
This commit is contained in:
Martijn Dekker 2021-01-21 14:15:30 +00:00
parent 9f43f8d10b
commit 7fdeadd4f1
6 changed files with 40 additions and 16 deletions

View file

@ -41,6 +41,7 @@
#include "builtins.h"
#include "test.h"
#include "history.h"
#include "version.h"
#define HERE_MEM SF_BUFSIZE /* size of here-docs kept in memory */
@ -358,7 +359,7 @@ void *sh_parse(Shell_t *shp, Sfio_t *iop, int flag)
fcclose();
fcrestore(&sav_input);
lexp->arg = sav_arg;
if(version > 3)
if(version > SHCOMP_HDR_VERSION)
errormsg(SH_DICT,ERROR_exit(1),e_lexversion);
if(sffileno(iop)==shp->infd || (flag&SH_FUNEVAL))
shp->binscript = 1;

View file

@ -26,9 +26,12 @@
*
*/
#include "version.h"
static const char usage[] =
"[-?\n@(#)$Id: shcomp (AT&T Research) 2003-03-02 $\n]"
"[-?\n@(#)$Id: shcomp (AT&T Research/ksh93) " SH_RELEASE " $\n]"
USAGE_LICENSE
"[-copyright?" SH_RELEASE_CPYR "]"
"[+NAME?shcomp - compile a shell script]"
"[+DESCRIPTION?Unless \b-D\b is specified, \bshcomp\b takes a shell script, "
"\ainfile\a, and creates a binary format file, \aoutfile\a, that "
@ -64,8 +67,7 @@ USAGE_LICENSE
#include "sys/stat.h"
#define CNTL(x) ((x)&037)
#define VERSION 3
static const char header[6] = { CNTL('k'),CNTL('s'),CNTL('h'),0,VERSION,0 };
static const char header[6] = { CNTL('k'),CNTL('s'),CNTL('h'),0,SHCOMP_HDR_VERSION,0 };
int main(int argc, char *argv[])
{