I have no interest in tracing through libshell code, but if you
think RTC has a bug, and if you care to create a test case, I'd
be glad to verify the bug and file a CR for you.
--chris
Roland Mainz wrote:
> Hi!
>
> ----
>
> While doing some testing for ksh93-integration update2 on B111 I hit the
> following "dbx -access" error in usr/src/lib/libshell/common/edit/edit.c
> and I am not able to make heads or tails from this issue (or I am always
> working at night and don't sot the error then):
> -- snip --
> <rtc> Read from uninitialized (rui):
> Attempting to read 4 bytes at address 0x80472dc
> which is 40 bytes above the current stack pointer
> =>[1] tty_get(fd = 0, tty = 0x80472dc), line 190 in "edit.c"
> [2] tty_check(fd = 0), line 165 in "edit.c"
> [3] sh_iocheckfd(shp = 0x82269f4, fd = 0), line 1817 in "io.c"
> [4] sh_iostream(shp = 0x82269f4, fd = 0), line 471 in "io.c"
> [5] sh_ioinit(shp = 0x82269f4), line 405 in "io.c"
> [6] sh_init(argc = 3, argv = 0x80479bc, userinit = (nil)), line 1087
> in "init.c"
> [7] sh_main(ac = 3, av = 0x80479bc, userinit = (nil)), line 156 in
> "main.c"
> [8] main(argc = 3, argv = 0x80479bc), line 46 in "pmain.c"
> -- snip --
>
> ... but looking at the matching section of code in "edit.c" ...
> -- snip --
> 155
> 156 /*
> 157 * This routine returns true if fd refers to a terminal
> 158 * This should be equivalent to isatty
> 159 */
> 160 int tty_check(int fd)
> 161 {
> 162 register Edit_t *ep =
> (Edit_t*)(sh_getinterp()->ed_context);
> 163 struct termios tty;
> 164 ep->e_savefd = -1;
> 165 return(tty_get(fd,&tty)==0);
> 166 }
> 167
> 168 /*
> 169 * Get the current terminal attributes
> 170 * This routine remembers the attributes and just returns them
> if it
> 171 * is called again without an intervening tty_set()
> 172 */
> 173
> 174 int tty_get(register int fd, register struct termios *tty)
> 175 {
> 176 register Edit_t *ep =
> (Edit_t*)(sh_getinterp()->ed_context);
> 177 if(fd == ep->e_savefd)
> 178 *tty = ep->e_savetty;
> 179 else
> 180 {
> 181 while(tcgetattr(fd,tty) == SYSERR)
> 182 {
> 183 if(errno !=EINTR)
> 184 return(SYSERR);
> 185 errno = 0;
> 186 }
> 187 /* save terminal settings if in cannonical state
> */
> 188 if(ep->e_raw==0)
> 189 {
> 190 ep->e_savetty = *tty;
> 191 ep->e_savefd = fd;
> 192 }
> 193 }
> 194 return(0);
> 195 }
> 196
> 197 /*
> 198 * Set the terminal attributes
> 199 * If fd<0, then current attributes are invalidated
> 200 */
> -- snip --
>
> ... the loop in line 181 only loops for errors, if |tcgetattr()| returns
> success (or better: A non-|-1| return code (|SYSERR| is a #define to
> |-1|)) the code moves forward to line 190. Where is the error in this
> case - is there any condition when |tcgetattr()| returns "success" but
> doesn't fill-out the |struct termios| structure passed via |tty| ?
>
> Compiler/dbx versions are (note I am using the Ceres dbx since SS12
> dbx's "check -access" is broken in B111):
> $ cc
> -V
>
> cc: Sun C 5.9 SunOS_i386 Patch 124868-07 2008/10/07
> usage: cc [ options] files. Use 'cc -flags' for details
> $ /opt/SS_express200811v2/SUNWspro/bin/dbx -V
> Sun Ceres DBX Debugger 7.7 SunOS_i386 2008/10/22
>
> ----
>
> Bye,
> Roland
>