xref: /plan9/sys/src/ape/cmd/pdksh/README (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1*7dd7cddfSDavid du Colombier
2*7dd7cddfSDavid du ColombierLast updated Jul '99 for pdksh-5.2.14.
3*7dd7cddfSDavid du Colombier	(check ftp://ftp.cs.mun.ca:/pub/pdksh/ or
4*7dd7cddfSDavid du Colombier	 http://www.cs.mun.ca/~michael/pdksh/ for new versions/patches)
5*7dd7cddfSDavid du Colombier
6*7dd7cddfSDavid du ColombierPD-ksh is a mostly complete AT&T ksh look-alike (see NOTES file for a list
7*7dd7cddfSDavid du Colombierof things not supported).  Work is mostly finished to make it fully
8*7dd7cddfSDavid du Colombiercompatible with both POSIX and AT&T ksh (when the two don't conflict).
9*7dd7cddfSDavid du Colombier
10*7dd7cddfSDavid du ColombierSince pdksh is free and compiles and runs on most common unix systems, it
11*7dd7cddfSDavid du Colombieris very useful in creating a consistent user interface across multiple
12*7dd7cddfSDavid du Colombiermachines.  For example, in the CS dept. of MUN, pdksh is installed on a
13*7dd7cddfSDavid du Colombiervariety of machines including Suns, HPs, DecStations, pcs running Linux,
14*7dd7cddfSDavid du Colombieretc., and is the login shell of ~5200 users.
15*7dd7cddfSDavid du Colombier
16*7dd7cddfSDavid du ColombierPDksh is currently being maintained by Michael Rendell (michael@cs.mun.ca),
17*7dd7cddfSDavid du Colombierwho took over from Simon J. Gerraty (sjg@zen.void.oz.au) at the later's
18*7dd7cddfSDavid du Colombiersuggestion.  A short list of things that have been added since the last
19*7dd7cddfSDavid du Colombierpublic pdksh release (4.9) are auto-configuration, arrays, $(( .. )),
20*7dd7cddfSDavid du Colombier[[ .. ]], variable attributes, co-processes, extended file globbing,
21*7dd7cddfSDavid du Colombiermany POSIXisms and many bug fixes.  See the NEWS and ChangeLog files for
22*7dd7cddfSDavid du Colombierother features added and bugs fixed.
23*7dd7cddfSDavid du Colombier
24*7dd7cddfSDavid du ColombierNote that pdksh is provided AS IS, with NO WARRANTY, either expressed or
25*7dd7cddfSDavid du Colombierimplied.  Also note that although the bulk of the code in pdksh is in the
26*7dd7cddfSDavid du Colombierpublic domain, some files are copyrighten (but freely distributable) and
27*7dd7cddfSDavid du Colombiersubject to certain conditions (eg, don't remove copyright, document any
28*7dd7cddfSDavid du Colombierchanges, etc.).  See the LEGAL file for details.
29*7dd7cddfSDavid du Colombier
30*7dd7cddfSDavid du ColombierIf you would like to be notified via email of new releases as they become
31*7dd7cddfSDavid du Colombieravailable, send mail to pdksh-request@cs.mun.ca with subject
32*7dd7cddfSDavid du Colombier"send release notifications" (or "don't send release notifications" to stop
33*7dd7cddfSDavid du Colombierthem).
34*7dd7cddfSDavid du Colombier
35*7dd7cddfSDavid du Colombier
36*7dd7cddfSDavid du ColombierFiles of interest:
37*7dd7cddfSDavid du Colombier	NEWS		short list of noticeable changes in various versions.
38*7dd7cddfSDavid du Colombier	CONTRIBUTORS	short history of pdksh, people who contributed, etc.
39*7dd7cddfSDavid du Colombier	NOTES		lists of known bugs in pdksh, at&t ksh, and posix.
40*7dd7cddfSDavid du Colombier	PROJECTS	list of things that need to be done in pdksh.
41*7dd7cddfSDavid du Colombier	BUG-REPORTS	list of recently reported bugs that have been fixed
42*7dd7cddfSDavid du Colombier			and all reported bugs that haven't been fixed.
43*7dd7cddfSDavid du Colombier	LEGAL		A file detailing legal issues concerning pdksh.
44*7dd7cddfSDavid du Colombier	etc/*		system profile and kshrc files used by Simon J. Gerraty.
45*7dd7cddfSDavid du Colombier	misc/README*	readme files from previous versions.
46*7dd7cddfSDavid du Colombier	misc/Changes*	changelog files from previous versions.
47*7dd7cddfSDavid du Colombier	os2/*		files and info needed to compile ksh on os/2.
48*7dd7cddfSDavid du Colombier	tests/*		pdksh's regression testing system.
49*7dd7cddfSDavid du Colombier
50*7dd7cddfSDavid du Colombier
51*7dd7cddfSDavid du ColombierCompiling/Installing:
52*7dd7cddfSDavid du Colombier
53*7dd7cddfSDavid du Colombier  The quick way:
54*7dd7cddfSDavid du Colombier	./configure
55*7dd7cddfSDavid du Colombier	make
56*7dd7cddfSDavid du Colombier	make check	# optional
57*7dd7cddfSDavid du Colombier	make install	# will install /usr/local/bin/ksh
58*7dd7cddfSDavid du Colombier			#  and /usr/local/man/man1/ksh.1
59*7dd7cddfSDavid du Colombier	[add path-to-installed-pdksh to /etc/shells]
60*7dd7cddfSDavid du Colombier
61*7dd7cddfSDavid du Colombier  The more detailed description:
62*7dd7cddfSDavid du Colombier    * run "configure --help | your-favorite-pager" and look at the
63*7dd7cddfSDavid du Colombier      --enable-* and --disable-* options (they are at the end).
64*7dd7cddfSDavid du Colombier      Select any you options you wish to enable/disable
65*7dd7cddfSDavid du Colombier      (most people can skip this step).
66*7dd7cddfSDavid du Colombier    * run configure: this is a GNU autoconf configure script that will generate
67*7dd7cddfSDavid du Colombier      a Makefile and a config.h.  Some of the useful options to configure are:
68*7dd7cddfSDavid du Colombier	--prefix=PATH	    indicates the directory tree under which the binary
69*7dd7cddfSDavid du Colombier			    and man page are installed (ie, PATH/bin/ksh and
70*7dd7cddfSDavid du Colombier			    PATH/man/man1/ksh.1).
71*7dd7cddfSDavid du Colombier			    The default prefix is /usr/local.
72*7dd7cddfSDavid du Colombier	--exec-prefix=PATH  overrides --prefix for machine dependent files
73*7dd7cddfSDavid du Colombier			    (ie, the ksh binary)
74*7dd7cddfSDavid du Colombier	--program-prefix=pd install binary and man page as pdksh and pdksh.1
75*7dd7cddfSDavid du Colombier	--verbose	    show what is being defined as script runs
76*7dd7cddfSDavid du Colombier      Note that you don't have to build in the source directory.  To build
77*7dd7cddfSDavid du Colombier      in a separate directory, do something like:
78*7dd7cddfSDavid du Colombier		$ mkdir objs
79*7dd7cddfSDavid du Colombier		$ cd objs
80*7dd7cddfSDavid du Colombier		$ ../configure --verbose
81*7dd7cddfSDavid du Colombier		....
82*7dd7cddfSDavid du Colombier		$ make
83*7dd7cddfSDavid du Colombier      See the file INSTALL for a more complete description of configure and its
84*7dd7cddfSDavid du Colombier      generic options (ksh specific options are documented in the --help output)
85*7dd7cddfSDavid du Colombier    * miscellaneous configuration notes:
86*7dd7cddfSDavid du Colombier	* If your make doesn't understand VPATH, you must compile in
87*7dd7cddfSDavid du Colombier	  the source directory.
88*7dd7cddfSDavid du Colombier	* On DecStations, MIPS and SONY machines with older C compilers that
89*7dd7cddfSDavid du Colombier	  can't handle "int * volatile x", you should use gcc or turn off
90*7dd7cddfSDavid du Colombier	  optimization.  The problem is configure defines volatile to nothing
91*7dd7cddfSDavid du Colombier	  since the compiler can't handle it properly, but the compiler does
92*7dd7cddfSDavid du Colombier	  optimizations that the volatile is meant to prevent.   So.  Use gcc.
93*7dd7cddfSDavid du Colombier	* On MIPS RISC/os 5.0 systems, sysv environment, <signal.h> is
94*7dd7cddfSDavid du Colombier	  messed up - it defines sigset_t, but not any of the rest of
95*7dd7cddfSDavid du Colombier	  the posix signals (the sigset_t typedef should be in the
96*7dd7cddfSDavid du Colombier	  ifdef KERNEL section) - also doesn't have waitpid() or wait3().
97*7dd7cddfSDavid du Colombier	  Things compile up ok in the svr4 environment, but it dumps core
98*7dd7cddfSDavid du Colombier	  in __start (perhaps our system doesn't have the full svr4
99*7dd7cddfSDavid du Colombier	  environ?).  Try compiling in the bsd43 environ instead (still not
100*7dd7cddfSDavid du Colombier	  perfect - see BUG-REPORTS file), using gcc - cc has problems with
101*7dd7cddfSDavid du Colombier	  macro expansions in the argument of a macro (in this case, the ARGS
102*7dd7cddfSDavid du Colombier	  macro).
103*7dd7cddfSDavid du Colombier	* On TitanOS (Stardent/Titan), use `CC="cc -43" configure ...'.
104*7dd7cddfSDavid du Colombier	  When configure finishes, edit config.h, undef HAVE_DIRENT_H and
105*7dd7cddfSDavid du Colombier	  define HAVE_SYS_DIR_H (the dirent.h header file is broken).
106*7dd7cddfSDavid du Colombier	* On Linux (red hat distribution), check that /dev/tty has mode 0666
107*7dd7cddfSDavid du Colombier	  (not mode 0644).  If it has the wrong permissions, ksh will print
108*7dd7cddfSDavid du Colombier	  warnings about not being able to do job control.
109*7dd7cddfSDavid du Colombier	* on NeXT machines (3.2, probably other releases), the siglist.out file
110*7dd7cddfSDavid du Colombier	  won't be generated correctly if you try to use the system's compiler
111*7dd7cddfSDavid du Colombier	  (it has a broken cc -E and strange header files).  There are two
112*7dd7cddfSDavid du Colombier	  ways to make it work:
113*7dd7cddfSDavid du Colombier	    1) if you have gcc, use it (for everything).  Alternatively,
114*7dd7cddfSDavid du Colombier	       force configure to use it for CPP, i.e., use
115*7dd7cddfSDavid du Colombier		  CPP="gcc -E" configure ...
116*7dd7cddfSDavid du Colombier	    2) Force configure to use some extra CPPFLAGS, using
117*7dd7cddfSDavid du Colombier		  CPPFLAGS="XXX" configure ...
118*7dd7cddfSDavid du Colombier	       where XXX is obtained from running "cc -v YYY.c" on some
119*7dd7cddfSDavid du Colombier	       C file.  Look at the options passed to cpp (there are lots
120*7dd7cddfSDavid du Colombier	       of them...) and replace the XXX above with them.
121*7dd7cddfSDavid du Colombier	  Make sure you do a "make distclean" (or "rm config.cache") if
122*7dd7cddfSDavid du Colombier	  you re-run configure with a difference CPP or CPPFLAGS.
123*7dd7cddfSDavid du Colombier	  Also note that if you are building multiple arch binaries, you
124*7dd7cddfSDavid du Colombier	  will have to specify both CC and CPP.
125*7dd7cddfSDavid du Colombier    * run make: everything should compile and link without problems.
126*7dd7cddfSDavid du Colombier    * run make check: this fires up a perl script that checks for some known
127*7dd7cddfSDavid du Colombier      and some fixed bugs.  The script prints pass/fail for tests it expected
128*7dd7cddfSDavid du Colombier      to pass/fail, and PASS/FAIL for tests it expected to fail/pass.  If you
129*7dd7cddfSDavid du Colombier      don't have perl, or if your perl doesn't work (most common problem is
130*7dd7cddfSDavid du Colombier      the .ph header files are missing or broken), you can run
131*7dd7cddfSDavid du Colombier	  ENV= path-to-pdksh-executable misc/Bugs path-to-pdksh-executable
132*7dd7cddfSDavid du Colombier      instead.
133*7dd7cddfSDavid du Colombier    * run make install: this installs ksh (in /usr/local/bin/ksh by default,
134*7dd7cddfSDavid du Colombier      or where ever you told configure to put things).
135*7dd7cddfSDavid du Colombier    * add path-to-installed-pdksh to /etc/shells if it's not already there.
136*7dd7cddfSDavid du Colombier      This is only needed if you intend to use pdksh as a login shell (things
137*7dd7cddfSDavid du Colombier      like ftp won't allow users to connect in if their shell isn't in this
138*7dd7cddfSDavid du Colombier      file).
139*7dd7cddfSDavid du Colombier
140*7dd7cddfSDavid du ColombierThe following is a list of machines that pdksh is reported to work on:
141*7dd7cddfSDavid du Colombier    -/PC Linux 1.x,2.x
142*7dd7cddfSDavid du Colombier    -/PC NetBSD 0.9a
143*7dd7cddfSDavid du Colombier    -/PC BSDI 1.1
144*7dd7cddfSDavid du Colombier    -/PC FreeBSD 2.x, 3.x
145*7dd7cddfSDavid du Colombier    -/PC OpenBSD
146*7dd7cddfSDavid du Colombier    -/PC Interactive/Sunsoft 3.0.1 and 4.1 (note that problems have been
147*7dd7cddfSDavid du Colombier	    reported with isc3.2 - see the BUG-REPORTS file)
148*7dd7cddfSDavid du Colombier    -/PC OS/2
149*7dd7cddfSDavid du Colombier    Commadore/Amiga NetBSD 1.0
150*7dd7cddfSDavid du Colombier    Dec/alpha OSF/1 v2.x, v3.x
151*7dd7cddfSDavid du Colombier    Dec/alpha NetBSD 1.1B
152*7dd7cddfSDavid du Colombier    Dec/pmax Ultrix 4.2
153*7dd7cddfSDavid du Colombier    Dec/vax Ultrix 2.2 (not tested recently :-))
154*7dd7cddfSDavid du Colombier    Dec/vax 4.3BSD+NFS (MtXinu) (not tested recently :-))
155*7dd7cddfSDavid du Colombier    HP/pa HP-UX 9.01
156*7dd7cddfSDavid du Colombier    IBM/RS/6000 AIX 3.2.5
157*7dd7cddfSDavid du Colombier    MIPS/m120 RISC/os 5.0 (bsd43 environ)
158*7dd7cddfSDavid du Colombier    NeXT NeXTStep 3.2
159*7dd7cddfSDavid du Colombier    SGI/IRIX 6.2
160*7dd7cddfSDavid du Colombier    Sun/sun4 SunOS 4.1.3, 4.1.4
161*7dd7cddfSDavid du Colombier    Sun/sun4 Solaris 2.x
162*7dd7cddfSDavid du Colombier    Sun/sun386i SunOS 4.0.2
163*7dd7cddfSDavid du Colombier    Sun/sun3 SunOS 4.0.3, 4.1.1_U1
164*7dd7cddfSDavid du Colombier    Stardent/TitanOS 4.2
165*7dd7cddfSDavid du Colombier
166*7dd7cddfSDavid du Colombier
167*7dd7cddfSDavid du ColombierNewer versions of pdksh may be available from
168*7dd7cddfSDavid du Colombier	ftp://ftp.cs.mun.ca:/pub/pdksh/
169*7dd7cddfSDavid du Colombieryou may want to check for one if you run into any problems, as the problem may
170*7dd7cddfSDavid du Colombieralready be fixed (you can get new release notifications automatically - see
171*7dd7cddfSDavid du Colombierabove).  The file pdksh-unstable-XXX.tar.gz has the very latest version which
172*7dd7cddfSDavid du Colombiermay not compile (it is generated automatically when changes are detected
173*7dd7cddfSDavid du Colombierin the main source repository) - it is for those who want to follow
174*7dd7cddfSDavid du Colombierchanges as they are made.
175*7dd7cddfSDavid du Colombier
176*7dd7cddfSDavid du ColombierYou can send bug reports, fixes, and enhancements to pdksh@cs.mun.ca (please
177*7dd7cddfSDavid du Colombierdon't assume I will see bug reports that are posted to some newsgroup or
178*7dd7cddfSDavid du Colombiermailing list - I probably won't).
179*7dd7cddfSDavid du ColombierIf you are reporting a bug (with or without a fix), please include
180*7dd7cddfSDavid du Colombier	* the version of pdksh you are using (see version.c, or, if you are
181*7dd7cddfSDavid du Colombier	  running pdksh, try echo $KSH_VERSION),
182*7dd7cddfSDavid du Colombier	* the machine, operating system and compiler you are using,
183*7dd7cddfSDavid du Colombier	* and a description of how to repeat the bug (a small shell
184*7dd7cddfSDavid du Colombier	  script that demonstrates the bug is best).
185*7dd7cddfSDavid du Colombieras well as the following, if relevant (if you aren't sure, include them)
186*7dd7cddfSDavid du Colombier	* what options you are using (both configure options and set -o options)
187*7dd7cddfSDavid du Colombier	* the output of configure, with the verbose flag
188*7dd7cddfSDavid du Colombier	  (eg, make distclean; ./configure --verbose)
189*7dd7cddfSDavid du Colombier	* the contents of config.log (this is created by the configure script)
190*7dd7cddfSDavid du Colombier	* if you are using gcc (the GNU C compiler), which version it is.
191*7dd7cddfSDavid du Colombier
192*7dd7cddfSDavid du ColombierBTW, THE MOST FREQUENTLY REPORTED BUG IS
193*7dd7cddfSDavid du Colombier	echo hi | read a; echo $a	# Does not print hi
194*7dd7cddfSDavid du ColombierI'm aware of this and there is no need to report it.
195*7dd7cddfSDavid du Colombier
196*7dd7cddfSDavid du ColombierMichael Rendell, michael@cs.mun.ca
197