home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / sysv386 / 13090 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  33.0 KB

  1. Xref: sparky comp.unix.sysv386:13090 comp.unix.bsd:4076 comp.os.mach:1033 news.answers:2475
  2. Path: sparky!uunet!cbmvax!snark!esr
  3. From: esr@snark.thyrsus.com (Eric S. Raymond)
  4. Newsgroups: comp.unix.sysv386,comp.unix.bsd,comp.os.mach,news.answers
  5. Subject: Known Bugs in the USL UNIX distribution
  6. Message-ID: <1hQSyQ#5kbT1S8FRbB41gD9ZK5vKTn2=esr@snark.thyrsus.com>
  7. Date: 12 Aug 92 17:25:48 GMT
  8. Expires: 5 Nov 92 00:00:00 GMT
  9. Sender: esr@snark.thyrsus.com (Eric S. Raymond)
  10. Followup-To: comp.unix.sysv386
  11. Distribution: world
  12. Lines: 734
  13. Approved: news-answers-request@MIT.Edu
  14.  
  15. Archive-name: usl-bugs
  16. Last-update: Wed Aug 12 13:15:22 1992
  17. Version: 6.0
  18.  
  19. [My apologies to all for being a week late.  Press of work and all that...]
  20.  
  21. What's new in this issue:
  22.    * Lots more on the origins of various bugs.
  23.    * New bugs in tar, symbolic links, csh, SCSI support.
  24.    * An explanation for many BSD-compatibility library bugs.
  25.    * Some quasi-official USL responses to bug reports.
  26.  
  27. I. Introduction
  28.  
  29. This posting lists known bugs in System V Release 4 implementations, and known
  30. fixes applied by various porting houses.  It was formerly part of the
  31. 386-buyers-faq issues 1.0 through 4.0, and is still best read in conjunction
  32. with the pc-unix/software FAQ descended from that posting.
  33.  
  34. This document is maintained and periodically updated as a service to the net by
  35. Eric S.  Raymond <esr@snark.thyrsus.com>, who began it for the very best
  36. self-interested reason that he was in the market and didn't believe in plonking
  37. down several grand without doing his homework first (no, I don't get paid for
  38. this, though I have had a bunch of free software and hardware dumped on me as a
  39. result of it!).  Corrections, updates, and all pertinent information are
  40. welcomed at that address.
  41.  
  42. This posting is periodically broadcast to the USENET group comp.unix.sysv386
  43. and to a list of vendor addresses.  If you are a vendor representative, please
  44. check to make sure the information on your company is current and correct.  If
  45. it is not, please email me a correction ASAP.  If you are a knowledgeable user
  46. of any of these products, please send me a precis of your experiences for the
  47. improvement of future issues.
  48.  
  49. The bug descriptions often include indications of fixes by the various porting
  50. houses to their current releases.  These are:
  51.  
  52. Consensys UNIX Version 1.3            abbreviated as "Cons" below
  53. Dell UNIX Issue 2.2                abbreviated as "Dell" below
  54. Esix Revision A                    abbreviated as "Esix" below
  55. Micro Station Technology SVr4 UNIX        abbreviated as "MST" below
  56. Microport System V Release 4.0 version 4    abbreviated as "uPort" below
  57. UHC Version 3.6                    abbreviated as "UHC" below
  58. SCO Open DeskTop 1.1                abbreviated as "SCO" below
  59.  
  60. II. General Bugs
  61.  
  62. 1. Dropout problems with tty devices
  63.    The most serious problem anyone has reported is that the USL asy driver is
  64. flaky and occasionally drops characters at above 4800 baud.
  65.    Microport, Dell, Esix, and UHC say that they believe they've fixed this.
  66. However, Dell, at least, was mistaken when they first made this claim; a more
  67. detailed description of the problem is given below.  I have been assured that
  68. this is on the fix list for the next Dell release.
  69.    Bela Lubkin at SCO comments "386 interrupt latency vs. unbuffered UARTs.
  70. This is a tough problem.  Nobody's driver should drop characters with a
  71. turned-on 16550.  It's not so easy with a 16450.  Anyone with 16450s or lower
  72. should be able to solve their problems by dropping in a 16550."
  73.  
  74. 2. Suid programs dump core when signalled
  75.    Mark Snitily of SGCS says that under many SVr4s, signalling a
  76. process that is running suid root will cause it to core-dump.  He says
  77. Dell and MST have fixed this, and SCO doesn't suffer from this.
  78.    On the other hand, David Wexelblat writes "In Known Bugs in the USL Code,
  79. regarding core dumps from signalling suid-root SVR4 programs, Microport does
  80. not display this problem (either 3.1 or 4.1).  I have reason to believe that
  81. Mark Snitily is incorrect about this.  I am almost positive that he was seeing
  82. a bug in X386 (both 1.1 and 1.2) that we have fixed in X386 1.2E that caused
  83. X386 to dump core if you tried to kill it while it was not on the active VT (we
  84. have provided him the fix)."  However, David notes that the bug allegedly
  85. involved has not been confirmed by third parties.
  86.    More data on this as it becomes available.
  87.  
  88. 3. DMAs on large ISA machines may fail
  89.    On ISA machines with more that 16MB of RAM, SVr4 may try to do DMA
  90. from outside the bus's address space, causing serious problems.  UNIX ought
  91. to do an in-memory copy to within the low 16MB but the USL base code doesn't.
  92.    Dell says they've fixed this, and that's been confirmed by a user.
  93.    UHC says they've fixed this; they add that the special buffer-allocation
  94. logic to handle the problem can be turned off with a tunable kernel parameter
  95. if you've got less than 16M.
  96.    Microport says they've fixed this in their new 4.1 release, shipping early
  97. March.
  98.    Esix offers a patch to correct this problem.
  99.    SCO used to have a similar bug but fixed it long ago.
  100.    John Sully <jms@mport.com> writes: "This was due to a bug in pre version 4
  101. dma code.  The USL code has always at least attempted to do a copy from low
  102. memory to high memory on systems with more than 16Mb of RAM.  By the way UHC is
  103. wrong; the buffer allocation code only comes into play if you have more than
  104. 16Mb of memory.  You can turn it off if you have a machine (ie. an EISA bus)
  105. which will allow you to do DMA above 16Mb.  You *must* have this tunable
  106. (MAXDMAPAGE) turned on if you are using *ISA* bus masters in a system with more
  107. than 16Mb of ram.  Unfortunately doing this will affect all drivers which do
  108. dma as there is no good way to do this on a per-driver basis."
  109.  
  110. 4. There is a cylinder limit on disk size
  111.    Stock USL code is limited to 1,024 cylinders per Winchester, which
  112. might cause problems with some disk drives.
  113.    Microport, Dell, Esix, MST, and UHC have fixed this.
  114.    Bela Lubkin says "SCO's boot filesystem must lie below 1024 cylinder mark;
  115. anything else can be anywhere.  This is more-or-less a limitation of the BIOS
  116. interface that the bootstrap loader must use.  Could be circumvented by going
  117. directly to controller hardware in the bootstrap loader, but that would be
  118. horrendously complex with all the controllers & host adapters to be supported."
  119. This limit probably applies to all other UNIXes as well.
  120.  
  121. 5. shmat(2) vs. vfork(2)
  122.    The shmat(2) call is known to interact bady with vfork(2).  Specifically,
  123. if you attach a shared-memory segment, vfork(), and then the child releases
  124. the segment, the parent loses it too!  Workaround; use fork(2).
  125.    UHC and Microport both suspect that they still have this bug and opine that
  126. anyone who uses vfork deserves to lose.  Dell has no plans to fix it.
  127.  
  128.    John Sully <jms@mport.com> writes: "This is not a bug.  It is completely
  129. consistent with the semantics of a change to the address space of the child.
  130. Think about it: any change to the address space of a child process created by
  131. vfork(2) is reflected in the parent since the child is actually executing in
  132. the parent's address space.  Therefore if the child changes the address space
  133. (in this case by releasing the shared memory segment) what should happen?
  134. Right, the parent should have the same change happen.  And what does happen?
  135. The segment is released in the parent.  One can argue about the braindead
  136. semantics of vfork(2) all day, but the fact remains that this is exactly what
  137. one would expect to happen.  To quote from the manual page:
  138.  
  139.      [...] vfork differs  from fork  in
  140.      that the    child  borrows    the parent's *memory* and thread of
  141.      control until a call to execve or an exit (either by a  call
  142.      to     exit  or  abnormally.) [ emphasis added ]
  143.  
  144. and later:
  145.  
  146.      It does not work, however, to return while
  147.      running in    the child's  context  from  the     procedure  which
  148.      called vfork since    the eventual return from vfork would then
  149.      return to a no longer existent  stack  frame.
  150.  
  151. Please note that the entire address space of the parent is used by
  152. the child created by vfork(2).  The manual page also points out
  153. several other caveats involved in doing anything to the parent's
  154. address space except successfully calling an exec family function or
  155. _exit (note it specifically says *not* to call exit(2)).  I do not believe 
  156. that having a shared memory segment disappear from the parent's address 
  157. space is out of line after reading the man page for vfork(2).
  158.  
  159. It is interesting to note that Sun after implementing its new VM system in
  160. SunOS 4.0 initially had no plans to support vfork, since they felt that the COW
  161. semantics of the new fork would provide the necessary efficiency gain.  Indeed
  162. they found that most programs which used vfork worked just fine by doing
  163. -Dvfork=fork.  All that is, except for a certain popular command interpreter
  164. [ed: can you say C shell?].  So we are stuck with the legacy of this braindead
  165. system call.
  166.  
  167. BTW, Microport has no plans to fix this :-)."
  168.  
  169. 6. X11R4 performance problem
  170.    Stock X11R4 is said to hog the processor if you use the
  171. LOCALCONNECT option.
  172.  
  173. 7. UFS file system problems
  174.    In stock USL 4.0.3, you can't use a UFS file system as the root; the
  175. system hangs if you try.  Dell, Esix, Microport, MST and UNIX have fixed this.
  176.    David Aitken, the UNIX product manager at UHC, writes "The ufs as root file
  177. system [problem] was not really a bug, just a little oversight on USL's part -
  178. we have fixed it completely by adding one line to the /stand/boot script:
  179. rootfstype=ufs!"  He adds that they've been using ufs on their lab machines for
  180. over 10 months with no trouble, and the latest UHC release defaults to ufs if
  181. you have more than 120MB of disk.
  182.  
  183. 8. A security hole in login
  184.    David Wexelblat <dwex@mtgzfs3.att.com> reports: "There is a HUGE security
  185. hole in /bin/login in all USL derived SVR4s before 4.0.4.  Refer to CERT
  186. advisory CA-91:08, dated 5/23/91.  This is known to be present in AT&T SVR4
  187. 2.1, and Microport SVR4 3.1.  ESIX claims to have fixed it, Microport reports
  188. that it is fixed in 4.1.  I won't give any more details unless necessary.
  189. Suffice to say that this bug allows any non-privileged user on an SVR4 system
  190. to get read-write access to any file on the system."
  191.  
  192. 9. COFF problems with long filenames
  193.    A source at Dell urges: "Our SVR4v2 did some stuff that USL didn't get
  194. around to until SVR4v4.  Try Dell UNIX 2.1 with a COFF program on a large UFS
  195. filesystem in a directory with long names.  Runs on Dell UNIX.  Breaks on
  196. others."  I don't have more definite info yet.
  197.  
  198. 10. Flakeouts in the Wangtek device driver
  199.    Dell reports that USL's Wangtek device driver is seriously flaky.  "How'd
  200. you like a multi volume backup where the second and subsequent volumes don't
  201. follow on from the previous volumes?"  UHC confirms this and is actively
  202. working on the problem.
  203.    An anonymous SCOer says "The QIC02 tape controller `standard' is seriously
  204. flaky.  Our driver's in pretty good shape but nobody will ever have a truly
  205. solid driver that supports every QIC02 controller you can find."
  206.  
  207. 11. A kernel declaration bug
  208.     A botch in USL's /etc/conf/pack.d/kernel/space.c (which is present in Dell,
  209. Microport 4.0.3 and 4.0.4 and may also be present in other SVr4s) can step on
  210. the linesw[] table.  The problem is that the domain name array initialization
  211. is wrong and too short; thus, when it's set, data past the end of the array can
  212. be stomped.  To fix this, find the following near line 247:
  213.  
  214.     char srpc_domain[] = SRPC_DOMAIN;
  215.  
  216. and change it to
  217.  
  218.     char srpc_domain[SYS_NMLN] = SRPC_DOMAIN;
  219.  
  220. then rebuild the kernel.
  221.    Microport officially knows about this bug and olans to fix it in a
  222. near-future update release.
  223.  
  224. 12. fread(3) does the wrong thing on pipes and FIFOs
  225.    Ed Hall <edhall@rand.org> writes: "Unlike the raw read() system call,
  226. fread() is supposed to be able to make several partial read's to satisfy the
  227. data requested by its arguments.  The exceptions are an EOF or an error on the
  228. stream.  This characteristic is quite useful when moving data through pipes or
  229. over network connections, since partial reads are quite common in these cases.
  230. Well, the version of fread() in ESIX 4.0.3 (and likely other Sys5R4's) only
  231. does a single physical read, and if it only satifies part of the requested
  232. number of bytes, that's all you get.  This can sting you even if you carefully
  233. check the value returned by fread(), since the value returned is rounded down
  234. to the number of complete "nitems" read, although your position in the stream
  235. can be up to size-1 bytes beyond that point.  Neither ferror() nor feof()
  236. indicate anything is wrong when this happens."
  237.    This bug (which is also present in 4.0.4) is serious and nasty and should
  238. be high on every porting house's list to fix.  It appears to be peculiar to
  239. USL 4.0.3 and 4.0.4; 4.0.2 does *not* have it, nor does SCO.
  240.    A USL source claims it has been fixed in 4.1.
  241.  
  242. 13. Process accounting is broken
  243.     In 4.0.3, process accounting doesn't work.  From examining the accounting
  244. scripts, it appears that /usr/lib/acct/accton is supposed to set a return code
  245. depending on whether accounting was switched on already or not.  However, it
  246. always returns the same result - accounting switched off.  This means that the
  247. /usr/lib/acct/ckpacct script, which is run every hour to keep the proccess
  248. accounting log in check, instead turns off accounting the first time it is run
  249. after booting.  The same happens with the nightly /usr/lib/acct/monacct
  250. program.
  251.    I don't yet know whether this bug is present in 4.0.4.  It is definitely
  252. un-fixed in Dell 2.1.
  253.  
  254. 14. tar(1) foos up in the presence of symbolic links
  255.     Tar can get the names of symbolic links wrong when creating an archive.
  256. This bug can be demonstrated by doing the following:
  257.  
  258.    mkdir t
  259.    cd t
  260.    touch a 1234567890
  261.    ln -s b 1234567890
  262.    ln -s a c
  263.    tar vcf ../t.tar .
  264.  
  265.    The output generated by tar is:
  266.  
  267.    a ./ 0 tape blocks
  268.    a ./a 0 tape blocks
  269.    a ./1234567890 0 tape blocks
  270.    a ./b symbolic link to 1234567890
  271.    a ./c symbolic link to a234567890
  272.  
  273. (Note the above commands should be done in the order shown and in a new
  274. directory)  This bug is nasty.  Recommended solution: use GNU tar.
  275.    This is reported from Esix 4.0.3, but probably exists on other SVr4s
  276. as well.
  277.  
  278. 15. Symbolic links can interfere with shellscript execution
  279.    There is a problem running #! scripts when symbolic links are involved.
  280. Typing in the following from a command shell demonstrates the problem:
  281.  
  282.    mkdir a b
  283.    ln -s a c
  284.    cd a
  285.    cat > script <<!
  286.    #!/bin/sh
  287.    echo Hello
  288.    !
  289.    chmod 755 script
  290.    cd ../b
  291.    ln -s ../c/script .
  292.    ./script
  293.  
  294. The message generated from the last line is:
  295.  
  296.      a/script: a/script: cannot open
  297.  
  298.    This is reported from Esix 4.0.3, but probably exists on other SVr4s
  299. as well.
  300.  
  301. 16. Piping a csh builtin causes the shell to hang.
  302.    While running csh, this
  303. can be demonstrated by some of the following:
  304.  
  305.    echo Hello | cat
  306.    history | more
  307.  
  308. (A solution to this one is use tcsh-6.02.)
  309.    This is reported from Esix 4.0.3, but probably exists on other SVr4s
  310. as well.
  311.  
  312. 17. Quick port setup option in sysadm is broken
  313.    In 4.0.3 sysadm, the quick port setup option, which is used to add and
  314. delete terminal ports, is seriously broken.  The script modifies /etc/conf/*
  315. files, and has incorrect minor numbers, sets the 5th field of sdevice.d if Y
  316. when it should be N, and is missing columns for node.d.  See
  317. /usr/sadm/sysadm/bin/q-add.
  318.  
  319. 18. COFF binaries linked with curses(3) and shared libc hang, eating the CPU
  320.    Cause unknown.
  321.  
  322. 19. shl hangs, sxt devices bad
  323.    shl(1) does not work.  Try creating a layer and doing an 'ls'.  Your session
  324. hangs.  Bruce Momjian <root%candle.uucp@bts.com>, who reported this bug, says
  325. he believes it is the sxt devices which are broken.
  326.  
  327. 20. num-lock prevents mouse from working properly
  328.    When using the Motif window manager, if your num lock is on, your mouse
  329. clicks are not recognized by the window manager.  The mouse still works in
  330. xterm(1).  This is allegedly fixed in Destiny (4.2).
  331.  
  332. 21. adjtime() doesn't work
  333.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6 adjtime() doesn't.
  334. Calling `date -a' works to adjust the time slowly.
  335.  
  336. 22. ttymon drops DTR
  337.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6 the ttymon(1)
  338. utility for HDB uucp drops DTR every few weeks.  The workaround is to disable
  339. and re-enable it.
  340.  
  341. 23. cron mail doesn't go through aliasing
  342.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6 cron mail to adm
  343. doesn't get redirected by an
  344.  
  345. 23. fragility in xterm
  346.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6, doing ~! from
  347. a cu in xterm kills xterm.
  348.  
  349. 24. byte-order problem with NFS when accessing Sun disks
  350.    Christoph Badura <bad@flatlin.ka.sub.org> notes that the stock USL resolver
  351. library suffers from serious confusion about the byte order in the
  352. socketaddr_in structure.  This bug is acknowledged by USL for the 4.0.4
  353. release.  A symptom of this bug is that Sun disks will not mount correctly over
  354. NFS. As a workaround, try removing the references to /usr/lib/resolv.so from
  355. /etc/netconfig and rebooting your system.  Unfortunately, this will mean
  356. you can't use nameservers.
  357.  
  358. 25. Under weird circumstances, lseek on UFS may cause corruption
  359.   Christoph Badura <bad@flatlin.ka.sub.org> reports that a UFS lseek() to an
  360. offset which is a multiple of 4096 but not a multiple of 8192, followed by a
  361. write(), may corrupt the file being written.  The bug shows up only, if the
  362. file has no pages in the page pool associated with it at the seek offset and at
  363. 4k before the seek offset.  He has sent USL kernel fix for this.
  364.  
  365. 26. FIONREAD fails on regular files
  366.   Christoph Badura <bad@flatlin.ka.sub.org> reports that the FIONREAD ioctl()
  367. fails on regular (disk) files.  He has sent USL a one-line kernel fix.
  368.  
  369. III. SCSI Support Problems
  370.  
  371. 1. sar is confused by SCSI
  372.    Sar -d doesn't work on SCSI drives.  Dell fixed this in 2.1; no report of
  373. any other SVr4 having fixed this yet.  SCO fixed it in 3.2.4.
  374.  
  375. 2. A configuration problem
  376.    Stock USL requires you to jumper your SCSI devices to fixed IDs
  377. during installation (it can be changed to any other ID after).
  378.    Dell and UHC have fixed this.  The requirement is definitely still present
  379. in Esix.
  380.  
  381. 3. Synchronous SCSI hang problem
  382.    David Wexelblat <dwex@mtgzfs3.att.com> reports: "Stock SVR4.0.3 will hang
  383. the SCSI bus with a 1542 in synchronous mode.  Dell fixed this, and this has
  384. been given to Microport [ed note: Microport 4.0.4 fixed the problem; MST UNIX
  385. and Esix 4.0.3 still have this problem; I have not yet been able to determine
  386. if ESIX 4.0.4 does].  In the file /sbin/bcheckrc, change the line:
  387.  
  388.     echo MARK > /dev/rswap
  389.  
  390. to
  391.         
  392.     echo MARK | dd of=/dev/rswap bs=512 conv=sync > /dev/null 2>&1
  393.  
  394. The magic is apparently the conv=sync, which forces a 512 byte block
  395. to be written.  The original echo writes 4 bytes, which apparently causes
  396. synchronous SCSI to go out to lunch.
  397.  
  398. Now, you ask, how can I fix this, since the system won't boot?  There are
  399. a couple of methods.  First, if possible, disable synchronous negotiation
  400. (1542 jumper J5-1 removed, plus whatever you may need to do to your drive).
  401. Then boot up, edit /sbin/bcheckrc, then shutdown, restrap for synchronous,
  402. then reboot.  Everything should be OK.
  403.  
  404. That's the easy way.  Unfortunately, some hard drives will only work
  405. in synchronous mode.  Well, you can still recover from this phenomenon.
  406. Here's how:
  407.  
  408.         1) Install on your hard drive
  409.         2) Boot from the first boot floppy.  When it tells you to, insert
  410.            the second boot floppy.  At the first prompt, hit <DEL> to
  411.            break out to a shell.
  412.         3) Mount your hard drive under /mnt with the following command
  413.            (replace FS-TYPE with s5, s52, or ufs, whichever you used for
  414.            for your root partition):
  415.  
  416.                 /etc/fs/FS-TYPE/mount /dev/dsk/c0t0d0s1 /mnt
  417.  
  418.         4) Now edit /mnt/sbin/bcheckrc:
  419.  
  420.                 ed /mnt/sbin/bcheckrc
  421.  
  422.            You may want the 'ed' man page handy (I barely remember how to
  423.            to use 'ed' :->).  For simplicity, you can delete/comment out
  424.            the offending line, then replace it with the correct line later.
  425.         5) Unmount the hard drive:
  426.  
  427.                 umount /mnt
  428.  
  429.         6) Reboot from the hard drive.  Everything should come up OK. and
  430.            you can finish editing /sbin/bcheckrc, if necessary.
  431.  
  432. Note that you perform these actions at your own risk.  The first version was
  433. performed by me on Microport SVR4, and the second was performed by someone
  434. else (on my suggestion) on ESIX SVR4."
  435.  
  436. 4. ps chokes on commands that do SCSI I/O
  437.   Hugh Stearns <hoyt@isus.tnet.com> reports that in 4.0.3.6, ps
  438. doesn't work when a SCSI command in progress. It stops printing at the
  439. process executing the scsi command.
  440.  
  441. 5. csh lossage due to bad optimization
  442.   If a csh user sources a non-existent file in their .cshrc (eg, source .alias,
  443. where .alias doesn't exist), then the system will hang for a couple of minutes.
  444. Eventually the user get an "Out of memory" error and the console logs "NOTICE:
  445. out of swap space - Insufficient memory to allocate 2 pages - system call
  446. failed".
  447.   This appears to be due to over-optimization of code surrounding a longjmp
  448. call.
  449.  
  450. IV. Development Tools Problems
  451.  
  452. 1. General UCB library brokenness
  453.    The BSD compatibility libraries were badly broken in USL code.  A Dell
  454. source adds "That meant that almost all the apps derived from them were broken
  455. too.  Most stuff like automount will die when you send a SIGHUP, instead of
  456. rereading the map file.  You can get a system into very strange states when
  457. that happens."
  458.    John Sully <jms@mport> of Microport opines: "This is a bug in automount
  459. itself rather than BSD compatibility, since the automount which comes with SVR4
  460. is not compiled with the BSD libraries.  (isn't this comforting??  :-()."
  461.  
  462.    Esix and UHC's BSD libraries are USL stock.  I don't yet know
  463. the status of other ports.  Microport has run into things they think may be
  464. symptoms of this but have no fix yet.
  465.  
  466.    John Sully <jms@mport> of Microport counters with: "One common thread I find
  467. on reading of these problems is that the BSD compatibility libraries are
  468. *misused*. [...] The problem is that BSD and SYSV have similarly named .h files
  469. which sometimes contain different definitions for objects with the same name.
  470. This has been known to cause all sorts of problems because the SYSV headers are
  471. picked up and then the calls are satisfied from the BSD library rather than the
  472. shared object library.  I have found that if you use /usr/ucb/cc that the BSD
  473. compatibility is much less broken than it would seem at first because it
  474. ensures that the correct headers are picked up."
  475.  
  476.    However, note that there is at least one *real* bug known --- as of 4.0.4
  477. the signal emulation cannot explicitly set a handler to SIG_DFL or SIG_IGN.
  478.  
  479.    Ron Guilmette <rfg@ncd.com> writes "[Library lossage] may be easily
  480. demonstrated by attempting to build and link the GNU C compiler with
  481. `-L/usr/ucblib -lucb'.  The resulting compiler will most certainly
  482. crash and die."  John Sully thinks this is because the /usr/ucb/cc
  483. compiler should have been used, but wasn't.
  484.  
  485. 2. USL emulation of BSD signals doesn't work
  486.    A different source reports that the the USL implementatation of BSD signals
  487. is broken in both 4.0.3 and 4.0.4; in particular, the sigvec() family doesn't
  488. work properly.  It is possible to make minor tweaks to source to make such apps
  489. work properly with the native USL signals implementation.
  490.  
  491.    Here's more on the signals problem, thanks to Richard <rc@siesoft.co.uk>:
  492. ------------------------------------------------------------------------------
  493. The problem is to do with the signal() function that is within the BSD
  494. compatability libc. 
  495.  
  496. To reproduce the problem do the following:
  497.  
  498. #include <stdio.h>
  499. #include <sys/types.h>
  500. #include <signal.h>
  501. #include <sys/siginfo.h>
  502.  
  503. main()
  504. {
  505.     signal(SIGPIPE,SIG_IGN);
  506.     pause();
  507. }
  508.  
  509. and compile it with cc xx.c -o xx /usr/ucblib/libucb.a
  510.  
  511. (John Sully observes that this is definitely wrong; /usr/ucb/cc should have
  512. been used rather than "cc ... -L/usr/ucblib -lucb" or the equivalent "cc ...
  513. /usr/ucblib/libucb.a".)
  514.  
  515. If you run the program and then signal it with a SIGPIPE, the program
  516. will die, even though you've told it to ignore SIGPIPE.
  517.  
  518. The fix is difficult unless you've got source cos there's a missing 'else'
  519. clause from the signal() code. This is the only signal fault I've found in
  520. the BSD signal functions, details of the rumoured sigvec problem would be
  521. useful?
  522.  
  523. If you're trying to compile an application you could change the application
  524. code to do the following, this does work..
  525.  
  526. void
  527. catch(s)
  528. int    s;
  529. {
  530.     /* DO NOTHING */
  531.     ;
  532. }
  533.  
  534. main()
  535. {
  536.     signal(SIGPIPE,catch);
  537.     pause();
  538. }
  539.  
  540. SUMMARY
  541. You can only change a signal handler to a function handler, any number of
  542. times.  Any attempt to set the handler to SIG_DFL, or SIG_IGN will fail.
  543.  
  544. This bug has given some people working with X11R5 aggro, causing the X server
  545. to die when you close a client. 
  546.  
  547.   Christoph Badura <bad@flatlin.ka.sub.org> confirms this bug
  548. He has sent USL a source fix.
  549. ------------------------------------------------------------------------------
  550.  
  551. 3. Possible string library problems
  552.    There are also persistent rumors of problems in the BSD-emulation string
  553. libraries.  I have not been able to pin down specifics on this.
  554.  
  555. 4. Compiler problems
  556.    Ronald Guilmette <rfg@ncd.com> also reports the following:
  557.  
  558. ------------------------------------------------------------------------------
  559. /* Here is a bug in the original SVR4 C compiler (aka C Issue 5) which
  560.    effectively prevents you from making good use of the `const' and
  561.    `volatile' qualifiers defined by ANSI C in conjunction with pointer
  562.    types and typedef statements.  Compile this code and you will get:
  563.  
  564.    "qualifiers.c", line 23: left operand must be modifiable lvalue: op "="
  565.  
  566.    ...if your copy of the svr4 C compiler still has the bug.  Note that
  567.    given these declarations, the ANSI C standard say that the thing pointed
  568.    to by the variable `pci' should be considered to be constant... not the
  569.    variable `pci' itself.  (The GCC compiler, either version 1.x or version
  570.    2.x, correctly compiles this example without complaint.)
  571. */
  572.  
  573. typedef const int *ptr_to_const_int;
  574.  
  575. ptr_to_const_int pci;
  576.  
  577. int i;
  578.  
  579. void main ()
  580. {
  581.   pci = &i;
  582. }
  583. ------------------------------------------------------------------------------
  584. /* Here is a subtle bug in the original SVR4 C compiler (aka C Issue 5)
  585.    which prevents you from first declaring a tagged type (i.e. a struct
  586.    type or a union type) in a parameter list, and then defining that tagged
  587.    type later on within the same scope.  (Note that according to the ANSI C
  588.    standard, the scope in which parameters get declared and the outermost
  589.    block of a function body are one and the same scope.  Thus, this really
  590.    is legal ANSI C code!)
  591.  
  592.    Try compiling this with your C compiler on SVR4.  If your compiler still
  593.    has the bug, you will get:
  594.  
  595.    "tagged_type.c", line 24: warning: dubious tag declaration: struct S
  596.    "tagged_type.c", line 28: warning: improper member use: i
  597.    "tagged_type.c", line 28: warning: improper member use: i
  598.    "tagged_type.c", line 31: warning: dubious tag declaration: struct S
  599.    "tagged_type.c", line 35: warning: improper member use: i
  600.    "tagged_type.c", line 35: warning: improper member use: i
  601.  
  602.    (The GCC compiler also had this bug in version 1.x, but it has been fixed
  603.    in version 2.x.)
  604. */
  605.  
  606. void foobar1 (arg)        /* use old-style without prototypes */
  607.     struct S *arg;
  608. {
  609.   struct S { int i; };        /* define the type `struct S' */
  610.  
  611.   arg->i = arg->i;        /* legal according to ANSI C rules! */
  612. }
  613.  
  614. void foobar2 (struct S *arg)    /* use new-style with prototypes */
  615. {
  616.   struct S { int i; };        /* define the type `struct S' */
  617.  
  618.   arg->i = arg->i;        /* legal according to ANSI C rules! */
  619. }
  620. ------------------------------------------------------------------------------
  621. /* Here is a serious bug in the original SVR4 `dump' program which dumps
  622.    out parts of object files in either plain hex form or symbolically.
  623.  
  624.    To see the `dump' program get a segfault and die, save this code under
  625.    the name `dump-bug.c' and then do:
  626.  
  627.     cc -g -c dump-bug.c
  628.     dump -v -D dump-bug.o
  629.  
  630.    The bug arises whenever `dump' tries to read Dwarf debugging information
  631.    for an array of pointers to any "user defined" type (e.g. `struct S' in
  632.    this example).  Past that point, `dump' is totally confused, so further
  633.    Dwarf debugging information finally causes it to go belly-up.
  634. */
  635.  
  636. struct S { int i; };
  637. struct S *array[10];
  638. int j;
  639. ------------------------------------------------------------------------------
  640. It appears that the svr4 C compiler (for x86 machines) doesn't conform real
  641. well to either the letter or the spirit of the IEEE 754 floating-point
  642. standard.  In particular, "unordered comparisons" and other operations on
  643. NaNs don't always produce the result that that the IEEE 754 standard calls
  644. for.
  645.  
  646. An AT&T source comments: "This is documented in the SVID as a future direction.
  647. We do not support NaNs in -Xa and -Xt modes, only in -Xc.  Try
  648. isnan(sqrt(-1.0)) to determine which modes support it."
  649. ------------------------------------------------------------------------------
  650.  
  651.    Both 4.0.3 and 4.0.4 USL versions are missing the documented dial.h
  652. file from their /usr/include directory.  Dell 2.1 has it.
  653.  
  654. V. The FUBYTE bug
  655.  
  656. (Thanks to Christoph Badura <bad@flatlin.ka.sub.org> for this info)
  657.  
  658. The kernel function fubyte() is documented to return a positive value when
  659. given a valid user space address and -1 otherwise. In the latter case u.u_error
  660. is set to EFAULT.  USL SysV R4.0.3 has a sign extension bug in the
  661. implementation of fubyte() for local file descriptors (i.e. not opened via
  662. RFS), which causes fubyte() to return negative values if the byte fetched has
  663. its high bit set. This bug doesn't affect STREAMS drivers, as they don't call
  664. (and in fact are normally unable to call) fubyte().  Thus writing a byte with
  665. the high bit set to certain character device drivers returns with -1 and errno
  666. set to EFAULT.
  667.  
  668. The bug may affect any character device driver that calls fubyte(). It's not
  669. limited to serial card drivers. The bug is noticed most often with serial card
  670. drivers, since uucp uses byte values > 127 very early during g-protocol setup
  671. and drivers for serial cards tend to use fubyte() quite often.
  672.  
  673. Note also that the bug's effect is different if the driver checks for a -1
  674. return value of fubyte() or just a negative one. In the former case it is
  675. possible to pass bytes with the 8 bit set through fubyte(), except for 0xff
  676. which is -1 in two's complement. That makes the bug more obscure.
  677.  
  678. The fix is easy.  First, make a backup copy of the kernel object file
  679. /etc/conf/pack.d/kernel/vm.o!  A disassembly of vm.o(lfubyte) should reveal
  680. *exactly* one mov[s]bl (move byte to long w/sign extend).  That one needs to be
  681. patched into a movzbl (zero extend). The difference is one bit in the second
  682. byte of the opcode.
  683.  
  684. The movsbl has the bit pattern 00001111 1011111w mod/rm-byte.
  685. The movzbl has the bit pattern 00001111 1011011w mod/rm-byte.
  686.  
  687. The 'w' bit is 0 for the instruction in question. So the opcodes are 0f be and
  688. 0f b6. Here is the diff -c from dis -F lfubyte showing the patch applied to
  689. the Dell 2.1 kernel:
  690.  
  691. *** vm.o    Mon Mar  9 00:31:38 1992
  692. --- vm.o.org    Mon Mar  9 00:32:40 1992
  693. ***************
  694. *** 22,28 ****
  695.       11c90:  85 c0                 testl  %eax,%eax
  696.       11c92:  75 09                 jne    0x9 <11c9d>
  697.       11c94:  8b 45 08              movl   8(%ebp),%eax
  698. !     11c97:  0f b6 00              movzbl (%eax),%eax
  699.       11c9a:  89 45 fc              movl   %eax,-4(%ebp)
  700.       11c9d:  c7 05 d8 13 00 00 00 00 00 00 movl   $0x0,0x13d8
  701.       11ca7:  83 3d dc 13 00 00 00  cmpl   $0x0,0x13dc
  702. --- 22,28 ----
  703.       11c90:  85 c0                 testl  %eax,%eax
  704.       11c92:  75 09                 jne    0x9 <11c9d>
  705.       11c94:  8b 45 08              movl   8(%ebp),%eax
  706. !     11c97:  0f be 00              movsbl (%eax),%eax
  707.       11c9a:  89 45 fc              movl   %eax,-4(%ebp)
  708.       11c9d:  c7 05 d8 13 00 00 00 00 00 00 movl   $0x0,0x13d8
  709.       11ca7:  83 3d dc 13 00 00 00  cmpl   $0x0,0x13dc
  710.  
  711. Of course there is a workaround at the driver level.  Canonically, one would do
  712. this by checking for fubyte() returning -1 *and* u.u_error being set to EFAULT
  713. (u.u_error is cleared upon entering a system call).  However, in R4.0.3
  714. fubyte() does NOT set u.u_error.  It *does* set u.u_fault_catch.fc_errno.
  715.  
  716. Cristoph reports that Dell V.4 can be object-patched successfully to fix this.
  717. I do not know the status of the other ports.
  718.  
  719. Another poster (Marc Boucher <marc@cam.org>) adds:
  720.  
  721. On ESIX SVR4.0.3 Rev. A, the instruction movsbl in question can be changed to
  722. movzbl (as described above) with a binary-editor on file
  723. /etc/conf/pack.d/kernel/vm.o. At offset 0x11eb0, change 0xbe to 0xb6.
  724.  
  725. Before patching, verify that your /etc/conf/pack.d/kernel/vm.o is the same as
  726. mine!  On my system, the /bin/sum generated checksum of vm.o was "4440 222".
  727.  
  728. The problem results from a sign-extension bug.  The function lfubyte(), which
  729. is called by fubyte(), is declared as
  730.  
  731. int lfubyte(char *addr);    /* actually caddr_t */
  732.  
  733. The byte is fetched with
  734.  
  735.     val = *addr;
  736.  
  737. which triggers sign extension.  Casting addr to a unsigned char * or declaring
  738. it as such solves the problem.
  739.  
  740. This bug is still present in stock USL 4.0.4.
  741.  
  742. DESTINY AND DELL
  743.  
  744. A source at at UNIX System Labs Europe claims that `Destiny' (the new Release
  745. 4.2) incorporates all of Dell UNIX's fixes to 4.0.3; thus, any bug for which a
  746. Dell fix is indicated above should be gone in Destiny.
  747. --
  748.     Send your feedback to: Eric Raymond = esr@snark.thyrsus.com
  749.