[alt.hackers] Explanation needed.

elapinsk@sales.GBA.NYU.EDU ('Crazy' Emery Lapinski) (03/02/91)

I once wrote a shell program that repeatedly did a 'ps -augx' but I suppose
any command would work.  I then ran it with a 'nohup' and then hung up
the phone, because it was going too fast and I couldn't get a chance to
stop it.  I called back but as soon as I connected to the machine, this
program was writing its output to my terminal even though I hadn't logged
on yet.  I called back and went through telnet to another computer then
telneted to my machine and could then kill it.  Can anyone explain how
this might of happened and any other information along the same lines?

emmonsl@athena.ecs.csus.edu (L. Scott Emmons) (03/04/91)

In article <10133@sales.GBA.NYU.EDU> elapinsk@sales.GBA.NYU.EDU ('Crazy' Emery Lapinski) writes:
>I once wrote a shell program that repeatedly did a 'ps -augx' but I suppose
>any command would work.  I then ran it with a 'nohup' and then hung up
>the phone, because it was going too fast and I couldn't get a chance to
>stop it.  I called back but as soon as I connected to the machine, this
>program was writing its output to my terminal even though I hadn't logged
>on yet.  I called back and went through telnet to another computer then
>telneted to my machine and could then kill it.  Can anyone explain how
>this might of happened and any other information along the same lines?

Yep...output from a program is attached to a tty, not to a user.  So, until
that program ended, output went to that tty; regardless of whether or not
anyone was logged onto it or not...As it turned out, completely by chance,
when you called back you were connected to the same tty that you were just
on! If someone else had connected to that tty right when you logged off, they
would have gotten your process' output...

			L. Scott Emmons
			---------------
	emmons@csus.csus.edu  <or>  ...[ucbvax]!ucdavis!csus!emmons
		Packet: kc6nfp@kg6xx.#nocal.ca.usa.na

ralf+@cs.cmu.edu (Ralf Brown) (03/04/91)

In article <1991Mar3.215703.15745@csusac.csus.edu> emmonsl@athena.ecs.csus.edu (L. Scott Emmons) writes:
}In article <10133@sales.GBA.NYU.EDU> elapinsk@sales.GBA.NYU.EDU ('Crazy' Emery Lapinski) writes:
}Yep...output from a program is attached to a tty, not to a user.  So, until
}that program ended, output went to that tty; regardless of whether or not
}anyone was logged onto it or not...As it turned out, completely by chance,
}when you called back you were connected to the same tty that you were just
}on! If someone else had connected to that tty right when you logged off, they
}would have gotten your process' output...

That's one nice thing about the detachable pty's in Mach--if you get 
disconnected, you can later reconnect from the same or a different port.
Of course, things get a little strange if you reconnect from somewhere that
requires a different termcap than the original connection....

Sorry, no ObHack....  I do have some ideas for neat things to do to DESQview,
but they'll have to wait <sigh>.

--
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/3.1
BITnet: RALF%CS.CMU.EDU@CMUCCVMA   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | It isn't what we don't know that gives us trouble, it's
I claim something?| what we know that ain't so.  --Will Rogers

anthony@convex.csd.uwm.edu (Anthony J Stieber) (03/05/91)

In article <1991Mar4.025618.29347@cs.cmu.edu> ralf+@cs.cmu.edu (Ralf Brown) writes:
>That's one nice thing about the detachable pty's in Mach--if you get 
>disconnected, you can later reconnect from the same or a different port.
>Of course, things get a little strange if you reconnect from somewhere that
>requires a different termcap than the original connection....

Something like this capability is in "screen" a multiple virtual vt100
window program for ASCII terminals.  The program can be detached from
the ttys it created, then started up again reattaching to the same
ttys.  It's great for slow computers that take forever to start up some
programs.  It's better in some ways than "window" in that it emulates a
vt100, but doesn't allow more than one window with no overlapping.
"screen" is available from prep.ai.mit.edu.

Obhack:
	A peer to peer file transfer system for Novell Netware
	...written in batch language.
--
<-:(= Anthony Stieber	anthony@csd4.csd.uwm.edu   uwm!uwmcsd4!anthony 

zane@ddsw1.MCS.COM (Sameer Parekh) (03/09/91)

	I sort of did a similar thing, with worse results. . .I wrote
a shell script to see who logged on and off. . .(Little did I know
that we had watch.)  I 'who' into a file, then 'who'ed into another
file, 'diff'ed them, and then copied the new file to the old file. . .
very simple, very dumb.  I ran the program it worked fine, I was
using a dial-up so I had no idea what was going on on the other end.
	So I hung up, but I forgot to kill the process. . .(On my
system I didn't have to do a nohup, neither I nor my sysadmin knows why.)
So then someone else called on the same tty and got the diff messages. . .
needless to say, he was confused. . .then I called and he 'talk'ed to me.
I explained what was going on and I killed the process.
	Then one day my sysadmin got mad at me. . .I had no idea why. . .
because I didn't put a sleep into the script it was executing really
quickly and taking up MUCH CPU time. . .(I had no idea, honestly.)
So I deleted it. . .
	Then a month or so later, this guy I spoke to earlier said
that he ran the program at work, and the drive went crazy. . .I suggest
you DO NOT TRY THIS AT HOME!!!!

	(I'm sure all of you knew this would happen, I am just relating
my story. . .my first, I am new to the world of UNIX.)


-- 
zane@ddsw1.MCS.COM