[news.software.b] C News on a Mac IIx

rmtodd@uokmax.UUCP (Richard Michael Todd) (06/24/89)

I've installed C News on my Mac IIx running Apple A/UX v1.0.1 (still waiting
for the 1.1 upgrade disks, sigh); for those not familiar with A/UX, it's SVR2
with Berkeley job control and networking.  Here is a report of how things went:

 As bill@twwells.com pointed out, various places in the makefile use test(1),
and make tries to find a test executable somewhere in the path, and since
A/UX has no test executable (test only exists as a shell built-in), this
bombs.  I solved the problem by sticking a little shell script in
/usr/local/bin to execute the sh builtin test and return appropriate exit
status.  
  The shiny new stdio library does not only not work under A/UX, it passes
the supplied test with flying colors! (The docs mention SunOS4.0 as the
only system where this is true; guess now we can add another to the list.)
Using the new stdio lib. causes the expire regression test to do strange
things; large pieces of the output start disappearing from the messages
that are being fprintf'ed to stderr.  Anyway, don't even think of using
the C News stdio lib.  
  Something seems to be amiss with superkluge; at least, the regression
test for it (part of the expire test) bombed with complaints about bad
message-id format.  I'm not sure why it does this, and since I don't plan
to use superkluge, I don't really care a lot.
  Australian readnews won't even compile.  Since anyone in his right 
mind is using rn anyway, I haven't spent too much time looking into this one,
either.  You'll be happy to know that rn compiles and runs just fine on A/UX.
  Being a somewhat paranoid sort, I specified -B/usr/lib/big/ in the compiler
options for making C News, so that it would use the "big" versions of the
compiler passes; in my experience out there many programs will overflow the
tables of the "regular" A/UX C compiler.  I rather doubt that anything in C
News is likely to be big enough to break on the "small" cc, but I didn't try
it, having had entirely too much hassle with programs that did break in the
past.
  The C News distribution contains versions of queuelen for HDB and for 
old w/subdirectory versions of UUCP.  Alas, A/UX uses old UUCP without
subdirectories (*despite* what the uucico(1) man page says!), so minor
hacking here is required. If anyone is interested, I can post the hacked
version.

   One thing I discovered: the inews shell script supplied is somewhat
sensitive to ordering of options.  In particular, 
inews -C newsgroup -d local will *not* create a local-only newgroup message,
as the Distribution: local will get tacked onto the body of the newgroup
message, not the header.  Most of you will by now have seen the results of
my accidentally discovering this :-( :-(.  Alas, looking at inews it looks
like this may be a bit difficult to fix; that has got to be one of the
nastiest shell scripts I've ever seen, and I don't see any obvious ways to
fix it without making it even nastier.
-- 
Richard Todd   rmtodd@chinet.chi.il.us  or  rmtodd@uokmax.ecn.uoknor.edu  
                                    aka     ...!sun!texsun!uokmax!rmtodd

henry@utzoo.uucp (Henry Spencer) (06/25/89)

In article <3398@uokmax.UUCP> rmtodd@uokmax.UUCP (Richard Michael Todd) writes:
>  The shiny new stdio library does not only not work under A/UX, it passes
>the supplied test with flying colors! (The docs mention SunOS4.0 as the
>only system where this is true; guess now we can add another to the list.)

Argh.  I was afraid of that.  If you can figure out what's going on and find
a test that will spot the incompatibility, we'd love to hear about it.  (Geoff
tried fairly hard to do this for SunOS 4.0 but couldn't, admittedly under a
severe time constraint.)  Replacing *part* of a library is always fraught
with potential portability problems.

>Using the new stdio lib. causes the expire regression test to do strange
>things...

Glad to hear that *something* spotted it, anyway.

>  Something seems to be amiss with superkluge; at least, the regression
>test for it (part of the expire test) bombed with complaints about bad
>message-id format.  I'm not sure why it does this, and since I don't plan
>to use superkluge, I don't really care a lot.

If you get around to investigating it, I'd be curious to know what the
problem is.  If not, no big deal.  Somebody who really cares can sort it
out.  Our opinion of the issue can be seen by the name we gave the thing...

>  Australian readnews won't even compile.  Since anyone in his right 
>mind is using rn anyway, I haven't spent too much time looking into this...

Again, we'd be curious to hear, but are not too concerned.  Our major motive
for including readnews was to have at least a nominally complete system, so
that it would not be necessary to retain any of B News.  The main problem
with rn is that naive users who just want to read the urgent bulletins from
the system administration are intimidated by it.

>  The C News distribution contains versions of queuelen for HDB and for 
>old w/subdirectory versions of UUCP.  Alas, A/UX uses old UUCP without
>subdirectories (*despite* what the uucico(1) man page says!), so minor
>hacking here is required. If anyone is interested, I can post the hacked
>version.

Please do, or at least mail it to the c-news address so we can incorporate
it in a future update.  I wanted to include such a version, but didn't
dare because I didn't have anywhere I could test it.

>   One thing I discovered: the inews shell script supplied is somewhat
>sensitive to ordering of options.  In particular, 
>inews -C newsgroup -d local will *not* create a local-only newgroup message...

Oops.  This will be recorded as a bug.
-- 
NASA is to spaceflight as the  |     Henry Spencer at U of Toronto Zoology
US government is to freedom.   | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

rmtodd@uokmax.UUCP (Richard Michael Todd) (06/26/89)

In article <1989Jun24.210627.25374@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
[Re: stdio not working correctly on A/UX]
>Argh.  I was afraid of that.  If you can figure out what's going on and find
>a test that will spot the incompatibility, we'd love to hear about it.  (Geoff
>tried fairly hard to do this for SunOS 4.0 but couldn't, admittedly under a
>severe time constraint.)  Replacing *part* of a library is always fraught
>with potential portability problems.

Well, I think I've figured out some of what's going on.  Appended to the end
of this posting is a script showing a short program which reproduces the
bug, along with some looking inside the program with sdb.  Note especially
the place where the new fwrite is called by _doprnt (well, actually _dowrite
called by _doprnt), and at that point fp->_cnt is negative.  I'd love to
hear someone with SVR2 library source explain why that happens....

>>  Australian readnews won't even compile.  Since anyone in his right 
>>mind is using rn anyway, I haven't spent too much time looking into this...
Well, for starters, the program makes references to "struct sgttyb", which is
no more for us USG-using folks.  Looking more closely at readnews.c
(especially page()), shows that this program doesn't really have code to
handle USG termio, just comments showing where such code might be if it
were there, which it isn't.  

>>  The C News distribution contains versions of queuelen for HDB and for 
>>old w/subdirectory versions of UUCP.  Alas, A/UX uses old UUCP without
>>subdirectories (*despite* what the uucico(1) man page says!), so minor
>>hacking here is required. If anyone is interested, I can post the hacked
>>version.
Okay, here's the queuelen script for A/UX, followed by the typescript (showing
the stdio bugs) I mentioned earlier
--------------------queuelen-----------------------------------------------
#! /bin/sh
# Find size of current queue of news outbound to $1.  Old-uucp version.

# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/lib/news/bin/config}

PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
umask $NEWSUMASK

cd /usr/spool/uucp

case "$1" in
?|??|???|????|?????|??????|???????)	site="$1" ;;
*)	site=`expr "$1" : '^\(.......\).*'`
esac

ls | egrep "^C\.$site......\$" | wc | awk '{print $1}'

--------------------typescript--------------------------------------
Script started on Sun Jun 25 00:51:51 1989
1 servalan ~/cnews/libstdio % cat test1.c
#include <stdio.h>
main() {
    char buf[512];
    while (1) {
	fgets(buf, 511, stdin);
	fprintf(stderr,"line = <%s>\n", buf);
    }
    fwrite(buf,strlen(buf),1,stderr);
    /* gratuitous fwrite call above there to force new fwrite to be linked in */
}
2 servalan ~/cnews/libstdio % cc -o test1 -g test1.c ../libcnews.a
"test1.c", line 8: warning: statement not reached
3 servalan ~/cnews/libstdio % test1
llllllllllll
line = <>
sfsfsfsfsf
line = <>
4 servalan ~/cnews/libstdio % sdb test1
Warning: `filbuf.c' not found
Warning: `fprintf.c' not found
Warning: `doprnt.c' not found
Warning: `ecvt.c' not found
Warning: `flsbuf.c' not found
Warning: `isatty.c' not found
Warning: `malloc.c' not found
No core image
*fwrite:b
fwrite:70 b
*r
test1 
llllllllll
Breakpoint at
fwrite:70: {
*s
fwrite:71: 	register unsigned bytes = count * size;
*t
fwrite(ptr=llllllllll^J,size=1,count=11,fp=0x4008b0)   [rdwr.c:71]
_dowrite(p=llllllllll^J,n=11,iop=0x4008b0,ptrptr=0x1ffffb0c)   [doprnt.c:88]
_doprnt(format=line = <%s>^J,args=,iop=0x4008b0)   [doprnt.c:747]
fprintf(iop=0x4008b0,format=line = <%s>^J,va_alist=536869700)   [fprintf.c:40]
main(1,536870232,536870240)   [test1.c:6]
*fp[0]/
fp[0]._cnt/ -8
fp[0]._ptr/ 0x400e68
fp[0]._base/ 0x400e60
fp[0]._flag/ ^F 
fp[0]._file/ ^B 
*q
5 servalan ~/cnews/libstdio % exit

script done on Sun Jun 25 00:54:03 1989