Using less in environment without controlling tty

Harald Becker ralda at gmx.de
Tue Jul 30 03:43:23 UTC 2013


Hi Denys !

>select/poll should still use nonblocking fds, it does not
>guarantee that read will succeed.

Please don't talk about using blocking/nonblocking or
select/poll, this goes in the wrong direction.

My only complain is, Busy uses /dev/tty without possibility to
reassign or redirect this to a different tty, and that is, what I
need: The possibility to specify a message output tty which is
not the controlling tty.

>Try the command. You will see that line2 appears by itself

No, I don't try. I just assume you are right at this.

>I don't think that not having a tty is a normal use case.

It is a very well behaved use case in many process controlling
applications. A master process on a controlling tty displays
other information on different locations without those locations
becoming "controlling" in any matter. They are controlled by the
master. Which receives any interrupting signals if required.

>> >Need to weight the possibility of less messing up stdout
>> >against the possibility that ctty is not available.

Deny, I need the possibility to send less output to a different
tty, like it is possible with standard less. I doesn't matter the
way it is done or if there are differences in invocation, but
shall be a simple usage.

My approach is to use stdout as I don't see messing things up,
as long as less does restore everything before exit. But if you
think we need a different way, stay with /dev/tty as default but
give the possibility to overwrite output tty. For the stdout
version I'm able to create a patch, but I won't fiddle with
this crazy Busybox getopt.
 

>> >Since w/o ctty, there will be other problems as well
>> >(environment where ^C doesn't work isn't fun to work in),
>> >it is not clear that it is worthwhile to support that case.

You shall not work with that environment, you shall just use,
what you get, simple scrolling message output. Up, Down, may be
search for something, and exit. Nothing else on that tty. Neither
Ctrl-C nor Ctrl-Z, nor any other signal.

>> >Why can't you acquire a ctty?

ctty still stays on different tty and this one shall stay
controlling. other tty shall not send signals.

>I just tried this:
>
>setsid sh -c 'exec </dev/tty12 >/dev/tty12 2>&1; exec less FILE'
>
>and it worked (both setsid and less are bbox applets here).

May be it worked for you, but here you setsid before exec of the
shell. The shell is execed directly after fork. This would mean
limiting possibilities of console_buffer. ... and anything else
is just to much workaround for a simple request, the possibility
to specify the output terminal, not using fixed /dev/tty, not
output on ctty.

In addition the new session directs signal to the viewer
process , that is less not the controlling master process. As
required.

Argh ... and now I see it: "less FILE" ... you are going to
display a file ... I'm piping data from my calling program (and
there is no location to save this data).

--
Harald


More information about the busybox mailing list