Subject: Re: bin/3982: ftp ignores eofc
To: Perry E. Metzger <perry@piermont.com>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 01/01/1998 21:49:52
On

> Date: Wed, 13 Aug 1997 11:38:18 -0400

Perry quoted from my PR bin/3982 and wrote

>>> Synopsis:       ftp ignores eofc
> Fixed in current, Mr. Mouse.  You haven't updated your source tree
> lately...

At the time, I hadn't.

I now have.  And I find that the problem is there (still or again,
whichever, though I suspect it's "still") in an ftp binary built from
the sup of Dec 31.  (And in passing, I'll note I'm somewhat ticked to
have sent-pr a problem, had the pr closed with "fixed in current", and
then find it's still there months later, in a release.  Perry, if you
still can't reproduce this, I can give you a login on an affected
machine so you can try it for yourself; contact me privately if you
want to take me up on that.)  I do have my patches applied to this
source tree, but no patches at all to usr.bin/ftp or lib/libedit.

This is on the serial console of a SS1+, though past experience
indicates it happens on ptys too.  "stty everything" reports

speed 9600 baud; 0 rows; 0 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
        -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
        brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl oxtabs
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -mdmbuf
        -cdtrcts
discard dsusp   eof     eol     eol2    erase   intr    kill    lnext   
^O      ^Y      ^Z      <undef> <undef> ^?      ^C      ^X      ^V      
min     quit    reprint start   status  stop    susp    time    werase  
1       ^\      ^R      ^Q      ^T      ^S      ^P      0       ^W      

When I run ftp, I see the following.  (I typed ^Z at each of the first
two "ftp> " prompts, then RETURN when nothing happened.)

% ktrace /usr/src/usr.bin/ftp/ftp
ftp> 
ftp> 
ftp> quit
% 

kdump output is rather large; I can supply it in full if desired.  Here
are what I think are relevant excerpts:

 19921 ktrace   RET   ktrace 0
 19921 ktrace   CALL  execve(0xeffffa53,0xeffff9f0,0xeffff9f8)
 19921 ktrace   NAMI  "/usr/src/usr.bin/ftp/ftp"
 19921 ftp      EMUL  "netbsd"
 19921 ftp      RET   execve JUSTRETURN
[...dynamic library and other startup goop...]
 19921 ftp      CALL  open(0x10062f61,0,0x1b6)
 19921 ftp      NAMI  ".editrc"
 19921 ftp      RET   open -1 errno 2 No such file or directory
 19921 ftp      CALL  open(0xeffff0a0,0,0x1b6)
 19921 ftp      NAMI  "/home/mouse/.editrc"
 19921 ftp      RET   open -1 errno 2 No such file or directory
[...more startup goop...]
 19921 ftp      CALL  write(0x1,0x38000,0x5)
 19921 ftp      GIO   fd 1 wrote 5 bytes
       "ftp> "
 19921 ftp      RET   write 5
 19921 ftp      CALL  ioctl(0,TIOCGETA,0x301c4)
 19921 ftp      RET   ioctl 0
 19921 ftp      CALL  ioctl(0,TIOCSETAW,0x30198)
 19921 ftp      RET   ioctl 0
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "\^Z"
 19921 ftp      RET   read 1
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "
       "
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x2)
 19921 ftp      GIO   fd 1 wrote 2 bytes
       "\r
       "
 19921 ftp      RET   write 2
 19921 ftp      CALL  ioctl(0,TIOCSETAW,0x3016c)
 19921 ftp      RET   ioctl 0
[...a whole bunch o' signal calls, sigprocmask & sigaction...]
 19921 ftp      CALL  write(0x1,0x38000,0x5)
 19921 ftp      GIO   fd 1 wrote 5 bytes
       "ftp> "
 19921 ftp      RET   write 5
 19921 ftp      CALL  ioctl(0,TIOCGETA,0x301c4)
 19921 ftp      RET   ioctl 0
 19921 ftp      CALL  ioctl(0,TIOCSETAW,0x30198)
 19921 ftp      RET   ioctl 0
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "\^Z"
 19921 ftp      RET   read 1
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "
       "
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x2)
 19921 ftp      GIO   fd 1 wrote 2 bytes
       "\r
       "
 19921 ftp      RET   write 2
 19921 ftp      CALL  ioctl(0,TIOCSETAW,0x3016c)
 19921 ftp      RET   ioctl 0
[...more signal calls...]
 19921 ftp      CALL  write(0x1,0x38000,0x5)
 19921 ftp      GIO   fd 1 wrote 5 bytes
       "ftp> "
 19921 ftp      RET   write 5
 19921 ftp      CALL  ioctl(0,TIOCGETA,0x301c4)
 19921 ftp      RET   ioctl 0
 19921 ftp      CALL  ioctl(0,TIOCSETAW,0x30198)
 19921 ftp      RET   ioctl 0
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "q"
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x1)
 19921 ftp      GIO   fd 1 wrote 1 bytes
       "q"
 19921 ftp      RET   write 1
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "u"
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x1)
 19921 ftp      GIO   fd 1 wrote 1 bytes
       "u"
 19921 ftp      RET   write 1
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "i"
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x1)
 19921 ftp      GIO   fd 1 wrote 1 bytes
       "i"
 19921 ftp      RET   write 1
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "t"
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x1)
 19921 ftp      GIO   fd 1 wrote 1 bytes
       "t"
 19921 ftp      RET   write 1
 19921 ftp      CALL  read(0,0xeffff3b7,0x1)
 19921 ftp      GIO   fd 0 read 1 bytes
       "
       "
 19921 ftp      RET   read 1
 19921 ftp      CALL  write(0x1,0x38000,0x2)
 19921 ftp      GIO   fd 1 wrote 2 bytes
       "\r
       "
 19921 ftp      RET   write 2
 19921 ftp      CALL  ioctl(0,TIOCSETAW,0x3016c)
 19921 ftp      RET   ioctl 0
[...yet more signal calls...]
 19921 ftp      CALL  exit(0)

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B