mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-24 06:54:13 +00:00
This makes ksh 93u+m build on the following system: $ uname -a QNX qnx 6.5.0 2010/07/09-14:44:03EDT x86pc x86 Thanks to polarhome.com for providing the QNX shell account. There are a number of regressions left to work out: arrays.sh[636]: copying a large array fails bracket.sh[129]: /tmp/ksh93.shtests.1753215026.6923/bracket.C/original should be older than /tmp/ksh93.shtests.1753215026.6923/bracket.C/newer bracket.sh[132]: /tmp/ksh93.shtests.1753215026.6923/bracket.C/newer should be newer than /tmp/ksh93.shtests.1753215026.6923/bracket.C/original builtins.sh[683]: real_t1 not found after parent directory renamed in subshell functions.sh[1023]: cannot handle comsub depth > 256 in function io.sh[252]: <# not working for pipes io.sh[337]: read -n3 from pipe not working io.sh[346]: read -n3 from fifo failed -- expected 'a', got 'abc' io.sh[349]: read -n1 from fifo failed -- expected 'b', got 'd' io.sh[379]: should have timed out io.sh[380]: line1 should be 'prompt1: ' io.sh[381]: line2 should be line2 io.sh[382]: line3 should be 'prompt2: ' io.sh[406]: LC_ALL=C read -n2 from pipe 'a bcd' failed -- expected 'a bcd', got 'ab cd' io.sh[406]: LC_ALL=C.UTF-8 read -n2 from pipe 'a bcd' failed -- expected 'a bcd', got 'ab cd' jobs.sh[86]: warning: skipping subshell job control test due to non-compliant 'ps' pty.sh[105]: POSIX sh 026(C): line 120: expected "(Stopped|Suspended)", got EOF pty.sh[128]: POSIX sh 028(C): line 143: expected "(Stopped|Suspended) \(SIGTTIN\)", got EOF pty.sh[151]: POSIX sh 029(C): line 166: expected "(Stopped|Suspended) \(SIGTTOU\)", got EOF signal.sh[310]: kill -TERM $$ failed, required termination by signal 'EXIT' signal.sh[310]: kill -VTALRM $$ failed, required termination by signal 'EXIT' signal.sh[310]: kill -PIPE $$ failed, required termination by signal 'EXIT' (The io.sh failures mean libast sfpkrd() is not working.) src/lib/libast/obsolete/spawn.c: - Removed. Didn't compile due to wrong number of arguments to spawnve(2), but is obsolete and unused. src/lib/libast/comp/localeconv.c: - The initialisation of two static 'struct lconv' variables was done in a way that depended on OS headers declaring the struct members in a certain order. This holds on most systems, but not on QNX, and POSIX does not actually specify the order at all: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html So each member must be initialised by name. But C89 does not support initialising struct members by name, so we have to do it using an initialiser function that simply assigns the values. src/lib/libast/comp/spawnveg.c: - Fix for systems without either P_DETACH or _P_DETACH. src/lib/libast/features/vmalloc, src/lib/libast/vmalloc/vmmopen.c, src/lib/libast/Mamfile: - Add test for sys/shm.h header. If it doesn't exist, as it doesn't on QNX, use the stub vmmapopen() as the real one won't compile. (Mamfile: Add dependency on FEATURE/vmalloc to vmmopen.c.) src/lib/libast/vmalloc/malloc.c: - Remove superfluous externs that are already provided by either AST or system headers. The 'void cfree' extern caused a build failure on QNX because cfree() is of type int on QNX. src/lib/libast/comp/conf.tab: - Remove check for _map_spawnve; src/lib/libast/RELEASE says it was removed.
201 lines
10 KiB
Text
201 lines
10 KiB
Text
This directory, and its subdirectories contain the source code
|
|
for ksh-93; the language described in the second addition of
|
|
the book, "The KornShell Command and Programming Language," by
|
|
Morris Bolsky and David Korn which is published by Prentice Hall.
|
|
ksh-93 has been compiled and run on several machines with several
|
|
operating systems. The end of this file contains a partial list of
|
|
operating systems and machines that ksh-93 has been known to run on.
|
|
|
|
Most of the source code for ksh is in the src/cmd/ksh93/sh
|
|
directory. For information on what's where, see the file DESIGN.
|
|
|
|
A new '-o posix' shell option has been added to ksh 93u+m that makes the
|
|
ksh language more compatible with other shells by following the POSIX
|
|
standard more closely. See the manual page for details. It is enabled by
|
|
default if ksh is invoked as sh, otherwise it is disabled by default.
|
|
|
|
The Makefile file contains several compilation options that can be set
|
|
before compiling ksh. Options are of the form SHOPT_option and become
|
|
#define inside the code. These options are set to their recommended
|
|
value and some of these may disappear as options in future releases.
|
|
A value of 0, or no value represents off, 1 represents on.
|
|
Note that == is needed, not =, because these are nmake state variables
|
|
and changing their value will cause all modules that could be affected
|
|
by this change to be recompiled.
|
|
The options have the following defaults and meanings:
|
|
ACCT off Shell accounting.
|
|
ACCTFILE off Enable per user accounting info.
|
|
AUDIT off For auditing specific users
|
|
AUDITFILE "/etc/ksh_audit"
|
|
APPEND on Allows var+=val string and array append.
|
|
BASH off Bash compatibility mode. It is not fully implemented
|
|
and is experimental.
|
|
BRACEPAT on C-shell type abc{d,e}f style file generation
|
|
CMDLIB_BLTIN off Makes all commands in libcmd.a builtins. The
|
|
SH_CMDLIB_DIR nmake state variable can be used to
|
|
specify a directory.
|
|
CMDLIB_DIR off Sets CMDLIB_BLTIN=1 and provides a default value
|
|
of "/opt/ast/bin" for SH_CMDLIB_DIR.
|
|
COMPOUND_ARRAY
|
|
on Allows all components of compound variables except the
|
|
first to be any string by enclosing in [...]. It also
|
|
allows components other than the last to be arrays.
|
|
This is experimental and only partially complete.
|
|
CRNL off <cr><nl> treated as <nl> in shell grammar.
|
|
DYNAMIC on Dynamic loading of builtins. (Requires dlopen() interface.)
|
|
ECHOPRINT off Make echo equivalent to print.
|
|
ESH on Compile with emacs command line editing. The original
|
|
emacs line editor code was provided by Mike Veach at IH.
|
|
FILESCAN on Experimental option that allows fast reading of files
|
|
using while < file;do ...; done and allowing fields in
|
|
each line to be accessed as positional parameters.
|
|
KIA off Allow generation of shell cross reference database with -I.
|
|
MULTIBYTE on Multibyte character handling. Requires mblen() and
|
|
mbctowc().
|
|
NAMESPACE on Allows namespaces. This is experimental, incomplete
|
|
and undocumented.
|
|
OLDTERMIO off Use either termios or termio at runtime.
|
|
OO on Experimental object oriented extension. This option
|
|
should disappear soon.
|
|
OPTIMIZE on Optimize loop invariants for with for and while loops.
|
|
P_SUID off If set, all real uids, greater than or equal to this
|
|
value will require the -p flag to run suid/sgid scripts.
|
|
PFSH off Compile with support for profile shell.
|
|
RAWONLY off Turn on if the vi line mode doesn't work right unless
|
|
you do a set -o viraw.
|
|
SEVENBIT off Strip the eighth bit from characters.
|
|
SPAWN off Use spawn as combined fork/exec. May improve speed on
|
|
some systems.
|
|
STATS on Add .sh.stats compound variable.
|
|
SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script.
|
|
TIMEOUT off Set this to the number of seconds for timing out and
|
|
exiting the shell when you don't enter a command. If
|
|
non-zero, TMOUT can not be set larger than this value.
|
|
TYPEDEF on Enable typeset type definitions.
|
|
VSH on Compile with vi command line editing. The original vi
|
|
line editor code was provided by Pat Sullivan at CB.
|
|
|
|
The following compile options are set automatically by the feature testing:
|
|
DEVFD Set when /dev/fd is a directory that names open files.
|
|
SHELLMAGIC
|
|
Set on systems that recognize script beginning with #! specially.
|
|
|
|
|
|
In most instances, you will generate ksh from a higher level directory
|
|
which also generates libcmd and libast libraries on which ksh depends.
|
|
However, it is possible to generate ksh, with by running make -f ksh.mk
|
|
in this directory. The ksh.mk file was generated from the nmake Makefile.
|
|
If you do not have make or nmake, but do have a Version 7 UNIX compatible
|
|
shell, then you can run the script mamexec < Mamfile to build ksh.
|
|
If you have nmake, version 2.3 or later, you can use it without the -f ksh.mk.
|
|
In either case, ksh relies on libraries libast and libcmd which must be
|
|
built first. The binary for ksh becomes the file named ./ksh which can
|
|
be copied to where ever you install it.
|
|
|
|
If you use old make or the Mamfile, and you system has dynamic shared
|
|
libraries, then you should define the variables mam_cc_static and
|
|
mam_cc_dynanamic as the compiler options that request static linking
|
|
and dynamic linking respectively. This will decrease the number of
|
|
shared libraries that ksh need and cut startup time substantially.
|
|
|
|
The makefile should also generate shcomp, a program that will precompile
|
|
a script. ksh93 is able to recognize files in this format and process
|
|
them as scripts. You can use shcomp to send out scripts when you
|
|
don't want to give away the original script source.
|
|
|
|
To be able to run setuid/setgid shell scripts, or scripts without read
|
|
permission, the SUID_EXEC compile option must be on, and ksh must be installed
|
|
in the /bin directory, the /usr/bin directory, the /usr/lbin directory,
|
|
or the /usr/local/bin directory and the name must end in sh. The program
|
|
suid_exec must be installed in the /etc directory, must be owned by root,
|
|
and must be a suid program. If you must install ksh in some other directory
|
|
and want to be able to run setuid/setgid and execute only scripts, then
|
|
you will have to change the source code file sh/suid_exec.c explicitly.
|
|
If you do not have ksh in one of these secure locations, /bin/sh will
|
|
be invoked with the -p options and will fail when you execute a setuid/setgid
|
|
and/or execute only script. Note, that ksh does not read the .profile
|
|
or $ENV file when it the real and effective user/group id's are not
|
|
equal.
|
|
|
|
The tests sub-directory contains a number of regression tests for ksh.
|
|
To run all these tests with the shell you just built, run the command
|
|
bin/shtests
|
|
For help and more options, type
|
|
bin/shtests --man
|
|
|
|
The file PROMO.mm is an advertisement that extolls the virtues of ksh.
|
|
The file sh.1 contains the troff (man) description of this Shell.
|
|
The file nval.3 contains the troff (man) description of the name-value
|
|
pair library that is needed for writing built-ins that need to
|
|
access shell variables.
|
|
|
|
The file sh.memo contains a draft troff (mm) memo describing ksh. The
|
|
file RELEASE88 contains the changes made for ksh88. The file RELEASE93
|
|
contains the changes made in this release since ksh-88. The file
|
|
RELEASE contains bug fixes made in this release since ksh-88. The file
|
|
COMPATIBILITY contains a list of incompatibilities with ksh-88. The
|
|
file bltins.mm is a draft troff (mm) memo describing how to write
|
|
built-in commands that can be loaded at run time.
|
|
|
|
Most of the work for internationalization has been done with ksh93.
|
|
The file ksh.msg is a generated file that contains error messages
|
|
that need to be translated. In addition, the function translate()
|
|
in sh/init.c has to be completed to interface with the dictionary
|
|
lookup. The translate function takes two argument, the string
|
|
that is to be translated and a type which is
|
|
0 when a library string needs translation.
|
|
1 when one of the error messages in ksh.msg needs translation.
|
|
2 when a string in a script needs translation. You use a $ in front
|
|
of a double quoted string in a script to indicate that it
|
|
needs translation. The -D option for ksh builds the dictionary.
|
|
The translate routine needs to return the translated message.
|
|
For dictionaries that need to use a numeric key, it should be
|
|
possible to use the strhash() function to generate numbers to
|
|
go along with each of the messages and to use this number both
|
|
when generating the dictionary and when converting strings.
|
|
If you encounter error messages of type 1 that are not be translated via
|
|
this translate() function send mail to the address below.
|
|
|
|
Please report any problems or suggestions to:
|
|
|
|
https://github.com/ksh93/ksh
|
|
|
|
|
|
ksh 93u+m 1.0.0 has been compiled and alpha tested on the following.
|
|
An asterisk signifies minor regression test failures (one or two minor
|
|
things amiss), two asterisks signify moderate regression test failures
|
|
(some functionality does not work), and three asterisks signify serious
|
|
failures (crashes, and/or essential functionality does not work).
|
|
|
|
* AIX 7.1 on RISC (PowerPC)
|
|
* DragonFly BSD 5.8 on x86_64
|
|
FreeBSD 12.2 on x86_64
|
|
FreeBSD 12.2 on arm64 (thanks to hyenias for donating access to a Pi)
|
|
GNU/Linux: Alpine 3.12.3 (musl C library) on x86_64
|
|
GNU/Linux: CentOS 8.2 on x86_64
|
|
GNU/Linux: Debian 10.7 on x86_64
|
|
GNU/Linux: Gentoo 2.7 on i386
|
|
GNU/Linux: NixOS 19.09 on x86_64
|
|
GNU/Linux: Slackware 14.2 on x86_64
|
|
GNU/Linux: Ubuntu 16.04 on x86_64
|
|
GNU/Linux: Void Linux (musl C library) on x86_64
|
|
*** HP-UX B.11.11 on pa-risc
|
|
* illumos: OmniOS 2020-08-19 (gcc) on x86_64
|
|
macOS 10.14.6 (Mojave) on x86_64
|
|
*** NetBSD 8.1 and 9.0 on x86_64
|
|
* OpenBSD 6.8 on x86_64
|
|
** QNX 6.5.0 on i386
|
|
* Solaris 11.4 (gcc) 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
|
|
|
|
Good luck!!
|
|
|
|
The ksh 93u+m contributors
|
|
https://github.com/ksh93/ksh
|
|
|
|
Originally written by:
|
|
David Korn
|
|
dgk@research.att.com
|
|
|