Debian bug report logs - #823
starting tcsh causes network traffic !
Package: tcsh; Reported by: iwj10@cus.cam.ac.uk (Ian Jackson); 60 days old.
Message received at debian-bugs:
From cus.cam.ac.uk!iwj10 Sun Apr 23 17:03:13 1995
Return-Path: <iwj10@cus.cam.ac.uk>
Received: from pixar.com by mongo.pixar.com with smtp
(Smail3.1.28.1 #15) id m0s3BcP-0003ckA; Sun, 23 Apr 95 17:03 PDT
Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA08211
(5.65c/IDA-1.4.4 for <debian-bugs@pixar.com>); Sun, 23 Apr 1995 17:03:03 -0700
Received: by bootes.cus.cam.ac.uk
(Smail-3.1.29.0 #30) id m0s3Bc5-000C00A; Mon, 24 Apr 95 01:02 BST
Received: by chiark
id m0s3BUG-0000Y6A
(Debian /\oo/\ Smail3.1.29.1 #29.30); Mon, 24 Apr 95 00:54 BST
Message-Id: <m0s3BUG-0000Y6A.ijackson@nyx.cs.du.edu>
Date: Mon, 24 Apr 95 00:54 BST
From: iwj10@cus.cam.ac.uk (Ian Jackson)
To: debian-bugs@pixar.com
Subject: Re: Bug#823: starting tcsh causes network traffic !
In-Reply-To: <m0s359Y-0005ttC@mongo.pixar.com>
References: <m0s2UzK-0003XnC@mongo.pixar.com>
<m0s359Y-0005ttC@mongo.pixar.com>
Precedence: air-mail
Bruce Perens writes ("Re: Bug#823: starting tcsh causes network traffic !"):
> Tcsh does getpeername() on file descriptor 0, and then tries to resolve the
> IP number from that so that it can put it in the $REMOTEHOST environment
> variable. That's what is doing a DNS lookup and dialing your phone.
But file descriptor 0 is a *psuedoterminal* (/dev/ttyp<whatever>).
getpeername will just return `socket operation on non socket'.
chiark:~> in.telnetd
in.telnetd: getpeername: Socket operation on non-socket
chiark:~>
If this is really what it is trying to do tcsh is probably being
braindead enough not to notice this, and then goes and tries to do a
number->name lookup on whatever happened to be in the sockaddr_in
struct when it started (probably 0.0.0.0).
If all it's trying to do is set $REMOTEHOST to the remote host name if
stdin is a socket that would be fine (and I suppose might be useful to
some people). Trying to set it to the remote host name if stdin
isn't a socket is not fine.
In summary, if that's what the feature really is, and it comes as
standard with tcsh, we should fix it rather than removing it.
However, the manpage says:
REMOTEHOST (+)
The host from which the user has logged in
remotely, if this is the case and the shell is
able to determine it. Set only if the shell was so
compiled; see the version shell variable.
This can't be found using getpeername(0). It has to be done by
reading utmp - see the strace below.
Incidentally, tcsh doesn't even seem to wait for the answer to its
question (and REMOTEHOST is unset). I would have thought that if it
was going to do a DNS query that involved spending real money on a
phone call it might at least have the courtesy to pay attention to the
reply.
> I suspect it should resolve the local host name without having to go through
> a remote DNS, this is perhaps a bug in your resolver configuration.
My resolver configuration doesn't generate unnecessary network
traffic. In particular, (a) I have `order hosts,bind' and all the
addresses in use by `local' machines are in the hosts file and (b) I
run a caching named.
> However,
> this TCSH feature, and the "watch utmp and tell me when people log in" feature,
> don't really belong in a shell.
That's a matter of opinion, and as such it seems most sensible to use
the upstream default unless we have a good reason not to (even if it's
only confused users). Certainly a `watch utmp and tell me when people
log in' feature should be off in noninteractive shells ...
I've just done an strace of tcsh starting up. An extract is below.
(BTW, the output of strace on tcsh is truly frightening. Compare
`strace tcsh </dev/null' with `strace bash </dev/null').
It looks like it's trying to do something to my system's hostname
`chiark' - probably, it's trying to turn `chiark' into an FQDN.
However, my hosts file lists `chiark' as the primary name. Also
relevant may be:
chiark:~> who am i
chiark!ian ttyp2 Apr 23 23:58 (:0.0)
chiark:~>
Ian.
uname({sys="Linux", node="chiark", ...}) = 0
alarm(2) = 0
getpeername(16, 0xbffff008, [16]) = -1 ENOTSOCK (Socket operation on non-s
ocket)
sigprocmask(SIG_BLOCK, [INT], []) = 0
time([798680515]) = 798680515
stat("/var/run/utmp", {st_mode=S_IFREG|0644, st_size=1176, ...}) = 0
open("/var/run/utmp", O_RDONLY) = 0
read(0, "\1\0\0\00035\0\0~\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0>\r\0\0tty1\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0y\0\0\0tty2\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0?\r\0\0tty3\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0@\r\0\0tty4\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0A\r\0\0tty5\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\5\0\0\0B\r\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0C\r\0\0ttyc2\0\0\0\0\0\0"..., 56) = 56
read(0, "\6\0\0\0D\r\0\0ttyc3\0\0\0\0\0\0"..., 56) = 56
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\7\0\0\0!$\0\0ttyp1\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\7\0\0\0000$\0\0ttyp2\0\0\0\0\0\0"..., 56) = 56
read(0, "\7\0\0\0/%\0\0ttyp3\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\7\0\0\0o%\0\0ttyp4\0\0\0\0\0\0\0"..., 56) = 56
read(0, "\7\0\0\0\247%\0\0ttyp5\0\0\0\0\0"..., 56) = 56
read(0, "\10\0\0\0\22\34\0\0ttyp6\0\0\0\0"..., 56) = 56
read(0, "", 56) = 0
close(0) = 0
stat("/etc/locale/C/libc.cat", 0xbfffe348) = -1 ENOENT (No such file or director
y)
stat("/usr/lib/locale/C/libc.cat", 0xbfffe348) = -1 ENOENT (No such file or dire
ctory)
stat("/usr/lib/locale/libc/C/usr/share/locale/C/libc.cat", 0xbfffe348) = -1 ENOE
NT (No such file or directory)
stat("/usr/local/share/locale/C/libc.cat", 0xbfffe348) = -1 ENOENT (No such file
or directory)
open("/etc/host.conf", O_RDONLY) = 0
fstat(0, {st_mode=S_IFREG|0644, st_size=26, ...}) = 0
brk(0x4c400) = 0x4c400
brk(0x4cc00) = 0x4cc00
read(0, "order hosts,bind\nmulti on\n", 1024) = 26
read(0, "", 1024) = 0
close(0) = 0
uname({sys="Linux", node="chiark", ...}) = 0
open("/etc/hosts", O_RDONLY) = 0
fstat(0, {st_mode=S_IFREG|0644, st_size=560, ...}) = 0
read(0, "127.0.0.1\tlocalhost\n\n136.170."..., 1024) = 560
read(0, "", 1024) = 0
close(0) = 0
open("/etc/resolv.conf", O_RDONLY) = 0
fstat(0, {st_mode=S_IFREG|0644, st_size=237, ...}) = 0
read(0, "domain al.cl.cam.ac.uk\nsearch c"..., 1024) = 237
read(0, "", 1024) = 0
close(0) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 0
connect(0, {sin_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.
1")}, 16) = 0
send(0, "\0\2\1\0\0\1\0\0\0\0\0\0\0\0\1\0"..., 17, 0) = 17
select(1, [0], NULL, NULL, {5, 0}) = ? ERESTARTNOHAND (To be restarted)
--- SIGALRM (Alarm clock) ---
alarm(0) = 0
--
Ian Jackson, at home. ijackson@nyx.cs.du.edu or iwj10@cus.cam.ac.uk
+44 1223 575512 Escoerea on IRC. http://www.cl.cam.ac.uk/users/iwj10/
2 Lexington Close, Cambridge, CB4 3LS, England. Urgent: iwj@cam-orl.co.uk
Acknowledgement sent to iwj10@cus.cam.ac.uk (Ian Jackson):
Extra info received and forwarded.
Full text available.
Information forwarded to debian-devel@pixar.com:
Bug#823; Package tcsh.
Full text available.
Message received at debian-bugs:
From pixar.com!bruce Sun Apr 23 10:10:13 1995
Return-Path: <bruce@pixar.com>
Received: from pixar.com by mongo.pixar.com with smtp
(Smail3.1.28.1 #15) id m0s35Ab-0005ttC; Sun, 23 Apr 95 10:10 PDT
Received: from mongo.pixar.com by pixar.com with SMTP id AA01600
(5.65c/IDA-1.4.4 for <debian-bugs@pixar.com>); Sun, 23 Apr 1995 10:10:03 -0700
Received: by mongo.pixar.com (Smail3.1.28.1 #15)
id m0s359Y-0005ttC; Sun, 23 Apr 95 10:09 PDT
Message-Id: <m0s359Y-0005ttC@mongo.pixar.com>
Date: Sun, 23 Apr 95 10:09 PDT
From: bruce@pixar.com (Bruce Perens)
To: debian-bugs@pixar.com, iwj10@cus.cam.ac.uk (Ian Jackson)
Subject: Re: Bug#823: starting tcsh causes network traffic !
References: <m0s2UzK-0003XnC@mongo.pixar.com>
Tcsh does getpeername() on file descriptor 0, and then tries to resolve the
IP number from that so that it can put it in the $REMOTEHOST environment
variable. That's what is doing a DNS lookup and dialing your phone.
I suspect it should resolve the local host name without having to go through
a remote DNS, this is perhaps a bug in your resolver configuration. However,
this TCSH feature, and the "watch utmp and tell me when people log in" feature,
don't really belong in a shell.
Bruce
--
Attention Ham Radio Operators: For information on "Linux for Hams", read
the World Wide Web page http://www.rahul.net/perens/LinuxForHams
Acknowledgement sent to bruce@pixar.com (Bruce Perens):
Extra info received and forwarded.
Full text available.
Information forwarded to debian-devel@pixar.com:
Bug#823; Package tcsh.
Full text available.
Message received at debian-bugs:
From cus.cam.ac.uk!iwj10 Sun Apr 23 06:24:20 1995
Return-Path: <iwj10@cus.cam.ac.uk>
Received: from pixar.com by mongo.pixar.com with smtp
(Smail3.1.28.1 #15) id m0s31e8-0005ttA; Sun, 23 Apr 95 06:24 PDT
Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA29400
(5.65c/IDA-1.4.4 for <debian-bugs@pixar.com>); Sun, 23 Apr 1995 06:24:16 -0700
Received: by bootes.cus.cam.ac.uk
(Smail-3.1.29.0 #30) id m0s31e3-000BzoA; Sun, 23 Apr 95 14:24 BST
Received: by chiark
id m0s31Mw-0000Y6A
(Debian /\oo/\ Smail3.1.29.1 #29.30); Sun, 23 Apr 95 14:06 BST
Message-Id: <m0s31Mw-0000Y6A.ijackson@nyx.cs.du.edu>
Date: Sun, 23 Apr 95 14:06 BST
From: iwj10@cus.cam.ac.uk (Ian Jackson)
To: Debian bugs submission address <debian-bugs@pixar.com>
Subject: Re: Bug#823: starting tcsh causes network traffic !
In-Reply-To: <m0s2UzK-0003XnC@mongo.pixar.com>
References: <m0s2UzK-0003XnC@mongo.pixar.com>
Precedence: air-mail
Bruce Perens writes ("Re: Bug#823: starting tcsh causes network traffic !"):
> Tcsh attempts to resolve what socket you've connected from so that it can
> place that infromation in the environment, and that uses the resolver.
> I gave Ian a patch to make that stuff time out recently, we should probably
> just turn it off.
Yes, please. That sort of thing should be in a separate program (a la
tty, or some such), shouldn't it ?
What socket, btw ? I was just running it as an ordinary program in an
xterm.
Ian.
Acknowledgement sent to iwj10@cus.cam.ac.uk (Ian Jackson):
Extra info received and forwarded.
Full text available.
Information forwarded to debian-devel@pixar.com:
Bug#823; Package tcsh.
Full text available.
Message received at debian-bugs:
From pixar.com!bruce Fri Apr 21 19:33:11 1995
Return-Path: <bruce@pixar.com>
Received: from pixar.com by mongo.pixar.com with smtp
(Smail3.1.28.1 #15) id m0s2V0P-0003XnC; Fri, 21 Apr 95 19:33 PDT
Received: from mongo.pixar.com by pixar.com with SMTP id AA24131
(5.65c/IDA-1.4.4 for <debian-bugs@pixar.com>); Fri, 21 Apr 1995 19:33:05 -0700
Received: by mongo.pixar.com (Smail3.1.28.1 #15)
id m0s2UzK-0003XnC; Fri, 21 Apr 95 19:32 PDT
Message-Id: <m0s2UzK-0003XnC@mongo.pixar.com>
Date: Fri, 21 Apr 95 19:32 PDT
From: bruce@pixar.com (Bruce Perens)
To: Debian bugs submission address <debian-bugs@pixar.com>,
debian-bugs@pixar.com, iwj10@cus.cam.ac.uk (Ian Jackson)
Subject: Re: Bug#823: starting tcsh causes network traffic !
Tcsh attempts to resolve what socket you've connected from so that it can
place that infromation in the environment, and that uses the resolver.
I gave Ian a patch to make that stuff time out recently, we should probably
just turn it off.
Bruce
--
Attention Ham Radio Operators: For information on "Linux for Hams", read
the World Wide Web page http://www.rahul.net/perens/LinuxForHams
Acknowledgement sent to bruce@pixar.com (Bruce Perens):
Extra info received and forwarded.
Full text available.
Information forwarded to debian-devel@pixar.com:
Bug#823; Package tcsh.
Full text available.
Message received at debian-bugs:
From cus.cam.ac.uk!iwj10 Fri Apr 21 13:35:58 1995
Return-Path: <iwj10@cus.cam.ac.uk>
Received: from pixar.com by mongo.pixar.com with smtp
(Smail3.1.28.1 #15) id m0s2PQk-0007XeA; Fri, 21 Apr 95 13:35 PDT
Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA11562
(5.65c/IDA-1.4.4 for <debian-bugs@pixar.com>); Fri, 21 Apr 1995 13:34:58 -0700
Received: by bootes.cus.cam.ac.uk
(Smail-3.1.29.0 #30) id m0s2PFP-000C06A; Fri, 21 Apr 95 21:24 BST
Received: by chiark
id m0s2P9S-0000XPA
(Debian /\oo/\ Smail3.1.29.1 #29.30); Fri, 21 Apr 95 21:18 BST
Message-Id: <m0s2P9S-0000XPA.ijackson@nyx.cs.du.edu>
Date: Fri, 21 Apr 95 21:18 BST
From: iwj10@cus.cam.ac.uk (Ian Jackson)
To: Debian bugs submission address <debian-bugs@pixar.com>
Subject: starting tcsh causes network traffic !
Precedence: air-mail
Package: tcsh
Version: 6.05-4
When doing the test for my previous bug report about tcsh, I found
that it fired up my dial-on-demand script.
I suspect nameserver traffic, though I wouldn't count on it.
This is unacceptable behaviour, of course.
Remember, phone calls and hence network activity cost money in some
places; a shell has no business doing that activity at every startup.
Ian.
Acknowledgement sent to iwj10@cus.cam.ac.uk (Ian Jackson):
New bug report received and forwarded.
Full text available.
Report forwarded to debian-devel@pixar.com:
Bug#823; Package tcsh.
Full text available.
Ian Jackson /
iwj10@thor.cam.ac.uk,
with the debian-bugs tracking mechanism