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:
		
							parent
							
								
									9f43f8d10b
								
							
						
					
					
						commit
						7fdeadd4f1
					
				
					 6 changed files with 40 additions and 16 deletions
				
			
		| 
						 | 
					@ -11,19 +11,22 @@ For more details, see the NEWS file and for complete details, see the git log.
 | 
				
			||||||
	POSIX standard more closely. See the manual page for details. It is
 | 
						POSIX standard more closely. See the manual page for details. It is
 | 
				
			||||||
	enabled by default if ksh is invoked as sh.
 | 
						enabled by default if ksh is invoked as sh.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1.	File name generation (a.k.a. pathname expansion, a.k.a. globbing) now
 | 
					1.	Bytecode compiled by shcomp 93u+m will not run on older ksh versions.
 | 
				
			||||||
 | 
						(However, bytecode compiled by older shcomp will run on ksh 93u+m.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.	File name generation (a.k.a. pathname expansion, a.k.a. globbing) now
 | 
				
			||||||
	never matches the special navigational names '.' (current directory)
 | 
						never matches the special navigational names '.' (current directory)
 | 
				
			||||||
	and '..' (parent directory). This change makes a pattern like .*
 | 
						and '..' (parent directory). This change makes a pattern like .*
 | 
				
			||||||
	useful; it now matches all hidden 'dotfiles' in the current directory.
 | 
						useful; it now matches all hidden 'dotfiles' in the current directory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2.	The bash-style &>foo redirection operator (shorthand for >foo 2>&1) can
 | 
					3.	The bash-style &>foo redirection operator (shorthand for >foo 2>&1) can
 | 
				
			||||||
	now always be used if -o posix is off, and not only in profile scripts.
 | 
						now always be used if -o posix is off, and not only in profile scripts.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
3.	Most predefined aliases have been converted to regular built-in
 | 
					4.	Most predefined aliases have been converted to regular built-in
 | 
				
			||||||
	commands that work the same way. 'unalias' no longer removes these.
 | 
						commands that work the same way. 'unalias' no longer removes these.
 | 
				
			||||||
	To remove a built-in command, use 'builtin -d'. The 'history' and 'r'
 | 
						To remove a built-in command, use 'builtin -d'. The 'history' and 'r'
 | 
				
			||||||
	predefined aliases remain, but are now only set on interactive shells.
 | 
						predefined aliases remain, but are now only set on interactive shells.
 | 
				
			||||||
	There are some minor changes in behaviour in some former aliases:
 | 
						There are some minor changes in behavior in some former aliases:
 | 
				
			||||||
	-  'redirect' now checks if all arguments are valid redirections
 | 
						-  'redirect' now checks if all arguments are valid redirections
 | 
				
			||||||
	   before performing them. If an error occurs, it issues an error
 | 
						   before performing them. If an error occurs, it issues an error
 | 
				
			||||||
	   message instead of terminating the shell.
 | 
						   message instead of terminating the shell.
 | 
				
			||||||
| 
						 | 
					@ -31,12 +34,12 @@ For more details, see the NEWS file and for complete details, see the git log.
 | 
				
			||||||
	   no parent shell to return to and the login session would freeze.
 | 
						   no parent shell to return to and the login session would freeze.
 | 
				
			||||||
	-  'times' now gives high precision output in a POSIX compliant format.
 | 
						-  'times' now gives high precision output in a POSIX compliant format.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
4.	'command' no longer expands aliases in its first argument, as this is
 | 
					5.	'command' no longer expands aliases in its first argument, as this is
 | 
				
			||||||
	no longer required after change 3 above. In the unlikely event that you
 | 
						no longer required after change 3 above. In the unlikely event that you
 | 
				
			||||||
	still need this behavior, you can set:
 | 
						still need this behavior, you can set:
 | 
				
			||||||
		alias command='command '
 | 
							alias command='command '
 | 
				
			||||||
 | 
					
 | 
				
			||||||
5.	The undocumented 'login' and 'newgrp' builtin commands have been
 | 
					6.	The undocumented 'login' and 'newgrp' builtin commands have been
 | 
				
			||||||
	removed. These replaced your shell session with the external commands
 | 
						removed. These replaced your shell session with the external commands
 | 
				
			||||||
	by the same name, as in 'exec'. If an error occurred (e.g. due to a
 | 
						by the same name, as in 'exec'. If an error occurred (e.g. due to a
 | 
				
			||||||
	typo), you would end up immediately logged out. If you do want this
 | 
						typo), you would end up immediately logged out. If you do want this
 | 
				
			||||||
| 
						 | 
					@ -44,7 +47,7 @@ For more details, see the NEWS file and for complete details, see the git log.
 | 
				
			||||||
		alias login='exec login'
 | 
							alias login='exec login'
 | 
				
			||||||
		alias newgrp='exec newgrp'
 | 
							alias newgrp='exec newgrp'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
6.	'case' no longer retries to match patterns as literal strings if they
 | 
					7.	'case' no longer retries to match patterns as literal strings if they
 | 
				
			||||||
	fail to match as patterns. This undocumented behaviour broke validation
 | 
						fail to match as patterns. This undocumented behaviour broke validation
 | 
				
			||||||
	use cases that are expected to work. For example:
 | 
						use cases that are expected to work. For example:
 | 
				
			||||||
		n='[0-9]'
 | 
							n='[0-9]'
 | 
				
			||||||
| 
						 | 
					@ -58,17 +61,23 @@ For more details, see the NEWS file and for complete details, see the git log.
 | 
				
			||||||
			echo "$n is a number or the number pattern" ;;
 | 
								echo "$n is a number or the number pattern" ;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
7.	If 'set -u'/'set -o nounset' is active, then the shell now errors out
 | 
					8.	If 'set -u'/'set -o nounset' is active, then the shell now errors out
 | 
				
			||||||
	if a nonexistent positional parameter such as $1, $2, ... is accessed.
 | 
						if a nonexistent positional parameter such as $1, $2, ... is accessed.
 | 
				
			||||||
	(This does *not* apply to "$@" and "$*".)
 | 
						(This does *not* apply to "$@" and "$*".)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
8.	If 'set -u'/'set -o nounset' is active, then the shell now errors out
 | 
					9.	If 'set -u'/'set -o nounset' is active, then the shell now errors out
 | 
				
			||||||
	if $! is accessed before the shell has launched any background process.
 | 
						if $! is accessed before the shell has launched any background process.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
9.	The 'print', 'printf' and 'echo' builtin commands now return a nonzero
 | 
					10.	The 'print', 'printf' and 'echo' builtin commands now return a nonzero
 | 
				
			||||||
	exit status if an input/output error occurs.
 | 
						exit status if an input/output error occurs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
10.	The 'typeset' builtin now properly detects and reports options that
 | 
					11.	Four obsolete date format specifiers for 'printf %(format)T' were
 | 
				
			||||||
 | 
						changed to make them compatible with modern date(1) commands:
 | 
				
			||||||
 | 
						- %k and %l now return a blank-padded hour (24-hour and 12-hour clock).
 | 
				
			||||||
 | 
						- %f now returns a date with the format '%Y.%m.%d-%H:%M:%S'.
 | 
				
			||||||
 | 
						- %q now returns the quarter of the current year.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					12.	The 'typeset' builtin now properly detects and reports options that
 | 
				
			||||||
	cannot be used together if they are given as part of the same command.
 | 
						cannot be used together if they are given as part of the same command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
____________________________________________________________________________
 | 
					____________________________________________________________________________
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,6 +182,7 @@ failures (crashes, and/or essential functionality does not work).
 | 
				
			||||||
**	OpenBSD on x86_64
 | 
					**	OpenBSD on x86_64
 | 
				
			||||||
*	Solaris 11.4 (gcc) on x86_64
 | 
					*	Solaris 11.4 (gcc) on x86_64
 | 
				
			||||||
	Solaris 11.4 (Solaris Studio 12.5 cc) on x86_64
 | 
						Solaris 11.4 (Solaris Studio 12.5 cc) on x86_64
 | 
				
			||||||
 | 
					***	UnixWare 7.1.4 on x86
 | 
				
			||||||
***	Windows 7 using Cygwin on x86
 | 
					***	Windows 7 using Cygwin on x86
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Good luck!!
 | 
					Good luck!!
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1486,7 +1486,7 @@ USAGE_LICENSE
 | 
				
			||||||
const char sh_optksh[] =
 | 
					const char sh_optksh[] =
 | 
				
			||||||
"+[-1?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
 | 
					"+[-1?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
 | 
				
			||||||
USAGE_LICENSE
 | 
					USAGE_LICENSE
 | 
				
			||||||
"[-copyright?(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK "]"
 | 
					"[-copyright?" SH_RELEASE_CPYR "]"
 | 
				
			||||||
"[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
 | 
					"[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
 | 
				
			||||||
"[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
 | 
					"[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
 | 
				
			||||||
	"executes commands read from a command line string, the "
 | 
						"executes commands read from a command line string, the "
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@
 | 
				
			||||||
#define SH_RELEASE_FORK	"93u+m"		/* only change if you develop a new ksh93 fork */
 | 
					#define SH_RELEASE_FORK	"93u+m"		/* only change if you develop a new ksh93 fork */
 | 
				
			||||||
#define SH_RELEASE_SVER	"1.0.0-alpha"	/* semantic version number: https://semver.org */
 | 
					#define SH_RELEASE_SVER	"1.0.0-alpha"	/* semantic version number: https://semver.org */
 | 
				
			||||||
#define SH_RELEASE_DATE	"2021-01-20"	/* must be in this format for $((.sh.version)) */
 | 
					#define SH_RELEASE_DATE	"2021-01-20"	/* must be in this format for $((.sh.version)) */
 | 
				
			||||||
 | 
					#define SH_RELEASE_CPYR	"(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
 | 
					/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
 | 
				
			||||||
/* Arithmetic $((.sh.version)) uses the last 10 chars, so the date must be at the end. */
 | 
					/* Arithmetic $((.sh.version)) uses the last 10 chars, so the date must be at the end. */
 | 
				
			||||||
| 
						 | 
					@ -33,3 +34,13 @@
 | 
				
			||||||
#    define SH_RELEASE	SH_RELEASE_FORK "/" SH_RELEASE_SVER "+dev " SH_RELEASE_DATE
 | 
					#    define SH_RELEASE	SH_RELEASE_FORK "/" SH_RELEASE_SVER "+dev " SH_RELEASE_DATE
 | 
				
			||||||
#  endif
 | 
					#  endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * For shcomp: the version number (0-255) for the binary bytecode header.
 | 
				
			||||||
 | 
					 * Only increase very rarely, i.e.: if incompatible changes are made that
 | 
				
			||||||
 | 
					 * cause bytecode from newer versions to fail on older versions of ksh.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The version number was last increased in 2021 for ksh 93u+m because
 | 
				
			||||||
 | 
					 * most of the predefined aliases were converted to builtin commands.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#define SHCOMP_HDR_VERSION	4
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,7 @@
 | 
				
			||||||
#include	"builtins.h"
 | 
					#include	"builtins.h"
 | 
				
			||||||
#include	"test.h"
 | 
					#include	"test.h"
 | 
				
			||||||
#include	"history.h"
 | 
					#include	"history.h"
 | 
				
			||||||
 | 
					#include	"version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define HERE_MEM	SF_BUFSIZE	/* size of here-docs kept in memory */
 | 
					#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();
 | 
								fcclose();
 | 
				
			||||||
			fcrestore(&sav_input);
 | 
								fcrestore(&sav_input);
 | 
				
			||||||
			lexp->arg = sav_arg;
 | 
								lexp->arg = sav_arg;
 | 
				
			||||||
			if(version > 3)
 | 
								if(version > SHCOMP_HDR_VERSION)
 | 
				
			||||||
				errormsg(SH_DICT,ERROR_exit(1),e_lexversion);
 | 
									errormsg(SH_DICT,ERROR_exit(1),e_lexversion);
 | 
				
			||||||
			if(sffileno(iop)==shp->infd || (flag&SH_FUNEVAL))
 | 
								if(sffileno(iop)==shp->infd || (flag&SH_FUNEVAL))
 | 
				
			||||||
				shp->binscript = 1;
 | 
									shp->binscript = 1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,9 +26,12 @@
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char usage[] =
 | 
					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
 | 
					USAGE_LICENSE
 | 
				
			||||||
 | 
					"[-copyright?" SH_RELEASE_CPYR "]"
 | 
				
			||||||
"[+NAME?shcomp - compile a shell script]"
 | 
					"[+NAME?shcomp - compile a shell script]"
 | 
				
			||||||
"[+DESCRIPTION?Unless \b-D\b is specified, \bshcomp\b takes 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 "
 | 
						"\ainfile\a, and creates a binary format file, \aoutfile\a, that "
 | 
				
			||||||
| 
						 | 
					@ -64,8 +67,7 @@ USAGE_LICENSE
 | 
				
			||||||
#include	"sys/stat.h"
 | 
					#include	"sys/stat.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CNTL(x)	((x)&037)
 | 
					#define CNTL(x)	((x)&037)
 | 
				
			||||||
#define VERSION	3
 | 
					static const char header[6] = { CNTL('k'),CNTL('s'),CNTL('h'),0,SHCOMP_HDR_VERSION,0 };
 | 
				
			||||||
static const char header[6] = { CNTL('k'),CNTL('s'),CNTL('h'),0,VERSION,0 };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue