Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16229

Re: Proposed new feature for bash: unbuffered pipes

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From worley@alum.mit.edu (Dale R. Worley)
Newsgroups gnu.bash.bug
Subject Re: Proposed new feature for bash: unbuffered pipes
Date Wed, 22 Apr 2020 21:31:35 -0400
Lines 37
Approved bug-bash@gnu.org
Message-ID <mailman.1014.1587605504.3066.bug-bash@gnu.org> (permalink)
References <87mu73ugw8.fsf@hobgoblin.ariadne.com>
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1587605505 3819 209.51.188.17 (23 Apr 2020 01:31:45 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1587605498; bh=0ArwfcgWNI77YOucbp6d3lcCjUbZH4dX3KHB78ChQCg=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=TJ9leg761RBFfd1Pq2P/6sI2dgeo3KFEIz2ICWzHnPdRWg2W7XyyuXL787DY5EjhZ VtTZdwHO8+3S0DNIwcnQsbBuJONjrz+4eTJ7e+HeJ6W48W+1M8kz9FEIjvze57QWGY C/cugjr2MFNphi8THGzxXjMtfBsy4F6KHPKdQqmJfAp+VNjavAR3v9WuJzk2w3BdK4 CmVLrjlM1C9zrfmn/BuPznvnOSNezxCCSITcJ8Xp6oQN6jifpsgu026AyFdaFwm22T QYGYZhIQewjz/eiAiUDfq22Prm1N2AyMmgWXtk1NTZ2julel+3c1LrkdvmzBcDTC+o 4hXkVRfxh9vuw==
X-Xfinity-VMeta sc=0.00;st=legit
X-Authentication-Warning hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f
Received-SPF softfail client-ip=2001:558:fe21:29:69:252:207:42; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-10v.sys.comcast.net
X-detected-operating-system by eggs.gnu.org: First seen = 2020/04/22 21:31:38
X-ACL-Warn Detected OS = ???
X-Received-From 2001:558:fe21:29:69:252:207:42
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <87mu73ugw8.fsf@hobgoblin.ariadne.com>
Xref csiph.com gnu.bash.bug:16229

Show key headers only | View raw


The crux of the problem, IMHO, is to look at it from the right angle:

Occasionally, the user desires that I/O through certain pipes should be
unbuffered, that is, the stdio stream(s) that write into the pipe should
be unbuffered, rather than the default block-buffered.  These are
situations where the user can tell that it is desirable to sacrifice
efficiency to gain low latency, whereas the writer of the program that
the user is running could not predict the needs of this particular
invocation.  (This is where Ulrich Drepper was incorrect; the writer of
the program doesn't know when this is desirable.)

This facility is best activated by a feature in bash, as the need arises
from the relationship between two processes.

The ideal way to implement this would be for the kernel to provide two
flavors of pipe, one designated buffered and one designated unbuffered,
and according to the user's instructions, bash would allocate an
unbuffered pipe when it was needed.  The kernel itself would treat the
two types of pipe in the same way, but stdio would create buffered
streams for fd's that were opened on buffered pipes and it would create
unbuffered streams for fd's that were opened on unbuffered pipes.

However, getting a coordinated change into the kernel seems like it
would be quite difficult.

So an alternative implementation is to have a way for bash to notify
processes it creates that certain pipes (identified by their dev/ino
numbers) should have streams that are unbuffered.  Pretty much the only
way to do this is to have a conventional environment variable for
communicating this information.

Of course, either of these solutions requires changes to glibc, but
then, if you're going to modify buffering behavior of streams, you are
going to have to modify glibc.

Dale

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Proposed new feature for bash:  unbuffered pipes worley@alum.mit.edu (Dale R. Worley) - 2020-04-22 21:31 -0400

csiph-web