home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / doc / problems < prev    next >
Text File  |  1995-04-27  |  32KB  |  1,118 lines

  1. .Ch "Known Porting Problems With C News"
  2. .Ix problems porting
  3. .SH
  4. Intro
  5. .PP
  6. C News
  7. in general is pretty portable.
  8. People have got it to run on a very wide range of systems with little
  9. trouble.
  10. Difficulties are usually problems in the system,
  11. not
  12. C News.
  13. Some of them,
  14. however,
  15. are widespread enough to be worth comment,
  16. for
  17. the guidance of people having problems.
  18. If you run into a novel problem,
  19. we are always interested in hearing about such things.
  20. .SH
  21. Unix Dependencies
  22. .PP
  23. The biggest portability glitch in
  24. C News
  25. is that it depends a lot on
  26. Unix
  27. utilities.
  28. The extensive use of complex shell files,
  29. \fIsed\fR and \fIawk\fR programs,
  30. and a wide range of lesser Unix utilities would make it quite difficult
  31. to move
  32. C News
  33. to a system that is seriously non-Unix-like.
  34. The actual C programs seldom depend on Unix in major ways.
  35. (An exception is the use
  36. of \fIread\fR system calls in \fIexpire\fR,
  37. to avoid difficulties with
  38. stdio end-of-file behavior;
  39. we now know how to avoid this but haven't implemented the fixes yet.)
  40. .PP
  41. .Ix Unix Minix
  42. .Ix Unix utilities
  43. .Ix sed
  44. .Ix awk
  45. We know that \fIawk\fR and the colon (:) operator of \fIexpr\fR are
  46. problem areas under Minix.
  47. .SH
  48. Shell Problems
  49. .PP
  50. C News seriously stress-tests shells.
  51. The current Minix shell is not robust enough
  52. in the face of complex inputs,
  53. botches some constructs entirely,
  54. and can run out of memory on the complex shell files.
  55. Any shell that is too old to implement comments begun
  56. by ``#'' is big trouble,
  57. since we use such comments everywhere.
  58. .PP
  59. Any system/shell combination that thinks that a shell script starting
  60. with ``#!\ /bin/sh'' should be run by the C Shell (because it starts
  61. with `#') is also big trouble:
  62. you will have to change that line to ``:\ use\ /bin/sh'' everywhere.
  63. We know that at least some releases of Xenix have this problem.
  64. It is not necessary that your kernel understand the ``#!'' feature\(emwe
  65. believe that nothing in C News relies on it\(embut it is essential that
  66. it not cause invocation of the C Shell.
  67. .PP
  68. We know that some Hewlett-Packard Unixes have broken shells,
  69. probably
  70. the result of mistakes in
  71. HP's efforts to make
  72. the shell 8-bit-clean;
  73. the symptom is
  74. that something like:
  75. .DS
  76. .ft B
  77. x=y
  78. if test " $x" != " y"
  79. then
  80.     echo oops
  81. fi
  82. .ft
  83. .DE
  84. prints ``oops''.
  85. This is,
  86. again,
  87. big trouble,
  88. because we do that a lot.
  89. .PP
  90. .Ix machines 3b1
  91. .Ix 3b1
  92. Many people using 3B1s,
  93. aka UNIX PCs,
  94. run the Korn shell as their \fI/bin/sh\fR.
  95. .Ix shell Korn
  96. .Ix ksh
  97. Some other folks may do this too.
  98. Beware that \fIksh\fR was not fully \fIsh\fR-compatible for a
  99. long time,
  100. with some subtle differences in the
  101. ill-documented behavior of backquotes and backslashes.
  102. Some of the C News shell scripts,
  103. notably \fIinews\fR,
  104. are known to hit these bugs.
  105. We are \fItold\fR that current \fIksh\fRs have fixed them.
  106. .PP
  107. .Ix Unix SunOS 4.0
  108. It is reliably reported that SunOS 4.0.\fIx\fR shells will dump core
  109. in some ill-defined circumstances,
  110. when the user environment (sum of all
  111. environment variables) is exactly the wrong size.
  112. Perhaps this has been fixed in 4.1.
  113. .PP
  114. .Ix Unix "Ultrix 3.1"
  115. It is reliably reported that the VAX 3.1 Ultrix shell is somewhat broken
  116. and gives various kinds of trouble.
  117. Switching to \fI/bin/sh5\fR
  118. (note that this requires fixing the first line
  119. of a zillion shell files)
  120. is reported to banish the problems.
  121. .SH
  122. Make Problems
  123. .PP
  124. .Ix make
  125. .Ix machines 3b2
  126. .Ix 3b2
  127. .Ix SVID
  128. .Ix Unix A/UX
  129. There is a persistent problem on 3B2s with implementations of \fImake\fR
  130. that violate the SVID in a subtle way.
  131. They attempt to execute makefile commands directly,
  132. rather than via the
  133. shell,
  134. if the commands do not contain metacharacters.
  135. This means that if\(emas on many 3B2s\(em\fItest\fR is a shell builtin
  136. \fIand there is no /bin/test program\fR,
  137. the makefile line
  138. ``test\ \-s\ file'' will cause \fImake\fR to complain about an unknown
  139. command.
  140. (The SVID says that makefile commands must be executed as if by
  141. the shell, and the shell will execute this line correctly.)
  142. We've added `;' on the ends of such lines,
  143. which suffices to convince
  144. \fImake\fR to run a shell on the systems we've encountered,
  145. but AT&T
  146. is good at finding ways to break such workarounds.
  147. This problem is also known to occur in A/UX.
  148. .PP
  149. .Ix Unix Ultrix
  150. Another obscure problem,
  151. a bug in either \fImake\fR or the shell,
  152. appears
  153. in at least some releases of Ultrix:
  154. a construct like
  155. .DS
  156. .ft B
  157.     ln ... || cp ...
  158. .ft
  159. .DE
  160. in a shell file is seen as an error\(emand \fImake\fR aborts\(emwhen
  161. the \fIln\fR fails,
  162. even though the \fIcp\fR would work.
  163. .SH
  164. Offsetof
  165. .Ix offsetof
  166. .Ix "ANSI C"
  167. .PP
  168. ANSI C requires C compilers to supply a macro \fIoffsetof\fR,
  169. which can
  170. be used to find the offset of a structure member within the structure.
  171. \fIRelaynews\fR's header-parsing code uses it,
  172. defining it if the system has not supplied it.
  173. Unfortunately,
  174. it is really hard to write a portable version of this.
  175. The implementation we currently use is:
  176. .DS
  177. .ft B
  178. #define offsetof(type, mem) ((char *)&((type *)NULL)\->mem \- (char *)NULL)
  179. .ft
  180. .DE
  181. The table in \fIrelay/hdrdefs.c\fR
  182. .Ix initializers
  183. .Ix hdrdefs.c
  184. puts invocations of \fIoffsetof\fR in initializers.
  185. This turns out to be a severe stress test for C compilers.
  186. A compilation error in \fIhdrdefs.c\fR is almost certain
  187. to be problems with this macro.
  188. Some compilers,
  189. notably the one in Microport System V for the 286,
  190. .Ix Unix "Microport System V for the 286"
  191. reject it.
  192. We have heard a report that System V Release 2 on the VAX silently
  193. miscompiles it!
  194. .Ix Unix "System V Release 2 on the VAX"
  195. If you have trouble with \fIoffsetof\fR,
  196. you might try this version instead:
  197. .DS
  198. .ft B
  199. #define offsetof(type, mem) ((int)&((type *)NULL)\->mem)
  200. .ft
  201. .DE
  202. .SH
  203. Fast Stdio Routines
  204. .Ix stdio "faster internals"
  205. .Ix problems stdio
  206. .PP
  207. We supply a set of fast standard-I/O routines that are compatible with
  208. most AT&T-derived implementations of \fIstdio\fR.
  209. They speed up C News quite a bit.
  210. However,
  211. they don't work on all Unixes.
  212. The tester program we supply,
  213. which the library-build procedure runs,
  214. is thought to diagnose such problems 100% of the time.
  215. It has been reported in the past that A/UX and Microport 386 stdios
  216. .Ix Unix A/UX
  217. .Ix Unix "Microport 386"
  218. flunk the test.
  219. SunOS 4.0 used to pass the test falsely,
  220. but improvements in both
  221. the test and the routines
  222. seem to have cured the problems:
  223. 4.0.3 passes the test and
  224. as far as we can tell,
  225. the routines run correctly under it.
  226. .PP
  227. In any case,
  228. if you are feeling nervous or are having mysterious problems,
  229. telling \fIbuild\fR that you don't want to use the fast-stdio stuff is
  230. always safe.
  231. This is also the best response if you have trouble compiling those routines.
  232. .SH
  233. void
  234. .Ix void
  235. .Ix "old compilers"
  236. .PP
  237. Old compilers that don't understand the \fIvoid\fR type will choke on
  238. much of our code.
  239. .Ix news.h
  240. There is a commented-out ``#define\ void\ int'' in \fInews.h\fR that
  241. cures most cases of this if you uncomment it.
  242. (We have a report that you might need to add ``\-Dvoid=int'' to the
  243. Makefile in \fIlibv7\fR if you're using that library.)
  244. C News does not rely on the ANSI C ``void\ *'' type as far as we know.
  245. .SH
  246. Modes in fopen
  247. .Ix fopen
  248. .Ix Unix Minix
  249. .PP
  250. Unix V7 documented only ``r'',
  251. ``w'',
  252. and ``a'' as suitable mode arguments
  253. to \fIfopen\fR.
  254. It actually implemented the read/write modes,
  255. ``r+'',
  256. ``w+'',
  257. and ``a+'',
  258. as well,
  259. and C News relies on them.
  260. Unix reimplementations based on old documentation may have trouble here;
  261. we know that at least the older versions of Minix really don't implement
  262. these modes.
  263. .PP
  264. A related complication in Minix is that \fIftell\fR
  265. reportedly doesn't give the
  266. right answer in ``a'' mode.
  267. This makes \fIdbz\fR flunk its regression test.
  268. .Ix dbz
  269. .SH
  270. MAXLONG
  271. .Ix MAXLONG
  272. .Ix Unix Unisys
  273. .PP
  274. The \fIrelay/cpu.h\fR file formerly defined a constant \fIMAXLONG\fR
  275. which is the biggest positive value of a \fIlong\fR.
  276. The definition was clever but failed on some odd systems (Unisys?).
  277. Current versions of C News
  278. generate the value dynamically in a less fallible way,
  279. and check the value for plausibility.
  280. (This is encountered when \fIrelaynews\fR is asked to
  281. process a single article,
  282. not a batch.
  283. This happens primarily when an article is posted locally,
  284. with \fIinews\fR.)
  285. .Ix inews
  286. It is still barely possible that the plausibility check will fail on some
  287. bizarre system.
  288. .SH
  289. df Output Format
  290. .Ix df
  291. .PP
  292. .Ix spacefor
  293. The \fIspacefor\fR utility needs to understand the output format of \fIdf\fR,
  294. unless you're lucky enough to have a system that has one of the semi-standard
  295. system calls to report disk space.
  296. There are numerous variations on \fIdf\fR.
  297. \fIBuild\fR and the relevant makefiles know about the more common ones,
  298. but customization may be necessary.
  299. \fISpacefor\fR is commented well enough that it should be possible to
  300. figure out the necessary changes;
  301. usually the initializations of \fInr\fR
  302. and \fInf\fR are all that need changing.
  303. If there are colons (:)
  304. in your \fIdf\fR's output format,
  305. you should
  306. probably start from the ``sysv'' \fIspacefor\fR,
  307. which attempts to
  308. preprocess the output to get rid of System V garbage;
  309. .Ix Unix "System V"
  310. .Ix "System V" breakage
  311. otherwise the ``bsd'' one is a reasonable starting point.
  312. .PP
  313. One constant nuisance is \fIdf\fRs that are too stupid to take a directory
  314. name as an argument.
  315. The long-term solution to this is to edit a suitable variant of \fIspacefor\fR
  316. to know about the proper arguments.
  317. A short-term solution is to use the ``null'' variant, sacrificing space
  318. checking for the sake of getting something working.
  319. .PP
  320. .Ix Unix HP-UX
  321. We're told that HP-UX 7.0 users are best advised to
  322. choose the ``bsd'' variant of spacefor,
  323. and edit it to
  324. call \fIbdf\fR instead of \fIdf\fR.
  325. Similar approaches may be useful on other hybrid SysV/BSD systems.
  326. .SH
  327. Floating Point
  328. .Ix "floating point"
  329. .Ix expire
  330. .Ix awk
  331. .PP
  332. The only places in our code where floating point is used,
  333. as far as we know,
  334. are in the calculation of expiry dates in \fIexpire\fR
  335. and the calculation of space in some of the variants of \fIspacefor\fR.
  336. These are not performance bottlenecks,
  337. so slow floating-point arithmetic
  338. is not a problem.
  339. Complete absence of floating point would require only minor modifications.
  340. Note,
  341. however,
  342. that we use \fIawk\fR a lot,
  343. and the typical \fIawk\fR
  344. implementation uses floating point extensively.
  345. .SH
  346. 386 Optimizer vs. dbz
  347. .Ix machines 386
  348. .Ix dbz
  349. .Ix problems "broken 386 optimiser"
  350. .Ix Unix "System V"
  351. .Ix "System V" breakage
  352. .Ix Unix "SCO Xenix/386 2.3"
  353. .PP
  354. We have a reliable report that the System V 386 optimizer
  355. (invoked when
  356. \fIcc\fR is given the \fB\-O\fR option)
  357. miscompiles the \fIdbz\fR package
  358. badly enough to cripple it,
  359. without producing any error messages.
  360. The only fix is to compile \fIdbz\fR without \fB\-O\fR.
  361. .PP
  362. SCO Xenix/386 2.3 has the same problem.
  363. .SH
  364. nnafree and nnfree
  365. .Ix nnafree
  366. .Ix nnfree
  367. .Ix machines HP
  368. .PP
  369. We have a reliable report that
  370. the HP Spectrum C compiler has an optimiser bug that makes it throw up
  371. (with a 
  372. ``cc: Internal error 3279: Please contact your local HP representative''
  373. message)
  374. on the \fInnafree\fR macro
  375. (and \fInnfree\fR, a historical synonym)
  376. in \fIh/news.h\fR.
  377. .Ix news.h
  378. The following revised version of
  379. the macro reportedly avoids
  380. the problem.
  381. .DS
  382. .ft B
  383. #define nnafree(mempp) do { if (*(mempp) != 0) { free((char *)*(mempp)); \e
  384.    *(mempp) = 0; }} while (0)
  385. .ft
  386. .DE
  387. .PP
  388. .Ix Unix Microport
  389. It is also reliably reported that the Microport compiler objects to
  390. these macros in large model.
  391. Whether the above fix would suffice is not known.
  392. Manual expansion
  393. [barf!]
  394. is known to work,
  395. although it would be less
  396. painful to define a function containing the right code and change the
  397. macro to call the function.
  398. Code for a suitable function can,
  399. in fact,
  400. be found
  401. in \fIh/news.h\fR,
  402. inside `#ifdef\ lint'.
  403. .SH
  404. ANSI C
  405. .Ix "ANSI C"
  406. .PP
  407. Although we made an effort to be ANSI-C compatible,
  408. lack of access to a real ANSI C compiler limits our ability to do this.
  409. A secondary problem is that it's really very difficult to get code that
  410. is 100% acceptable to both ANSI C compilers and older compilers.
  411. Some issues inevitably got resolved in favor of current compilers,
  412. and may cause complaints from ANSI C compilers.
  413. .PP
  414. Work is in progress on moving us closer to ANSI compatibility.
  415. Beware that if \fB__STDC__\fR is defined
  416. .Ix __STDC__
  417. by your compiler but it is \fInot\fR ANSI compatible, you are on your
  418. own as far as we're concerned, even if the value is specified as 0.
  419. (We can't just use ``#if\ __STDC__'' because some preprocessors choke
  420. on the appearance of an unknown identifier in #if.)
  421. .SH
  422. GNU C
  423. .Ix "GNU C"
  424. .PP
  425. If compiling with the GNU compiler,
  426. you may need the
  427. \fB\-traditional\fR flag.
  428. Beware,
  429. also,
  430. that if you are using your system's \fIdbm\fR library,
  431. it contains functions that return structure values,
  432. and the GNU conventions
  433. for handling such values are incompatible with the ones in many AT&T-derived
  434. compilers.
  435. The
  436. \fB\-fpcc-struct-return\fR option cures this.
  437. .SH
  438. Awk Problems
  439. .Ix awk
  440. .PP
  441. A number of problems can arise if your \fIawk\fR has bugs,
  442. since the shell
  443. files rely on \fIawk\fR fairly extensively.
  444. For example,
  445. \fIawk\fR is a prime suspect if \fIspacefor\fR doesn't work.
  446. We've fixed the worst trouble spots,
  447. but would appreciate detailed information
  448. on any more.
  449. .PP
  450. .Ix awk "line length limits"
  451. One known problem that is hard to avoid is line-length limits in \fIawk\fR.
  452. In particular,
  453. for several purposes in control-message
  454. handling C News wants to build a ``canonical'' representation
  455. of the \fIsys\fR file,
  456. with backslashed newlines removed.
  457. This is done by
  458. NEWSBIN\fI/canonsys.awk\fR.
  459. .Ix canonsys.awk
  460. Most \fIawk\fRs have limits
  461. on line length,
  462. and some of the limits are too low to cope with long
  463. multiply-continued \fIsys\fR lines.
  464. 512-byte limits,
  465. found in a number of old \fIawk\fRs,
  466. are particularly troublesome.
  467. A quick look indicates that this will interfere,
  468. to some uncertain extent,
  469. with \fIcheckgroups\fR and \fIsendsys\fR.
  470. .Ix checkgroups
  471. .Ix "control messages" checkgroups
  472. .Ix sendsys
  473. .Ix "control messages" sendsys
  474. Big deal. :-)
  475. The complaint may also appear from
  476. \fInewgroup\fR,
  477. .Ix newgroup
  478. .Ix "control messages" newgroup
  479. but there it should be harmless.
  480. .PP
  481. .Ix Unix HP-UX
  482. Bart Muyzer and Martijn
  483. Roos Lindgreen report that HP-UX 8.0 \fIawk\fR is badly broken,
  484. such that
  485. (for example)
  486. the regular expression ``/[\et ]/'' will match backslashes
  487. and t's as well as tabs and spaces.
  488. Installing the HP-UX 7.0 \fInawk\fR as \fIawk\fR is reportedly a workable
  489. fix.
  490. .SH
  491. Systems Without Hard Links
  492. .Ix links
  493. .PP
  494. .Ix Unix unoid
  495. Some vaguely Unixoid systems have trouble implementing real (``hard'') links.
  496. Examples are VMS in general and Eunice in particular.
  497. .Ix VMS
  498. .Ix Eunice
  499. There are some hooks for dealing with this,
  500. but it's not trivial.
  501. .PP
  502. .Ix relaynews
  503. \fIRelaynews\fR will try to make symbolic links if real ones fail,
  504. and copies if both fail.
  505. .Ix expire
  506. .Ix doexpire
  507. If symbolic links are used,
  508. .I doexpire
  509. will automatically invoke
  510. \fIexpire\fR with the \fB\-l\fR option,
  511. which
  512. tells it to consider the first filename of an article its `leader',
  513. not expiring the article under that name until it has expired under
  514. all others.
  515. This has not been tested much recently.
  516. .PP
  517. .Ix lock
  518. The locking system (both C routines and the \fInewslock\fR program)
  519. will need revision in some system-dependent way to avoid use of links.
  520. .PP
  521. There is one minor use of links in installation
  522. (\fIinews\fR is found
  523. in two places,
  524. and the Makefile attempts a link before doing a copy),
  525. and substantially more in the regression tests.
  526. .SH
  527. 16-bit Machines
  528. .Ix machines small
  529. .Ix machines PDP-11
  530. .PP
  531. C News
  532. has been tested on 16-bit machines\(emindeed,
  533. a good bit of the
  534. early development work was done on one\(emand does run on them.
  535. Nothing relies on ints being 32 bits.
  536. Nothing relies on pointers and ints being the same size,
  537. as far as we know.
  538. Nothing relies on large address spaces,
  539. although one or two modules come in separate small-space and large-space
  540. versions,
  541. and the small-space versions are slower.
  542. .PP
  543. However,
  544. there are some fundamental limits
  545. to consider.
  546. Both \fIrelaynews\fR and \fIexpire\fR\(emthe usual trouble spots for
  547. space shortages\(emwant to keep lots of stuff in core.
  548. There isn't any easy way around this one.
  549. .SH
  550. Number of File Descriptors
  551. .Ix "file descriptors"
  552. .PP
  553. There is a constant,
  554. NOPENBFS,
  555. in \fIrelay/trbatch.c\fR,
  556. .Ix relay/trbatch.c
  557. .Ix relaynews
  558. that defines
  559. how many batch files are kept open simultaneously.
  560. If you are feeding much news to more systems than this,
  561. \fIrelaynews\fR performance will suffer.
  562. .PP
  563. .Ix NOPENBFS
  564. The major limit on NOPENBFS is available file descriptors
  565. (although on a 16-bit machine there might also be a shortage of memory
  566. for \fIstdio\fR buffers).
  567. Other parts of \fIrelaynews\fR want perhaps 10 file descriptors for
  568. other purposes,
  569. so with the usual total supply of 20,
  570. a NOPENBFS value
  571. of 10 is the right default.
  572. If you feed many people,
  573. and your kernel provides a process with more than 20 file
  574. descriptors,
  575. you probably want to boost
  576. NOPENBFS (this can be done with -DNOPENBFS=xxx in the makefile).
  577. Remember to leave about 10 descriptors worth of headroom.
  578. .SH
  579. Shell Processing Order
  580. .Ix shell
  581. .Ix problems shell
  582. .PP
  583. Normally,
  584. shell
  585. variable expansion should take place before scanning for syntax
  586. elements such as ``0<&1''.
  587. At least one reimplementation of the shell
  588. (specifically, Bash 1.04)
  589. does things in the
  590. wrong order.
  591. This is known to affect,
  592. at least,
  593. \fIrelay/sh/anne.jones\fR,
  594. .Ix anne.jones
  595. which can be fixed by changing (circa line 44)
  596. .DS
  597. .ft B
  598. "")    USER="`who am i <&$fd |
  599. .ft
  600. .DE
  601. to
  602. .DS
  603. .ft B
  604. "")    USER="`eval \e"who am i <&$fd\e" |
  605. .ft
  606. .DE
  607. or so we are told.
  608. .SH
  609. Binary-Mode Fopen
  610. .Ix fopen
  611. .Ix "ANSI C"
  612. .Ix dbz
  613. .PP
  614. In several places,
  615. the new
  616. \fIdbz\fR
  617. uses ANSI C ``binary mode'' fopen codes,
  618. e.g.
  619. `fopen(...,\ "r+b")'.
  620. The text/binary distinction involved is meaningless
  621. under Unix,
  622. and most Unix implementations just ignore trailing nonsense in
  623. the second argument of
  624. \fIfopen\fR,
  625. so it all works out nicely.
  626. .PP
  627. .Ix Unix Ultrix
  628. Unfortunately... at least one version of DEC's Ultrix objects to the `b's,
  629. we are told.
  630. Sigh.
  631. DEC will have to fix this to make their systems ANSI
  632. compatible,
  633. but heaven only knows how long that will take.
  634. .PP
  635. Meanwhile,
  636. the fix is to delete the `b's in the second arguments of the
  637. \fIfopen\fRs
  638. in three places in
  639. \fIdbminit()\fR
  640. in
  641. \fIdbz/dbz.c\fR,
  642. if your system has
  643. this particular bit of brain damage.
  644. .SH
  645. size_t
  646. .Ix problems size_t
  647. .Ix size_t
  648. .Ix Unix Microport
  649. .PP
  650. Some systems,
  651. notably from Microport,
  652. do not define the
  653. \fIsize_t\fR type in the \fI<sys/types.h>\fR header.
  654. Worse,
  655. the \fIsize_t\fR in that header doesn't necessarily bear any
  656. relationship to the ANSI C \fIsize_t\fR.
  657. This causes trouble in the \fIdbz\fR library in particular.
  658. The proper type for \fIsize_t\fR is whatever the C \fIsizeof\fR
  659. operator returns,
  660. nominally an unsigned type which is large enough to
  661. contain the size of any memory object.
  662. We think nothing relies too heavily on it being unsigned.
  663. Note that \fIsize_t\fR must also be suitable for use in the two middle
  664. arguments of \fIfread\fR and \fIfwrite\fR,
  665. the last argument of
  666. \fImemcpy\fR,
  667. \fImemchr\fR,
  668. and \fImemcmp\fR,
  669. and the argument of \fImalloc\fR.
  670. .SH
  671. Compress Behavior
  672. .Ix compress
  673. .Ix problems compress
  674. .Ix batcher
  675. .PP
  676. Extremely old (pre-1985) versions of \fIcompress\fR run off at the mouth
  677. with a status message
  678. on \fIstderr\fR even when nothing goes wrong in the compression.
  679. This upsets the batcher,
  680. which thinks any \fIstderr\fR output means trouble.
  681. .SH
  682. ulimit
  683. .Ix ulimit
  684. .Ix problems ulimit
  685. .Ix Unix "System V"
  686. .Ix "System V" breakage
  687. .PP
  688. Most versions of System V have the concept of \fIulimit\fR,
  689. a per-process limit on how big an individual file can be.
  690. This limit can be lowered by anyone but raised only by the super-user;
  691. normally \fIinit\fR or \fIlogin\fR initializes it to some suitable value.
  692. Unfortunately,
  693. many System Vs set it far too low,
  694. at 1 megabyte.
  695. This causes trouble with many things,
  696. but in particular,
  697. .Ix relaynews
  698. .Ix expire
  699. \fIrelaynews\fR,
  700. \fIexpire\fR, etc.
  701. need to be able to work with the \fIhistory\fR file,
  702. .Ix history
  703. which can easily be several megabytes.
  704. It's necessary to deal with this on all paths by which
  705. any of these programs might be invoked:
  706. from \fIuucp\fR or other transport software bringing in news,
  707. from \fIcron\fR,
  708. .Ix cron
  709. and by users via \fIinews\fR for local postings.
  710. .Ix inews
  711. It is difficult to do this in a portable way when super-user privileges
  712. are needed.
  713. .SH
  714. Restricted Shells
  715. .Ix shell restricted
  716. .Ix problems "restricted shells"
  717. .Ix Unix "System V"
  718. .Ix "System V" breakage
  719. .PP
  720. There is an unfortunate interaction between the `#!' feature in shell files
  721. and the ``restricted shell'' feature found in some Unixes
  722. (notably System V):
  723. the restricted shell typically is just a different way of invoking
  724. \fI/bin/sh\fR,
  725. and in some versions,
  726. careless code just checks the first
  727. letter of the name the shell was invoked under to see if it was `r'.
  728. Unfortunately,
  729. if the system has the `#!' feature and there is a shell
  730. file named,
  731. say,
  732. .Ix rnews
  733. \fIrnews\fR whose first line is `#!\ /bin/sh',
  734. this shell file will end up invoking the restricted shell!
  735. .PP
  736. Simply deleting the `#!' line might fix this;
  737. on systems which have the
  738. Korn shell,
  739. .Ix shell Korn
  740. .Ix /bin/ksh
  741. changing `#!\ /bin/sh' to `#!\ /bin/ksh' might work.
  742. Otherwise you will have
  743. .Ix cunbatch
  744. to arrange to have your neighbors invoke \fIcunbatch\fR instead of
  745. \fIrnews\fR, or else write a simple \fIrnews\fR that invokes the real
  746. one under another name.
  747. It would be wise to check for other shell files whose names begin with `r',
  748. also,
  749. as \fIrnews\fR definitely isn't the only one.
  750. .SH
  751. Remote Invocation vs. Nonstandard Shells
  752. .Ix shell non-standard
  753. .Ix problems "non-standard shells"
  754. .Ix rsh
  755. .\" thanks to Paul Eggert for most of this
  756. .PP
  757. When \fInewsrun\fR is invoked on a host that is not the news server,
  758. it uses \fIrsh\fP to propagate news batches to the server.
  759. It runs \fI/bin/sh\fR explicitly to avoid major difficulties with
  760. non-standard shells,
  761. but it has to rely on the invoker's login shell to run that one command.
  762. This means \fInewsrun\fR will emit spurious output
  763. if its invoker's login shell is the C shell
  764. and its invoker's \fI.cshrc\fR contains commands that generate output.
  765. A similar problem occurs with \fIbash\fP and \fI.bashrc\fP.
  766. .Ix bash
  767. .Ix shell bash
  768. .Ix csh
  769. .Ix shell C
  770. .PP
  771. The simplest solution is to use \fI/bin/sh\fP
  772. as the login shell for \fInewsrun\fP's invoker.
  773. Otherwise,
  774. if you have a networked news server,
  775. check that the login shell is standard enough to invoke \fI/bin/sh\fP
  776. by executing the following command as \fInewsrun\fP's invoker.
  777. .DS
  778. .ft B
  779. rsh \fInewsserver\fP exec /bin/sh \-c true
  780. .ft
  781. .DE
  782. This command should output nothing.
  783. .PP
  784. .Ix Unix "System V"
  785. .Ix "System V" breakage
  786. A slightly related problem is that not everyone calls the run-remote-shell
  787. command \fIrsh\fR;
  788. on System V in particular,
  789. \fIrsh\fR means something
  790. different.
  791. For the moment we have opted to ignore this issue,
  792. as the possibilities
  793. for gratuitous differences boggle the mind.
  794. People facing this problem may wish to place an
  795. \fIrsh\fR shell file in the search path to invoke the right command in the
  796. right way,
  797. whatever that is.
  798. .SH
  799. Values of Logical Operators
  800. .Ix "broken compilers"
  801. .Ix problems "broken compilers"
  802. .Ix Unix Ultrix
  803. .PP
  804. There seem to
  805. be compilers,
  806. e.g. the Ultrix one on DEC's new RISC workstations,
  807. that go into convulsions when they see something like
  808. .DS
  809. .ft B
  810. *p++ = isascii(c) && isalnum(c);
  811. .ft
  812. .DE
  813. because they don't know how to generate a numeric value for `&&',
  814. or because they don't know how to turn that value into a `char'.
  815. One or two places in
  816. C News
  817. use constructs like this.
  818. If you run into this,
  819. you might
  820. want to try replacing the
  821. right-hand side
  822. with something like ``(...)\ ?\ 1\ :\ 0'' to get the
  823. troublesome operator back into a conditional context.
  824. .SH
  825. Empty Lines
  826. .Ix "empty lines"
  827. .Ix problems "empty lines"
  828. .Ix relaynews
  829. .PP
  830. Some backward operating systems
  831. (through which your
  832. C News
  833. distribution
  834. may have passed on its way to you),
  835. and perhaps some stupid text-handling
  836. software even on sane operating systems,
  837. do not recognize the notion of
  838. an empty line.
  839. They think all lines must have at least one character in them;
  840. the closest
  841. they can come to an empty line is a line consisting of a single blank.
  842. This matters because \fIrelaynews\fR will tolerate white space only in
  843. certain places in the \fIsys\fR file,
  844. and in particular,
  845. it tolerates
  846. empty lines but not lines consisting solely of white space.
  847. The result will be complaints (in \fIerrlog\fR)
  848. about white space in
  849. the \fIsys\fR line for a system named ``\ ''.
  850. .SH
  851. active-File Date
  852. .Ix problems "broken file systems"
  853. .Ix "broken file systems"
  854. .Ix Unix "Bull DPX/2 B.O.S. 1.0"
  855. .Ix relaynews
  856. .Ix active
  857. .Ix files active
  858. .\" thanks to Simon J. Gerraty for this weirdie
  859. .PP
  860. On some Bull systems, at least ones running DPX/2 B.O.S. 1.0,
  861. apparently \fIrelaynews\fR updates the
  862. contents of the \fIactive\fR file correctly, but the file's date remains
  863. unchanged!
  864. This appears to be a kernel bug.
  865. It reportedly upsets some news readers.
  866. A workaround, said to be effective, is to add the line
  867. .DS
  868. .ft B
  869. utime(ctlfile(actrelnm), (time_t *)NULL);
  870. .ft
  871. .DE
  872. after the call to \fInnafree\fR in \fIactfsync\fR
  873. in \fIlibbig/active.big.c\fR.
  874. .Ix active.big.c
  875. .SH
  876. enum Operators
  877. .Ix "broken compilers"
  878. .Ix problems "broken compilers"
  879. .Ix readnews
  880. .\" thanks to Scott Reynolds for this one
  881. .PP
  882. Some compilers have difficulty compiling the
  883. \fIreadnews\fR we supply,
  884. because they object to applying the `!' operator to an \fIenum\fR type.
  885. Changing the definition of \fIbooltype\fR in \fIrna/defs.h\fR to
  886. .DS
  887. .ft B
  888. typedef int bool;
  889. #define    false    0
  890. #define    true    1
  891. .ft
  892. .DE
  893. is reported to solve this.
  894. .SH
  895. Amiga Library Ordering
  896. .Ix Unix "Amiga System V Release 4"
  897. .Ix problems "amiga loading"
  898. .PP
  899. It is reliably reported that when compiling some of the programs under
  900. SVR4 on the Amiga,
  901. it is necessary to give ``\-lc \-lucb'' as library
  902. options\(emlinking of the C library \fImust\fR precede linking of the
  903. Berkeley-emulation library,
  904. or the code links but will not run.
  905. .SH
  906. AIX and Mach vs. fsync()
  907. .Ix fsync
  908. .Ix problems fsync
  909. .Ix Unix AIX
  910. .Ix Unix Mach
  911. .Ix relaynews
  912. .Ix /dev/null
  913. .Ix machines NeXT
  914. .PP
  915. The
  916. .I relaynews
  917. regression test fails under some (all?) AIXes,
  918. because the system refuses to do an
  919. .I fsync
  920. on a file descriptor open to
  921. .I /dev/null .
  922. It is possible that this does not affect production use, however.
  923. Mach (at least on the NeXT) is reported to have similar problems.
  924. .SH
  925. AIX/370 vs. Shell Files
  926. .Ix problems AIX/370
  927. .Ix Unix AIX/370
  928. .Ix shell AIX/370
  929. .Ix newsrunning
  930. .PP
  931. AIX/370 has added at least one keyword (``on'') to the shell,
  932. and this is
  933. known to cause syntax complaints
  934. in at least one shell script (\fInewsrunning\fR).
  935. Unless this is also a keyword in the final version of POSIX 1003.2,
  936. we don't plan to fix this.
  937. .SH
  938. Struct Conditional Expressions
  939. .Ix "broken compilers"
  940. .Ix problems "broken compilers"
  941. .Ix Unix "SCO Xenix"
  942. .PP
  943. Some (all?) SCO Xenix compilers take offense to expressions like
  944. .DS
  945. .ft B
  946. value = (dbzint) ? dbzfetch(key) : fetch(key);
  947. .ft
  948. .DE
  949. where the functions return
  950. .I struct
  951. values.
  952. This occurs in three places in
  953. .I dbz/dbzmain.c ,
  954. .Ix dbz
  955. and the workaround is to expand those conditionals to statements like:
  956. .DS
  957. .ft B
  958. if (dbzint)
  959.     value = dbzfetch(key);
  960. else
  961.     value = fetch(key);
  962. .ft
  963. .DE
  964. .SH
  965. staleness vs. Ultrix
  966. .Ix Unix Ultrix
  967. .Ix staleness
  968. .Ix problems Ultrix
  969. .PP
  970. Several Ultrix users have reported a problem with the ``staleness''
  971. command.
  972. It seems Ultrix's \fIsed\fR is an antique and blows up on the complex
  973. regular expression in \fIstaleness\fR.
  974. .Ix sed
  975. A fix,
  976. at some small cost in performance,
  977. is to change the last four lines
  978. of \fIstaleness\fR to something like
  979. .DS
  980. .ft B
  981. exec awk '$1 == "/expired/" { print "-o", $3 }' $NEWSCTL/explist
  982. .ft
  983. .DE
  984. .SH
  985. SCO Xenix string functions
  986. .Ix "botched libraries"
  987. .Ix problems "botched libraries"
  988. .Ix Unix "SCO Xenix 2.3"
  989. .\" Sydney S. Weinstein discovered this horror
  990. .PP
  991. Under SCO Xenix 2.3,
  992. and perhaps other recently-released SCO systems,
  993. the string functions like \fIstrchr\fR exist but can be
  994. inordinately slow when dealing with long strings.
  995. This is not an academic issue:
  996. one symptom is that \fIrelaynews\fR
  997. .Ix relaynews
  998. takes a long time to start up,
  999. eating 10-15 seconds of CPU time
  1000. before it starts processing articles.
  1001. This apparently is a combination of badly-written code and
  1002. strange internationalization support.
  1003. Just using our string functions,
  1004. by
  1005. telling \fIbuild\fR that your system does not have them,
  1006. works much better.
  1007. Telling the compiler \fB\-nointl\fR may be helpful if you don't want
  1008. to go that far.
  1009. .SH
  1010. Old SCO Xenix vs. \fIsetvbuf\fP
  1011. .Ix "botched libraries"
  1012. .Ix problems "botched libraries"
  1013. .Ix Unix "SCO Xenix"
  1014. .Ix dbz
  1015. .Ix problems setvbuf
  1016. .Ix setvbuf
  1017. .\" Ronald Khoo reported this unbelievable botch
  1018. .PP
  1019. The \fIdbz\fR package makes some use of the \fIsetvbuf\fR routine.
  1020. Incredible though it sounds,
  1021. old versions of SCO Xenix reportedly had
  1022. the order of \fIsetvbuf\fR's arguments wrong!
  1023. If you have SCO Xenix version
  1024. 2.2 or earlier,
  1025. check the arguments to \fIsetvbuf\fR:
  1026. if the second and third are a type and a buffer pointer respectively
  1027. (they are supposed to be a buffer pointer and a type),
  1028. you're in trouble and will have to tinker with the \fIdbz\fR sources.
  1029. .SH
  1030. SunOS 4.1.1 vs. write()
  1031. .Ix write
  1032. .Ix problems SunOS 4.1
  1033. .Ix Unix "SunOS 4.1.1"
  1034. .Ix problems "broken kernel"
  1035. .Ix "broken kernel"
  1036. .PP
  1037. In some circumstances,
  1038. a SunOS 4.1.1 \fIwrite\fR system call to a disk
  1039. file can be interrupted by a signal.
  1040. No other Unix does this,
  1041. and routines like \fIfwrite\fR are not prepared
  1042. to cope with it.
  1043. This can result in gratuitous failures of \fIdbz\fR in particular.
  1044. .PP
  1045. It is thought not to be a problem in C News,
  1046. but some other packages
  1047. using \fIdbz\fR suffer,
  1048. .Ix dbz
  1049. and we mention it just in case.
  1050. Sun acknowledges it as a bug.
  1051. The bug-id is 1052649.
  1052. It is fixed in patch 100293-01.
  1053. .SH
  1054. uucp Variations
  1055. .Ix uucp
  1056. .Ix problems queuelen
  1057. .Ix queuelen
  1058. .PP
  1059. There are innumerable variations on the details of \fIuucp\fR that may
  1060. require appropriate modifications to \fIqueuelen\fR.
  1061. For example,
  1062. some versions of Honey DanBer (aka BNU) \fIuucp\fR cut all
  1063. system names down to seven characters,
  1064. and \fIqueuelen\fR will have to be altered to do likewise.
  1065. .SH
  1066. malloc Variations
  1067. .Ix malloc
  1068. .Ix Unix A/UX
  1069. .PP
  1070. On some systems,
  1071. performance is noticeably better if the \fB\-lmalloc\fR
  1072. library is used,
  1073. rather than relying on the \fImalloc\fR in the standard
  1074. C library.
  1075. A/UX is reportedly an example.
  1076. .SH
  1077. Slow egrep
  1078. .Ix egrep
  1079. .Ix "System V" breakage
  1080. .Ix Unix "System V"
  1081. .Ix Unix A/UX
  1082. .PP
  1083. At least some System V suppliers (including, reportedly, Apple in
  1084. some [now obsolete?] A/UX versions) have broken \fIegrep\fR in such
  1085. a way that it is inordinately slow.
  1086. It may be worth substituting \fIgrep\fR for \fIegrep\fR in some of
  1087. the shell scripts,
  1088. with appropriate caution since they do not accept
  1089. quite the same pattern syntax.
  1090. .SH
  1091. SCO ranlib
  1092. .Ix ranlib
  1093. .Ix SCO
  1094. .PP
  1095. Some recent SCO systems have a \fIranlib\fR,
  1096. but it's meant only for cross-development work.
  1097. The correct answer to ``does your system have \fIranlib\fR?'' is \fIno\fR
  1098. on such systems.
  1099. .SH
  1100. GNU join
  1101. .Ix join
  1102. .Ix "GNU join"
  1103. .PP
  1104. GNU \fIjoin\fR, from shellutils 1.9, has
  1105. the \fB\-a\fR option badly botched.
  1106. This breaks \fIupact\fR; the \fIupact\fR regression test catches this.
  1107. Steve Robbins found this and posted a fix;
  1108. it's too long to reproduce here.
  1109. See:
  1110. .DS
  1111. ftp://ftp.cim.mcgill.ca/pub/people/steve/pc/linux/join
  1112. .DE
  1113. Textutils 1.11 has fixed this.
  1114. Unfortunately, it has introduced a new and different bug that
  1115. makes the
  1116. .I mergeactive
  1117. regression test fail...
  1118.