[comp.sys.apollo] problems piping into 'tail'

jlhaferman@l_cae07.icaen.uiowa.edu (Jeffrey Lawrence Haferman) (07/31/90)

SR 10.2, /bin/csh is my shell, I can't get

   history | tail -15

to work.  'history' works fine, tail <filename> works
fine, I can't get the pipe to work.  Ideas?

(I don't get an error back, just seems to wait a little
 while, and then I get a prompt back.)


Jeff Haferman                            internet: jlhaferman@icaen.uiowa.edu
Department of Mechanical Engineering
University of Iowa
Iowa City IA  52240

jimr@metro (Jim Richardson) (08/01/90)

In article <2011@ns-mx.uiowa.edu>, jlhaferman@l_cae07.icaen.uiowa.edu (Jeffrey
Lawrence Haferman) writes:
> 
> SR 10.2, /bin/csh is my shell, I can't get
> 
>    history | tail -15
> 
> to work.  'history' works fine, tail <filename> works
> fine, I can't get the pipe to work.  Ideas?
> 
> (I don't get an error back, just seems to wait a little
>  while, and then I get a prompt back.)

I haven't observed this problem with history: perhaps it depends on how
many lines the history contains.  However, I have similar problems with
commands like

	tail -300 syslogd.log

where syslogd.log is a logfile for syslogd, and therefore constantly open for
write, if it's important (that's why tail is needed instead of cv).

If I ask tail for only say 250 lines, all is well.  But over about 300, the
command sometimes just sits there until interrupted, and sometimes as Jeffrey
reports it pauses then comes back to the prompt with no output.

There seems to be some bad interaction between tail and the DM going on here.
If after the tail command has failed, you push and pop the pad in which it
was executed, you sometimes see very odd changes: some of the lines that tail
should have produced appear and/or disappear.  In fact, the pad seems to be
in a very unstable and inconsistent state.

Redirection of output via e.g. "tail -300 syslogd.log" > /tmp/slog succeeds
correctly.  Is that also true for Jeffrey's history example?
--
Jim Richardson
Department of Pure Mathematics, University of Sydney, NSW 2006, Australia
Internet: jimr@maths.su.oz.au  ACSNET: jimr@maths.su.oz  FAX: +61 2 692 4534

petersn@physics.utoronto.ca (Mike Peterson) (08/02/90)

In article <2011@ns-mx.uiowa.edu> jlhaferman@l_cae07.icaen.uiowa.edu (Jeffrey Lawrence Haferman) writes:
>
>SR 10.2, /bin/csh is my shell, I can't get
>
>   history | tail -15
>
>to work.  'history' works fine, tail <filename> works
>fine, I can't get the pipe to work.  Ideas?
>
>(I don't get an error back, just seems to wait a little
> while, and then I get a prompt back.)

Pipe commands will fail at SR10.2 / SR10.2.p if the first component of
the pipeline manages to complete before the pipeline is set up (it is
not just history that does this, but it is one of the easiest ones since
it is built-in to csh).

I have called it in and APR'ed it -- it will not be fixed in SR10.2,
but is supposedly fixed in SR10.3.

Mike Peterson,
U/Toronto Chemistry.
system@alchemy.chem.utoronto.ca

rees@pisa.ifs.umich.edu (Jim Rees) (08/03/90)

In article <1990Aug1.022258.7408@metro.ucc.su.OZ.AU>, jimr@metro (Jim
Richardson) writes:
  In article <2011@ns-mx.uiowa.edu>, jlhaferman@l_cae07.icaen.uiowa.edu
(Jeffrey
  Lawrence Haferman) writes:
  > 
  > SR 10.2, /bin/csh is my shell, I can't get
  > 
  >    history | tail -15
  > 
  > to work.  'history' works fine, tail <filename> works
  > fine, I can't get the pipe to work.  Ideas?

This works for me.  It may depend on whether you're in a pad, xterm, or
what. "history" is a builtin and may have redirection strangeness (the
redirection is done in an entirely different way from how it's done for
normal commands).

  I haven't observed this problem with history: perhaps it depends on how
  many lines the history contains.  However, I have similar problems with
  commands like
  
  	tail -300 syslogd.log

"tail" has a limit on how many lines it can store up, although it should
fail gracefully.

The "tail" man page seems to be out of date.  In particular, the '-f' option
works but is undocumented.  This is terribly useful for files like
syslogd.log.  It monitors the file and regularly prints out any extra lines
that came in recently.