[comp.unix.aix] X11r4 xterm problem

boote@bierstadt.scd.ucar.edu (Jeff W. Boote) (09/28/90)

    I ported X11R4 to the 6000 and I'm having a problem with xterm.  Every
once in a while I get the following error mesg:

Warning: no access to tty; thus no job control in this shell...

And true to the error mesage I have all kinds of problems with that shell.
It almost acts like I have two shells that keep swapping back and 
forth without any warning.  Has anyone else seen this message or have any
idea what I can do to fix it?  Is this a system configuration problem/ an
R4 problem or what?

Also of concern: R4 xload gives me the following error:

xload: cannot get name list from /unix


I would be most appreciative of any and all help/comments/suggestions on
these two problems.  Email unless you feel it would be of general interest.
I will summerize and post if there is interest.

Jeff W. Boote                    NCAR/SCD
boote@ncar.ucar.edu           Boulder, Colo

hogdenb@hope.its.rpi.edu (Brett M Hogden) (09/29/90)

>>>>> On 27 Sep 90 23:32:40 GMT,
      boote@bierstadt.scd.ucar.edu (Jeff W. Boote) said:

     I ported X11R4 to the 6000 and I'm having a problem with xterm.
     Every once in a while I get the following error mesg:

     Warning: no access to tty; thus no job control in this shell...

     And true to the error mesage I have all kinds of problems with
     that shell.  It almost acts like I have two shells that keep
     swapping back and forth without any warning.  Has anyone else
     seen this message or have any idea what I can do to fix it?  Is
     this a system configuration problem/ an R4 problem or what?

     Also of concern: R4 xload gives me the following error:

     xload: cannot get name list from /unix

     I would be most appreciative of any and all help/comments/suggestions
     on these two problems.  Email unless you feel it would be of general
     interest.  I will summerize and post if there is interest.

Although I cannot offer much help, I can perhaps add some more
symptoms to the list.  I see the same results on AIX370 (on an IBM
3090-200S mainframe), AIX PS/2 v1.2, and AIX RS6000 v3.1:

First, in the supplied /bin/csh:

   3:hogdenb@aix01> ps x
        PID      TT STAT  TIME COMMAND
     111743      p4 R>    0:00 ps x
     111601      p4 S>    0:00 csh
   4:hogdenb@aix01>

Then, I start GNU bash [or tcsh, for that matter; both  yield similar
results]:

   4:hogdenb@aix01> bash
   ~
   1:aix01> ps x
        PID      TT STAT  TIME COMMAND
     111744      p4 S>    0:00 bash
     111749       ? R>    0:00 ps x       [note the TTY is unknown]
     111601      p4 S>    0:00 csh
   ~
   2:aix01> ps t
        PID      TT STAT  TIME COMMAND
     111744      p4 S>    0:00 bash
     111601      p4 S>    0:00 csh
   ~
   3:aix01> csh
   Warning: no access to tty; thus no job control in this shell...
   1:hogdenb@aix01> ps t
        PID      TT STAT  TIME COMMAND
     111744      p4 I>    0:00 bash
     111601      p4 I>    0:00 csh
   2:hogdenb@aix01> ps x
        PID      TT STAT  TIME COMMAND
     111744      p4 I>    0:00 bash
     111751       ? S>    0:00 csh
     111601      p4 I>    0:00 csh
     111760       ? R>    0:00 ps x
   3:hogdenb@aix01> echo $$
   111751
   4:hogdenb@aix01> exit
   ~
   4:aix01> exec csh
   1:hogdenb@aix01>

It seems, from all of this, that children of bash (and tcsh) do not
inherit knowledge of the TTY, and can't ever get access to it.
/bin/csh seems not to have this problem, but of course without source
code, I haven't been able to figure out _how_ it works.  As an aside,
some things that this problem breaks or otherwise shows up in are
/bin/passwd and screen.  passwd automatically fails, unless it is
called from an exec'd csh, or if it is exec'd itself.  screen just
yields the "Warning: no access..." message for each new window
invocation.

I'd _really_ like to hear from someone who has figured this one out. I
wish I had more time to play around with this problem.  It might in
fact be something trivial, that I am overlooking, or perhaps it is
some bizarrity of AIX that I just don't know about (yet!).  I
apologise for the length of this follow-up, but I thought that some
extra information might be useful.

Some 85+ lines back, I cited that Jeff said he would post a summary of
responses.  I hope this helps someone out there provide him with a
useful summary to share. :-)

Brett

-- 
      *  Brett M Hogden -- hogdenb@rpi.edu -- hogdenb@rpitsmts.bitnet  *

wlm@entwash.watson.ibm.com (Bill Moran) (10/01/90)

Errrrr, the no access to tty means that you didn't port X11R4.
Porting means you got it *working* not that you made it compile.
Xload needs to be ported, as the AIX kernal doesn't keep the load average
information needed. My understanding is that is is due to the crazy
security classifications. To make xload work, you need to calculate the
load average yourself. If you have BSD sourcesm it is easy to look in
the kernel, figure out how they do it, and then you simply need to
do the same thing. I would include the code to do this, but since it is
derivative of the BSD kernel code, that would probably be a no-no.
As for xterm.... the changes needed are something like:

*** main.c      Thu Jul 26 23:03:23 1990
--- main.c.orig Thu Jul 26 18:37:12 1990
***************
*** 1,5 ****
  #ifndef lint
! static char rcs_id[] = "$XConsortium: main.c,v 1.145 90/01/11 14:22:31
jim Exp
 $";
  #endif        /* lint */

  /*
--- 1,5 ----
  #ifndef lint
! static char rcs_id[] = "$XConsortium: main.c,v 1.144 89/12/20 21:39:07
jim Exp
 $";
  #endif        /* lint */

  /*
***************
*** 79,89 ****
  #define HAS_UTMP_UT_HOST
  #define HAS_BSD_GROUPS
  #endif
- #ifdef AIXV3
- #define HAS_UTMP_UT_HOST
- #define HAS_BSD_GROUPS
- #define USE_SYSV_UTMP
- #endif
  #ifdef macII
  #define HAS_UTMP_UT_HOST
  #define HAS_BSD_GROUPS
--- 79,84 ----
***************
*** 931,951 ****
        /* got one! */
        return(0);
  #else /* not (umips && SYSTYPE_SYSV) */
- #ifdef AIXV3
-       struct stat fstat_buf;
-       char *name;
-       int temptty;
-
-       *pty = open ("/dev/ptc", O_RDWR);
-       if ((*pty < 0) || ((name = ttyname(*pty)) == NULL)) {
-         return(1);
-       }
-       strcpy( ttydev, name );
-       strcpy( ptydev, name );
-       ptydev[7] = 'c';
-       ttydev[7] = 's';
-       return(0);
- #else
  #ifdef CRAY
        for (; devindex < 256; devindex++) {
            sprintf (ttydev, "/dev/ttyp%03d", devindex);
--- 926,931 ----
***************
*** 980,986 ****
            (void) letter++;
        }
  #endif /* CRAY else not CRAY */
- #endif /* AIXV3 else not AIXV3
        /* We were unable to allocate a pty master!  Return an error
         * condition and let our caller terminate cleanly.
         */
--- 960,965 ----
***************
*** 1459,1468 ****
                (void) setpgrp();
  #endif        /* USE_SYSV_PGRP */
                while (1) {
- #ifdef AIXV3
-                       setsid();
- #endif
-
  #ifdef TIOCNOTTY
                        if ((tty = open ("/dev/tty", 2)) >= 0) {
                                ioctl (tty, TIOCNOTTY, (char *) NULL);
--- 1438,1443 ----
***************
*** 1806,1813 ****
                tslot = ttyslot();
                added_utmp_entry = False;
                {
!                       if ((pw = getpwuid(screen->uid)) &&
!                           !resource.utmpInhibit &&
                            (i = open(etc_utmp, O_WRONLY)) >= 0) {
                                bzero((char *)&utmp, sizeof(struct utmp));
                                (void) strncpy(utmp.ut_line,
--- 1781,1788 ----
                tslot = ttyslot();
                added_utmp_entry = False;
                {
!                       if (!resource.utmpInhibit &&
!                           (pw = getpwuid(screen->uid)) &&
                            (i = open(etc_utmp, O_WRONLY)) >= 0) {
                                bzero((char *)&utmp, sizeof(struct utmp));
                                (void) strncpy(utmp.ut_line,
***************
*** 1877,1883 ****

                (void) setgid (screen->gid);
  #ifdef HAS_BSD_GROUPS
!               if (geteuid() == 0 && pw)
                  initgroups (pw->pw_name, pw->pw_gid);
  #endif
                (void) setuid (screen->uid);
--- 1852,1858 ----

                (void) setgid (screen->gid);
  #ifdef HAS_BSD_GROUPS
!               if (geteuid() == 0)
                  initgroups (pw->pw_name, pw->pw_gid);
  #endif
                (void) setuid (screen->uid);
***************
*** 1963,1982 ****
                /* fix pts sh hanging around */
                signal (SIGHUP, SIG_DFL);
  #endif
! #ifdef AIXV3
!               /* The AIXV3.1 "rsh" command turns off INTR in sigmask. We
!                  must turn it back on.  No you cannot solve this by calling
!                  signal(SIGINT,SIG_DFL).  Tried.
!                  -- Dan Greening dgreen@ibm.com  */
!               {
!                 extern int sigprocmask();
!                 int mask;
!                 sigset_t set, oset;
!
!                 sigemptyset(&set);
!                 sigprocmask(SIG_SETMASK,&set,&oset);
!               }
! #endif /* AIXV3 */
  #ifdef UTMP
                if(((ptr = getenv("SHELL")) == NULL || *ptr == 0) &&
                 ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) ||
--- 1938,1944 ----
                /* fix pts sh hanging around */
                signal (SIGHUP, SIG_DFL);
  #endif
!
  #ifdef UTMP
                if(((ptr = getenv("SHELL")) == NULL || *ptr == 0) &&
                 ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) ||

-------------------

Bill Moran

hearth@Unify.Com (Donald S. Hearth) (04/12/91)

  Thanks for all the help for building X11R4 on my RS 6000. I am still
  having problems with the R4 xterm, though.  I got it to build, but
  when I try to run it, I get the error message "unable to find a usable
  termcap entry".  I looked and there is a terminfo entry for xterm and
  vt100. 

  Can anybody help me with this?  

				 Thanks!
				 Don Hearth

-- 
***************************************************************************
*  Donald S. Hearth        *   address: hearth@unify.com                  *
*  UNIFY Corporation       *                                              *
*  Sacramento, CA          *   Go 49ers, A's, and LA Kings!               *