README-DEVELOPER 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /* $XConsortium: README-DEVELOPER /main/3 1996/07/15 14:12:13 drk $ */
  2. IMPORTANT!!! PLEASE READ ON!!
  3. ------------------------------
  4. The intention of this file is to outline the procedure to use, anytime
  5. a new update of the ksh-93 source is received. When you receive the
  6. new source package, you will first need to do the following:
  7. 0) mkdir ksh93-base
  8. 1) copy the packing into this directory
  9. 2) uudecode the package
  10. 3) uncompress the package
  11. 4) un-tar the package into ksh93-base (you may need to use
  12. cpio, if that is what Korn used to create his package).
  13. Once the source ball has been un-tar'ed, go down into the hierarchy,
  14. until you see a directory called 'ship' ; don't go down into the 'ship'
  15. directory, simply stop at its parent. Dave Korn uses his own mechanism
  16. for creating the actual ksh-93 sources. It's not like you can simply
  17. look at what is in the 'ship' directory. Instead, you need to run his
  18. 'shipin' tool, which takes his base source ball, and applies all of his
  19. patches, thus generating the source tree. To start this process, which
  20. will result in the latest source files being generated, issue the following
  21. commands:
  22. <First, log onto a 10.0 build machine, such as hpcvusp>
  23. /bin/ksh
  24. export SHELL=/bin/ksh
  25. nohup /bin/ksh ship/shipin -u -L&
  26. tail -f nohup.out
  27. When this completes, you will notice that the current directory now
  28. contains a series of other subdirectories; the only ones we really care
  29. about now are the 'man', 'ship' and the 'src' subdirectories.
  30. The trick now is to determine which of the files in
  31. these subdirectories have changed, so that you can update the real
  32. dtksh/ksh93 source tree. You will want to copy into the dtksh/ksh93/ship
  33. directory the newest versions of the following files:
  34. shipiffe.sh
  35. shipout
  36. shipin
  37. shipproto.c
  38. shipop.c
  39. Go into the 'shipin' file, and locate the several places where it attempts
  40. to mail out information (I look for the word 'mail', until I find what
  41. looks like the correct places). Remove this code, since we don't want
  42. a ton of mail messages happening each time we build.
  43. Within the 'ship' directory, you will notice a series of subdirectories;
  44. each one of these corresponds to one of the pieces making up the ksh93
  45. client (i.e. there is one for each library: libast, libcmd, libvdelta, etc).
  46. Within each of these subdirectories is another subdirectory, whose name
  47. represents the date that source depot was created (i.e. 950619). You will
  48. need to recreate these dated directories, along with their contents, within
  49. your dtksh tree (under dtksh/ksh93/ship). Within each dated directory,
  50. copy over (and check in) the items, copyright, UNCRATED and owner files.
  51. Check in a dummy 'base' file also. Doing these steps will allow the ksh
  52. build to proceed, without it ever again attempting to uncrate new ksh93
  53. sources. The 'items' file is particularly important, since it indicates
  54. which other libraries the indicated piece is dependent upon.
  55. ====================
  56. In /clone/fred/DtkshTools I have a collection of scripts which make it easier
  57. to update a dtksh tree with new ksh sources. The steps for determining which
  58. files have changed are as follows:
  59. 1) First get a list of all of the files in the new source tree. I do this
  60. with the following steps:
  61. cd ksh93-base (This is the tree you just untar'ed)
  62. find src -print > srcList
  63. This gives you a complete list of all of the source files.
  64. 2) Use this list to determine which source files are new or have changed:
  65. /clone/fred/DtkshTools/CheckKshSrc dtksh ksh93-base srcList > diffList
  66. The output generated by the above script will tell you which files have
  67. changed, which have not changed, and which have been added.
  68. 3) You now need to take the diffList, and modify it so that it only
  69. contains the name of new or changed files within the ksh93 source
  70. tree:
  71. /clone/fred/DtkshTools/CreateTrimList diffList > trimList
  72. 4) Now, we will delete the files in the dtksh tree which we are going
  73. to replace; we do this before we copy over the new versions:
  74. /clone/fred/DtkshTools/TrimOldSrcs /clone/fred/dtksh trimList
  75. 5) We now need to check out (Rcs -l) the files we are going to replace:
  76. /clone/fred/DtkshTools/CheckOutSrcs /clone/fred/dtksh trimList
  77. If at any time you want to get a complete list of checked out files
  78. in your dtksh tree, issue the following commands:
  79. find /clone/fred/dtksh -type d > dirList
  80. /clone/fred/DtkshTools/RunRcslocks dirList
  81. 6) We are now ready to copy the new source files out of the ksh93-base
  82. directory, and into the dtksh directory:
  83. cd /clone/fred
  84. /clone/fred/DtkshTools/CopyNewSrcs ksh93-base dtksh trimList
  85. ====================
  86. You're not done yet, however. We have found it necessary to modify
  87. several of the stock ksh sources, Makefiles and Mamfiles, to accomodate
  88. problems we have encountered, or to enable options not turned on by
  89. default, such as multibyte support. You will need to make sure that
  90. these changes get rolled back in, before checking in the new source.
  91. The following source files need to have changes added:
  92. src/cmd/ksh93/Makefile (*** THIS STEP IS OBSOLETE ***)
  93. ----------------------
  94. Change: MULTIBYTE ==
  95. To: MULTIBYTE == 1
  96. src/cmd/ksh93/Mamfile (*** THIS STEP IS OBSOLETE ***)
  97. ---------------------
  98. Change: setv MULTIBYTE -UMULTIBYTE
  99. To: setv MULTIBYTE -DMULTIBYTE
  100. src/cmd/ksh93/OPTIONS (*** THIS STEP IS OBSOLETE ***)
  101. ---------------------
  102. Change: MULTIBYTE=0
  103. To: MULTIBYTE=1
  104. ***
  105. The following two files must change, to prevent the ksh source from linking
  106. in its own malloc package. This creates problems on the IBM platform, due
  107. to the way their libraries are built. As it turns out, the IBM Xt library
  108. already has all of its malloc/free/etc calls resolved to their standard
  109. libc malloc functions. If ksh defines its own malloc package, then dtksh
  110. ends of effectively linked simultaneously to two different malloc packages.
  111. This rapidly leads to a core dump, due to cross contamination of the
  112. memory pools (i.e. A value obtained by XtMalloc() passed to free() ). As
  113. it turns out, this also creates problems on the HP platform, as was
  114. recently discovered (Note that it appears that the problem which was
  115. seen on the HP platform was due to a defect in the ksh93 memory allocation
  116. code; this defect had not yet been fixed in the ksh93-d release. Until
  117. the time that this is fixed, we must continue to be sure to not link
  118. in ksh93's malloc package).
  119. src/lib/libast/Makefile
  120. -----------------------
  121. Remove: calloc.c malloc.c from the list of sources
  122. src/lib/libast/Mamfile
  123. ----------------------
  124. Remove: calloc.o malloc.o from the archive line; DO NOT REMOVE
  125. ANY OF THE OTHER REFERENCES TO malloc OR calloc, AS
  126. THIS WILL CAUSE THE BUILD TO BREAK.
  127. ***
  128. Another file which needs special handling is builtins.c, which is in
  129. the base dtksh directory. This file was first created by taking the
  130. file 'dtksh/ksh93/src/cmd/ksh93/data/builtins.c', and adding into its
  131. list of builtin commands, the list we added for X, Xt, Xm and Dt. The
  132. best way to update this file is to first goto 'dtksh/ksh93/src/cmd/ksh93/data'
  133. and do an Rcsdiff, to find out what changes Dave Korn made. You will
  134. then make those same changes to the dtksh/builtins.c file.
  135. dtksh/builtins.c
  136. ----------------
  137. Fold in any changes made to dtksh/ksh93/src/cmd/ksh93/data/builtins.c
  138. ***
  139. Another file which needs special handling is aliases.c, which is in
  140. the base dtksh directory. This file was first created by taking the
  141. file 'dtksh/ksh93/src/cmd/ksh93/data/aliases.c', and adding into its
  142. list of commands aliases, the list we added for X, Xt, Xm and Dt. The
  143. best way to update this file is to first goto 'dtksh/ksh93/src/cmd/ksh93/data'
  144. and do an Rcsdiff, to find out what changes Dave Korn made. You will
  145. then make those same changes to the dtksh/aliases.c file.
  146. dtksh/aliases.c
  147. ---------------
  148. Fold in any changes made to dtksh/ksh93/src/cmd/ksh93/data/aliases.c
  149. HP-SPECIFIC Ksh-93 SOURCE MODIFICATIONS:
  150. ========================================
  151. The dtksh code requires a handful of changes to be made to the ksh93
  152. source itself. Most of these changes relate to either localization
  153. customizations, additional multibyte support, or fixes for environment
  154. variable mirroring. For each of the files listed below, two versions
  155. have been checked into the RCS vaults: the original (unaltered) version,
  156. and the version with our customizations. This will make it easy to
  157. determine the changes we have made, so that the next time we receive
  158. new code from Korn, it is a relatively simple task to again merge in the
  159. changes. Note that all of the changes relating to multibyte support
  160. have been passed onto David Korn, and that hopefully they will show up
  161. in the official source sometime in the future (after the ksh93-d release).
  162. Modification 1:
  163. ---------------
  164. The ksh (and dtksh) executables use a special client (suid_exec) when
  165. trying to execute an suid script; this special client makes sure that
  166. you really have permission to run the suid script. The client, as
  167. supplied by David Korn, has hardcoded assumptions about where it lives
  168. (/etc) and where the valid (and secure) places are where shells can
  169. live. We need to change this so that it knows the client lives in
  170. the cde tree, and that in addition to the normal 'safe' shell locations,
  171. /usr/dt/bin is also a safe location. To do this, the following changes
  172. must be made, each time new ksh source is received:
  173. dtksh/ksh93/src/cmd/ksh93/data/msg.c
  174. ------------------------------------
  175. Change:
  176. e_sysprofile = "/etc/profile";
  177. e_suidprofile = "/etc/suid_profile";
  178. e_suidexec = "/etc/suid_exec";
  179. To:
  180. e_sysprofile = PROFILEPATH;
  181. e_suidprofile = SUIDPROFILEPATH;
  182. e_suidexec = SUIDEXECPATH;
  183. dtksh/ksh93/src/cmd/ksh93/sh/suid_exec.c
  184. ----------------------------------------
  185. Change:
  186. #define THISPROG "/etc/suid_exec"
  187. To:
  188. #define THISPROG SUIDEXECPATH
  189. Also, search for the block of code like the following (around line 256):
  190. if (shell == 0 || !endsh(shell) || (
  191. !in_dir("/bin",shell) &&
  192. !in_dir("/usr/bin",shell) &&
  193. And change it as follows:
  194. if (shell == 0 || !endsh(shell) || (
  195. !in_dir(CDE_INSTALLATION_TOP"/bin",shell) &&
  196. !in_dir("/bin",shell) &&
  197. !in_dir("/usr/bin",shell) &&
  198. Modification 2:
  199. ---------------
  200. During CDE development, it was discovered that some shared library
  201. implementations (i.e. at least IBM) bound a shared library to all
  202. of its dependencies at the time that the library was build. This
  203. created problems for libraries which made getenv() or putenv()
  204. calls, because we expected those calls to be resolved against the
  205. getenv() and putenv() calls provided in the ksh93 libraries, not
  206. against the standard libc versions. This was a problem because
  207. ksh keeps track of its own environment, and does not pass the
  208. information on through to the standard libc environment. The result
  209. was that certain key pieces of information (i.e LANG) might be set
  210. by a shell script, but when calls where made to shared library functions,
  211. they would not see this setting. The fix is to modify the ksh93 code
  212. to *also* pass along any environment settings onto the libc functions;
  213. we call this 'environment variable mirroring'. We won't describe the
  214. exact changes here; you can find them by diff'ing the last two revisions
  215. for the following files:
  216. src/cmd/ksh93/include/nval.h (New field added to Namval structure)
  217. src/cmd/ksh93/sh/name.c (Mirroring code implemented here)
  218. Modification 3:
  219. ---------------
  220. There are a handful of multibyte and localization changes which we
  221. must make. Some of them relate to adding message catalog support
  222. to ksh, while others relate to making changes so that Japanese SJIS character
  223. will work. The files which must be modified are:
  224. src/cmd/ksh93/sh/init.c (Message cat and file desc locking/unlocking)
  225. src/cmd/ksh93/sh/lex.c (Japanese SJIS processing fixes)
  226. src/cmd/ksh93/sh/macro.c (Multibyte fixes)
  227. src/cmd/ksh93/bltins/print.c (SJIS multibyte fix to echo/print command)
  228. src/cmd/ksh93/sh/userinit.c (Add call to setlocale() in sh_userinit())
  229. Modification 4:
  230. ---------------
  231. During CDE development, USL needed to add an 'ifndef __USLC__' around
  232. a certain define. The file which needs the change is:
  233. src/lib/libast/sfio/sfhdr.h
  234. Modification 5:
  235. ---------------
  236. There appears to be a bug in the ksh93 build process, which shows up
  237. on the HP platform. David Korn was unable to find the cause, so we
  238. need to modify one of his build scripts:
  239. ksh93/src/cmd/ksh93/features/options.sh
  240. ---------------------------------------
  241. Towards the top of the script, there is the following set of
  242. statements:
  243. : get the option settings from the options file
  244. . $OPTIONS
  245. You need to modify this so that it is like the following:
  246. : get the option settings from the options file
  247. if [ -z "$OPTIONS" ] ; then
  248. OPTIONS="OPTIONS"
  249. fi
  250. . $OPTIONS
  251. =======================
  252. Each time a new release is received from Dave Korn, we also need to copy
  253. his latest ksh93 man page from src/cmd/ksh93/sh.1 into
  254. /x/cdesrc/doc/cde1/man/man1/ksh93. You will need to make one change to
  255. the man page, so that it prints out the ksh information, instead of sh
  256. information. The change is one approximately line 7.
  257. Change:
  258. -------
  259. .nr Z 0 \" set to 1 when command name is ksh rather than sh
  260. To:
  261. ---
  262. .nr Z 1 \" set to 1 when command name is ksh rather than sh
  263. ===================
  264. One last note. There is a shell script called 'MakeClean' in the root
  265. directory of the dtksh tree. This script cleans out files in the ksh93
  266. portion of the tree, which will force a complete build to occur. Since
  267. the ksh93 portion does not use Imake (it uses Mam or something bazarre
  268. like that), we needed to jury rig something which would act like our
  269. normal 'make clean' . If you discover any other ksh93 files which need
  270. to be removed during a 'make clean' operation, simply add another line
  271. to the MakeClean script. A good indication that a file needs to be
  272. added is if you make a clone from one of the source trees, do a 'make clean',
  273. start a 'make', and somewhere during the building of the ksh93 sources,
  274. you see an error message telling you that you did not have permission to
  275. overwrite something within your clone tree. The ksh93 build process builds
  276. alot of files on the fly, and moves things around to other directories, so
  277. these file typically need to be cleared out before doing a complete make.