lindner@cs.umn.edu (Paul Lindner) (09/20/90)
I've been having a weird problem for the longest time. I like to use` aliases for my ls command: alias ls 'ls -FC \!* |more' This works fine, however sometimes it stops both tasks and puts them in the background, (this is on various Suns using csh and tcsh). Typing fg restarts the listing. This is really irritating, typing fg and all. I've also had this problem on the IBM RS/6000. Except in this case typing fg just hangs the shell. Any solutions would be greatly appreciated. -- --------------------------------------------------------------------- Paul Lindner | Microcomputer & Workstation Asst. Sun System Administrator | Networks Center lindner@boombox.micro.umn.edu ||||| | | | | | | | |
gorpong@ping.uucp (Gordon C. Galligher) (09/21/90)
In article <1990Sep19.203803.25798@cs.umn.edu> lindner@cs.umn.edu (Paul Lindner) writes: >I've been having a weird problem for the longest time. I like to use` >aliases for my ls command: > > alias ls 'ls -FC \!* |more' > >This works fine, however sometimes it stops both tasks and puts them in >the background, (this is on various Suns using csh and tcsh). Typing >fg restarts the listing. This is really irritating, typing fg and all. More(1) is the problem here. I have not quite figured it out, but I had a similar problem when my users would type: history | more and it would do the same thing. When they use history | less it works every time. I really hate it when people come on and say "use this tool instead" but in this instance, it really is the only way I was able to work around the problem. It is immaterial that less is better than more (IMHO), in this instance it makes things work. -- Gordon. -- Gordon C. Galligher 9127 Potter Rd. #2E Des. Plaines, Ill. 60016-4881 telxon!ping%gorpong@uunet.uu.net (not tested) (Is this even legal??) ...!uunet!telxon!ping!gorpong (tested) (And it works!) "It seems to me, Golan, that the advance of civilization is nothing but an exercise in the limiting of privacy." - Janov Pelorat -- _Foundation's Edge_
subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (09/22/90)
>More(1) is the problem here. I have not quite figured it out, but I had a >similar problem when my users would type: history | more and it would do >the same thing. When they use history | less it works every time. I >really hate it when people come on and say "use this tool instead" but in >this instance, it really is the only way I was able to work around the >problem. It is immaterial that less is better than more (IMHO), in this >instance it makes things work. > > -- Gordon. I've been meaning to switch over to less so many times, but only ONE thing stopped me. It appears superior in many ways, but for one annoying inconvenience (IMHO). At the very end of the article, you HAVE to type q to quit. With more, I just hit the spacebar as the last screenfull pours over my screen and that's it. Does any body have any suggestions as to how I can make less behave like more? -Kartik (I need a new .signature -- any suggestions?) subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet kartik@silvertone.Princeton.EDU (NeXT mail) -| subbarao@pucc.Princeton.EDU - Bitnet
jbw@bucsf.bu.edu (Joseph Wells) (09/22/90)
In article <1990Sep20.185147.14158@ping.uucp> gorpong@ping.uucp (Gordon C. Galligher) writes: In article <1990Sep19.203803.25798@cs.umn.edu> (Paul Lindner) writes: >I've been having a weird problem for the longest time. I like to use` >aliases for my ls command: > > alias ls 'ls -FC \!* |more' > >This works fine, however sometimes it stops both tasks and puts them in >the background, (this is on various Suns using csh and tcsh). Typing >fg restarts the listing. This is really irritating, typing fg and all. > >I've also had this problem on the IBM RS/6000. Except in this case >typing fg just hangs the shell. More(1) is the problem here. I have not quite figured it out, but I had a similar problem when my users would type: history | more and it would do the same thing. When they use history | less it works every time. I suspect you're wrong, because there is a known problem with Sun's csh that causes this problem with pipelines in general. It's a race condition during the setup of the pipeline by the csh. I suspect that less works because it has a larger executable file and thus takes slightly longer for SunOS to load. I don't know about the problem on the IBM RS/6000. -- Joe Wells <jbw@bu.edu>
staff@cadlab.sublink.ORG (Alex Martelli) (09/23/90)
subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes: >I've been meaning to switch over to less so many times, but only ONE thing >stopped me. It appears superior in many ways, but for one annoying >inconvenience (IMHO). At the very end of the article, you HAVE to type q >to quit. With more, I just hit the spacebar as the last screenfull pours >over my screen and that's it. Does any body have any suggestions as to how >I can make less behave like more? Read the fine manual, friend - "less" has MANY features! Start it up with command line option -e to autoexit the SECOND time you hit EOF, or -E to autoexit the FIRST such time; set the envir variable LESS to any option string to make it default behavior. Many other fancy options are provided... do look them up! (me, i have experimented and find I like -e better than -E - one keybounce or accidental space won't destroy your chance to go back into the less'ed file, use an editor on it, etc - nice in pipes!). -- Alex Martelli - CAD.LAB s.p.a., v. Stalingrado 45, Bologna, Italia Email: (work:) staff@cadlab.sublink.org, (home:) alex@am.sublink.org Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; Fax: ++39 (51) 366964 (work only; any time of day or night).
dnb@meshugge.media.mit.edu (David N. Blank) (09/24/90)
> I've been meaning to switch over to less so many times, but only ONE > thing stopped me. It appears superior in many ways, but for one > annoying inconvenience (IMHO). At the very end of the article, you > HAVE to type q to quit. With more, I just hit the spacebar as the last > screenfull pours over my screen and that's it. Does any body have any > suggestions as to how I can make less behave like more? Well, from Mr. Manpage: : OPTIONS : ... : -e Normally the only way to exit less is via the "q" com- : mand. The -e option tells less to automatically exit : the second time it reaches end-of-file. : : -E The -E flag causes less to exit the first time it : reaches end-of-file. You can also set the environment variable "LESS" to contain "-E" and any other options which will be used every time you envoke less. Enjoy. Peace, dNb
mroussel@alchemy.chem.utoronto.ca (Marc Roussel) (09/25/90)
In article <JBW.90Sep21223022@bucsf.bu.edu> jbw@bucsf.bu.edu (Joseph Wells) writes: > In article <1990Sep19.203803.25798@cs.umn.edu> (Paul Lindner) writes: > >I've been having a weird problem for the longest time. I like to use` > >aliases for my ls command: > > > > alias ls 'ls -FC \!* |more' > > > >This works fine, however sometimes it stops both tasks and puts them in > >the background, (this is on various Suns using csh and tcsh). Typing > >fg restarts the listing. This is really irritating, typing fg and all. > >[...] there is a known problem with Sun's csh >that causes this problem with pipelines in general. It's a race condition >during the setup of the pipeline by the csh. I suspect that less works >because it has a larger executable file and thus takes slightly longer for >SunOS to load. If this is indeed the case, we have a similar (though slightly different) problem on our Apollo's. (Processes which start and execute too fast sometimes terminate before the pipe is open. This results in no output when there should have been.) Anyway, try alias ls '(ls -FC \!* | more)' On our machines, running the whole thing in a subshell slows the process start up enough to allow the pipe to open in a timely fashion. No guarantees... just a thought. Marc R. Roussel mroussel@alchemy.chem.utoronto.ca
lindner@cs.umn.edu (Paul Lindner) (09/26/90)
gorpong@ping.uucp (Gordon C. Galligher) writes: >> alias ls 'ls -FC \!* |more' >> >>This works fine, however sometimes it stops both tasks and puts them in >>the background, (this is on various Suns using csh and tcsh). Typing >>fg restarts the listing. This is really irritating, typing fg and all. >More(1) is the problem here. I have not quite figured it out, but I had a >similar problem when my users would type: history | more and it would do >[.........] More(1) isn't the problem here, I tried using less for a while but I still got the infamous: Stopped (tty output) [1] 21298 21299 So, it must be someplace in the shell. -- --------------------------------------------------------------------- Paul Lindner | Microcomputer & Workstation Asst. Sun System Administrator | Networks Center lindner@boombox.micro.umn.edu ||||| | | | | | | | |
lindner@cs.umn.edu (Paul Lindner) (09/27/90)
>Stopped (tty output) >[1] 21298 21299 >So, it must be someplace in the shell. Yes there is an answer and a solution, our friend the stty command: [-]tostop Stop background jobs that attempt to write to the terminal. With a `-', allow background jobs to write to the terminal. Thanks go to Jay Lessert for the solution to this problem. -- --------------------------------------------------------------------- Paul Lindner | Microcomputer & Workstation Asst. Sun System Administrator | Networks Center lindner@boombox.micro.umn.edu ||||| | | | | | | | |
pfalstad@phoenix.Princeton.EDU (Paul John Falstad) (09/27/90)
In article <1990Sep26.213542.20835@cs.umn.edu> lindner@cs.umn.edu (Paul Lindner) writes: >>Stopped (tty output) >>[1] 21298 21299 >Yes there is an answer and a solution, our friend the stty command: > > [-]tostop Stop background jobs that attempt to write to > the terminal. With a `-', allow background jobs > to write to the terminal. stty -tostop is the default on our system (SunOS 4.1), so that shouldn't be the problem. If you type cat foo &, cat will type out foo in the background to your tty -- no problem. But if you type more foo &, you'll get a SIGTTOU. Same with less foo &. I haven't seen the more source, but I just looked at less. One of the first things it does after parsing arguments is to do an TCSETAW ioctl(). According to termio(4): .... Certain ioctl() calls that set terminal parameters are treated in this same fashion, except that TOSTOP is not checked; the ^^^^^^ ^^ ^^^ ^^^^^^^ effect is identical to that of terminal writes when TOSTOP is set. ... Unless otherwise noted for a specific ioctl() call, these functions are restricted from use by background processes. Attempts to perform these calls will cause the process group of the process performing the call to be sent a SIGTTOU sig- nal. If the process is ignoring SIGTTOU, has SIGTTOU blocked, or is in the middle of process creation using vfork(), the process will be allowed to perform the call and the SIGTTOU signal will not be sent. TCSETAW cannot be performed from a background process, so less gets the SIGTTOU when it tries. I haven't seen the source for csh either, but apparently it forks off a new process and THEN sets the process group of the tty to the process group of the new process. If the child process gets far enough before the parent sets the ttypgrp, the child will do the ioctl before it is allowed to, and then get a SIGTTOU. What csh should do is have the child process ignore SIGTTOU and set the ttypgrp itself. I'm working on my own shell, so I had to learn all this the hard way. :-) If Lafontaine's elk would spurn Tom Jones, the engine must be our head, the dining car our esophagus, the guardsvan our left lung, the kettle truck our shins, the first class compartment the piece of skin at the nape of the neck, and the level crossing an electric elk called Simon.
Harald.Eikrem@elab-runit.sintef.no (10/02/90)
Joe Wells <jbw@bu.edu> responding to Gordon C. Galligher <gorpong@ping.uucp>: ================ > > alias ls 'ls -FC \!* |more' > >This works fine, however sometimes it stops both tasks and puts them in >the background, (this is on various Suns using csh and tcsh). Typing >fg restarts the listing. This is really irritating, typing fg and all. > >I've also had this problem on the IBM RS/6000. Except in this case >typing fg just hangs the shell. More(1) is the problem here. I have not quite figured it out, but I had a similar problem when my users would type: history | more and it would do the same thing. When they use history | less it works every time. I suspect you're wrong, because there is a known problem with Sun's csh that causes this problem with pipelines in general. It's a race condition during the setup of the pipeline by the csh. I suspect that less works because it has a larger executable file and thus takes slightly longer for SunOS to load. I don't know about the problem on the IBM RS/6000. ================ I dont know. I experience this problem somewhat different on a Sun Sparc 490 with os 4.0.3. I always use tcsh 5.12, btw. I think in nearly half the cases I pipe something into less, less hangs indefinitely and I have to suspend it with a ^Z and then fg. Nothing whatsoever gets written to my tty until I hit ^Z. I dont regularly use `more', but have not seen this behaviour with that one as of yet. What is going on? --Harald E
esa@tglobe2.tollpost-globe (Esa K Viitala) (10/02/90)
In article <90Oct1195212*Harald.Eikrem@elab-runit.sintef.no> Harald.Eikrem@elab-runit.sintef.no writes: >Joe Wells <jbw@bu.edu> responding to Gordon C. Galligher <gorpong@ping.uucp>: >================ > > > > alias ls 'ls -FC \!* |more' > > > >This works fine, however sometimes it stops both tasks and puts them in > >the background, (this is on various Suns using csh and tcsh). Typing > >fg restarts the listing. This is really irritating, typing fg and all. > > > More(1) is the problem here. I have not quite figured it out, but I had a >I suspect you're wrong, because there is a known problem with Sun's csh >that causes this problem with pipelines in general. It's a race condition >during the setup of the pipeline by the csh. I suspect that less works >because it has a larger executable file and thus takes slightly longer for >SunOS to load. > >I dont know. I experience this problem somewhat different on a Sun Sparc >490 with os 4.0.3. I always use tcsh 5.12, btw. I think in nearly half >the cases I pipe something into less, less hangs indefinitely and I have to >suspend it with a ^Z and then fg. Nothing whatsoever gets written to my tty >What is going on? > >--Harald E Same thing on my SPARCstation 1 & Sun 3/80, it has been going for some time now. I thought it was our "Cable Guys" causing problems on my LAN, because they've been doing some installing. A closer look into it reveals that I experience the same pipeline trouble as others. Sometimes the i/o gets going in a while (in a few seconds) but it happens I have to use ^Z + fg, too. On the Sparcstation I run: SunOS Release 4.0.3c, on Sun 3/80: SunOS Release 4.0.3_EXPORT Any cure for this available? -- Esa Viitala TOLLPOST-GLOBE A/S, Systemavdeling, PO Box 100, N6301 ]ndalsnes, Norway Tel: (+47 72) 21211 / 264, Fax: (+47 72) 22161 ...!mcsun!nuug!tglobe2!esa
morten@cs.qmw.ac.uk (Morten Ronseth) (10/04/90)
>Same thing on my SPARCstation 1 & Sun 3/80, it has been going for some >time now. I thought it was our "Cable Guys" causing problems on my LAN, >because they've been doing some installing. A closer look into it >reveals that I experience the same pipeline trouble as others. > >Sometimes the i/o gets going in a while (in a few seconds) but it happens >I have to use ^Z + fg, too. > > On the Sparcstation I run: SunOS Release 4.0.3c, > on Sun 3/80: SunOS Release 4.0.3_EXPORT > >Any cure for this available? > >-- >Esa Viitala >TOLLPOST-GLOBE A/S, Systemavdeling, PO Box 100, N6301 ]ndalsnes, Norway >Tel: (+47 72) 21211 / 264, Fax: (+47 72) 22161 ...!mcsun!nuug!tglobe2!esa WHAT!!! Are you for real??!?!?! You mean that TOLLPOST-GLOBE have SPARCStations??!?!?! Geeeez...I guess next I'll hear that Steen & Strom have a Cray XMP down in the basement, doing vector oriented accounting... Morten. -- ==================================================================== Morten Lerskau Ronseth UUCP: morten@qmw-cs.uucp Dept. of Computer Science JANET: morten@uk.ac.qmw.cs Queen Mary and Westfield College ARPA: morten%qmw.cs@ucl-cs.arpa Mile End Road Easylink: 19019285 London E1 4NS Tlf: 071 975 5220/31/47 England. Dept. fax: 081 980 6533
jbw@bucsf.bu.edu (Joe Wells) (10/07/90)
lindner@cs.umn.edu (Paul Lindner) writes: gorpong@ping.uucp (Gordon C. Galligher) writes: >> alias ls 'ls -FC \!* |more' >> >>This works fine, however sometimes it stops both tasks and puts them in >>the background, (this is on various Suns using csh and tcsh). Typing >>fg restarts the listing. This is really irritating, typing fg and all. >More(1) is the problem here. I have not quite figured it out, but I had a >similar problem when my users would type: history | more and it would do >[.........] More(1) isn't the problem here, I tried using less for a while but I still got the infamous: Stopped (tty output) [1] 21298 21299 So, it must be someplace in the shell. I finally remembered the problem: Sun's (and other vendor's) csh is based on an early BSD csh that depended on the original semantics of vfork. However, Sun made vfork behave the same as fork, hence it is no longer certain that the first child the csh forks in a pipeline executes setpgrp before the csh changes the pgrp of the tty device. I can't remember if Sun ever fixed this one, but it's been around for several years. -- Joe Wells <jbw@bu.edu>