[comp.unix.aux] building rn for A/UX 2.0

alexis@panix.UUCP (Alexis Rosen) (09/26/90)

I would like to get rn running properly under A/UX 2.0. I have had no trouble
building it, and in general everything works just fine, but two niggling
little problems remain.

rn does not like job control. In particular, when I resume a suspended rn:
>rn read error: Interrupted system call
>
>Caught an internal error--.newsrc restored

Now, this looked to my untrained eye (I'm a fairly experienced programmer,
but I've never coded C in Unix) like it was in a mode where it thought it
was a System V program, and didn't like BSD signals for job control. So I
tried compiling all of the modules with -D_BSD_SOURCE. I did this by altering
the CC options line in the Makefile. Well, they compiled with the right
switches but it still didn't like suspend signals.

So I tried other defines. In particular, I added the following to CFLAGS:
-D_SYSV_SOURCE -ZS
-D_BSD_SOURCE
-D_BSD_SOURCE -ZB

I tried one last thing: CFLAGS were -D_SYSV_SOURCE -ZS, and I put "-lposix"
before "-lcurses" in libs.

None of these had any effect. Then, on an off the cuff remark by Matthias
Urlichs, I looked around the rn code, and finally inserted a single line
early in the init.c file: "set42sig();". This time around rn had no trouble
dealing with suspend signals.

I have no problem with hacking on a little code now and then but I don't
understand _why_ rn is having this trouble- I though the whole point of
those defines was to make stuff like this automatic. What's more, when I
built rn under A/UX 1.1 I'm don't recall this being a problem.

The other problem is, I think, not actually an rn problem at all. When I
use Pnews to post an article, the "Path:" header is "panix!panix.uucp",
whereas rn's followup command correctly generates "panix!alexis". It is
my guess that Bnews (in particular, inews?) is generating that path
incorrectly, but when rn supplies the path, it's OK. Does anyone know
if this is correct?

The news version is 2.11.18 (or thereabouts) and rn is 4.3.2.4.

Thanks,
---
Alexis Rosen
cmcl2!panix!alexis

rmtodd@uokmax.ecn.uoknor.edu (Richard Michael Todd) (09/27/90)

alexis@panix.UUCP (Alexis Rosen) writes:
>rn does not like job control. In particular, when I resume a suspended rn:
>>rn read error: Interrupted system call
>>
>>Caught an internal error--.newsrc restored


>I have no problem with hacking on a little code now and then but I don't
>understand _why_ rn is having this trouble- I though the whole point of
>those defines was to make stuff like this automatic. What's more, when I
>built rn under A/UX 1.1 I'm don't recall this being a problem.

I've seen this before occasionally on A/UX 1.1.  I've also seen it occasionally
on an Encore Multimax running BSD4.2 and BSD4.3-tahoe.  Unless Apple software
people have been sticking SysV-isms in the Encore kernel in the dead of night
:-), I don't think this is an Apple-specific problem.  
-- 
Richard Todd   rmtodd@chinet.chi.il.us  or  rmtodd@uokmax.ecn.uoknor.edu  
"Bible-punching heavyweight evangelistic boxing kangaroos..."

ron@afsg.apple.com (Ron Flax) (09/27/90)

In article <10509@panix.UUCP> alexis@panix.UUCP (Alexis Rosen) writes:
>rn does not like job control. In particular, when I resume a suspended rn:
>>rn read error: Interrupted system call
>>
>>Caught an internal error--.newsrc restored
Here is a set of diffs to make rn work properly on A/UX
2.0.. (A/UX 1.1, too)...

*** rn.c	Sat Sep  1 21:29:41 1990
--- ../rn.c	Sat Sep  1 22:04:39 1990
***************
*** 78,83
      register char *s;
      bool oh_for_the_good_old_days = FALSE;
      
      if (maxngtodo)
  	starthere = 0;
      else if (!foundany) {		/* nothing to do? */

--- 78,86 -----
      register char *s;
      bool oh_for_the_good_old_days = FALSE;
      
+ #ifdef _AUX_SOURCE
+     set42sig();
+ #endif
      if (maxngtodo)
  	starthere = 0;
      else if (!foundany) {		/* nothing to do? */
*** term.c	Sat Sep  1 21:29:04 1990
--- ../term.c	Sat Sep  1 22:39:24 1990
***************
*** 753,765
      for (;;) {
  	int_count = 0;
  	errno = 0;
! 	if (read_tty(whatbuf,1) < 0)
! 	    if (!errno)
! 	        errno = EINTR;
! 	    else {
! 	    perror(readerr);
! 	    sig_catcher(0);
! 	}
  #ifdef PUSHBACK
  	if (*whatbuf & 0200 || no_macros) {
  	    *whatbuf &= 0177;

--- 753,764 -----
      for (;;) {
  	int_count = 0;
  	errno = 0;
!         if (read_tty(whatbuf,1) < 0 && !errno)
!             errno = EINTR;
!         if (errno && errno != EINTR) {
!             perror(readerr);
!             sig_catcher(0);
!         }
  #ifdef PUSHBACK
  	if (*whatbuf & 0200 || no_macros) {
  	    *whatbuf &= 0177;

>The other problem is, I think, not actually an rn problem at all. When I
>use Pnews to post an article, the "Path:" header is "panix!panix.uucp",
>whereas rn's followup command correctly generates "panix!alexis". It is
>my guess that Bnews (in particular, inews?) is generating that path
>incorrectly, but when rn supplies the path, it's OK. Does anyone know
>if this is correct?

I think the problem here is a #define in config.h, check #define
INTERNET, mine is #undef INTERNET and it works properly,
even though we really are Internet..

--
Ron Flax
ron@afsg.apple.com	
Apple Federal Systems Group

alexis@panix.uucp (Alexis Rosen) (10/02/90)

In article <1990Sep26.184104.27321@uokmax.ecn.uoknor.edu> rmtodd@uokmax.ecn.uoknor.edu (Richard Michael Todd) writes:
>alexis@panix.UUCP (Alexis Rosen) writes:
>>rn does not like job control. In particular, when I resume a suspended rn:
>>>rn read error: Interrupted system call
>>>
>>>Caught an internal error--.newsrc restored
>I've seen this before occasionally on A/UX 1.1.  I've also seen it occasionally
>on an Encore Multimax running BSD4.2 and BSD4.3-tahoe.  Unless Apple software
>people have been sticking SysV-isms in the Encore kernel in the dead of night
>:-), I don't think this is an Apple-specific problem.  

But it is. In particular, it's a failure to deal with 4.3 signals. That's
necessarily Apple's problem.

But, as I said, that's not what bothers me. What bothers me is that I could
swear that it compiled fine under 1.1 _without_ adding in the set42sig() call
that I finally fixed it with. Also, there ought to be (and perhaps there is?)
a way to tell the compiler to fix that up for you, without messing with the
source. In fact, that's sort of what I expected the _SYSV_SOURCE define to do.
(Clearly, I'm not going to escape the man pages for much longer...)

---
Alexis Rosen
{cmcl2,apple}!panix!alexis
alexis@panix.uucp

alexis@panix.uucp (Alexis Rosen) (10/02/90)

In article <460@afsg.apple.com> ron@afsg.apple.com (Ron Flax) writes:
>Here is a set of diffs to make rn work properly on A/UX
>2.0.. (A/UX 1.1, too)...
>
>*** rn.c	Sat Sep  1 21:29:41 1990
>--- ../rn.c	Sat Sep  1 22:04:39 1990
>***************
>*** 78,83
>      register char *s;
>      bool oh_for_the_good_old_days = FALSE;
>      
>      if (maxngtodo)
>  	starthere = 0;
>      else if (!foundany) {		/* nothing to do? */
>
>--- 78,86 -----
>      register char *s;
>      bool oh_for_the_good_old_days = FALSE;
>      
>+ #ifdef _AUX_SOURCE
>+     set42sig();
>+ #endif
>      if (maxngtodo)
>  	starthere = 0;
>      else if (!foundany) {		/* nothing to do? */
>*** term.c	Sat Sep  1 21:29:04 1990
>--- ../term.c	Sat Sep  1 22:39:24 1990
>***************
>*** 753,765
>      for (;;) {
>  	int_count = 0;
>  	errno = 0;
>! 	if (read_tty(whatbuf,1) < 0)
>! 	    if (!errno)
>! 	        errno = EINTR;
>! 	    else {
>! 	    perror(readerr);
>! 	    sig_catcher(0);
>! 	}
>  #ifdef PUSHBACK
>  	if (*whatbuf & 0200 || no_macros) {
>  	    *whatbuf &= 0177;
>
>--- 753,764 -----
>      for (;;) {
>  	int_count = 0;
>  	errno = 0;
>!         if (read_tty(whatbuf,1) < 0 && !errno)
>!             errno = EINTR;
>!         if (errno && errno != EINTR) {
>!             perror(readerr);
>!             sig_catcher(0);
>!         }
>  #ifdef PUSHBACK
>  	if (*whatbuf & 0200 || no_macros) {
>  	    *whatbuf &= 0177;

(Y'know, it's amazing how helpful some Apple folks can be when they actually
have a good product to help us with...)

Thanks, Ron, but that raises a question: What's the second patch for? And, why
did you pick that particular spot for the set42sig()? I took a quick (3 min)
look at the source and put it in init.c, right after the end of the first
ifdef, before anything gets done. Seemed to work fine, too. Is there any
reason I should go back and change it?

BTW, about my complaint that Bnews was making bad headers: the solution is
simple. Go to Cnews. It's _wonderful_!!! Henry's claim that it's 25-30
times faster than Bnews is, if anything, conservative.

Thanks again,
---
Alexis Rosen
{cmcl2,apple}!panix!alexis
alexis@panix.uucp

ron@afsg.apple.com (Ron Flax) (10/03/90)

In article <1990Oct2.053557.5698@panix.uucp> alexis@panix.uucp (Alexis Rosen) writes:
>Thanks, Ron, but that raises a question: What's the second patch for? And, why
>did you pick that particular spot for the set42sig()? I took a quick (3 min)
>look at the source and put it in init.c, right after the end of the first
>ifdef, before anything gets done. Seemed to work fine, too. Is there any
>reason I should go back and change it?

I always put the set42sig() call as the first function call since I
want to setup BSD (reliable) style signal handling from the start of 
a program.

As for the second patch, that one will fix the job control bug in rn.
It used to be coded that way several patches ago.. and it worked then,
now if you don't make that patch rn barfs when you try to resume from a
suspended rn session.

--
Ron Flax
ron@afsg.apple.com	
Apple Federal Systems Group