README-DEVELOPER 15 KB

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