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


Groups > gnu.bash.bug > #16236

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 Daniel Colascione <dancol@dancol.org>
Newsgroups gnu.bash.bug
Subject Re: Proposed new feature for bash: unbuffered pipes
Date Thu, 23 Apr 2020 17:26:56 -0700
Lines 46
Approved bug-bash@gnu.org
Message-ID <mailman.1063.1587688023.3066.bug-bash@gnu.org> (permalink)
References <87mu73ugw8.fsf@hobgoblin.ariadne.com> <E1jRmBF-00035H-FD@dancol.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="us-ascii"
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1587688024 29311 209.51.188.17 (24 Apr 2020 00:27:04 GMT)
X-Complaints-To action@cs.stanford.edu
To <worley@alum.mit.edu>, <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:References:In-Reply-To:Date:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sXHxzLTGCaZSJzSZJdn6YZ3xyorWTLn9iXDN+ai+D80=; b=ihFfFTLL7Yw98RbFo18+BiQkM5 mzaJxffzGG7i/Pky5jjEIsDqL8btwz0CTUlWQkb3OUsastqaxRYBtzxhMKmxxUA5+ZjDVr+acbScm Z0JoWGX0Sw9vtWaFnm3H/Rm1aiGfd5rUsUL4jYLeIvDCLMJZUcKxUzfjOaitYDr/DqIvoGOrNEpwH JoQoiCpEyQsq9EJhqCZh0EhlxErQkhst8/A2GXqVlJArv1ag4+I4LXt+QEaqLJ+bDxu3yBWUoNV2+ rxIET+XupE6Tct8X1Svi/+qCstOJ2p3sw8wvDzPkqjNRbwxKCEzoAeLOExAAKbV2ThInx8AmMJL4a 6RmtN5Wg==;
In-Reply-To <87mu73ugw8.fsf@hobgoblin.ariadne.com>
User-Agent AquaMail/1.24.0-1572 (build: 102400003)
Received-SPF pass client-ip=2600:3c01::f03c:91ff:fedf:adf3; envelope-from=dancol@dancol.org; helo=dancol.org
X-detected-operating-system by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67
X-Received-From 2600:3c01::f03c:91ff:fedf:adf3
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 <E1jRmBF-00035H-FD@dancol.org>
X-Mailman-Original-References <87mu73ugw8.fsf@hobgoblin.ariadne.com>
Xref csiph.com gnu.bash.bug:16236

Show key headers only | View raw


On April 22, 2020 6:32:07 PM worley@alum.mit.edu (Dale R. Worley) wrote:

> 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.

Given the current political realities in the relevant FOSS ecosystem, it 
might be easier to add a new pipe flavor or attribute to the kernel and 
then get libc implementations to support it as a fait accompli than to do 
something purely in libc. Also, an environment variable is semantically 
wrong: its scope is too  broad, well beyond the specific pipe you care 
about. Imagine the variable leaking into a daemon that lives forever.


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


Thread

Re: Proposed new feature for bash:  unbuffered pipes Daniel Colascione <dancol@dancol.org> - 2020-04-23 17:26 -0700

csiph-web