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


Groups > gnu.bash.bug > #16223

Proposed new feature for bash: unbuffered pipes, part 2: demo implementation

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From worley@alum.mit.edu (Dale R. Worley)
Newsgroups gnu.bash.bug
Subject Proposed new feature for bash: unbuffered pipes, part 2: demo implementation
Date Tue, 21 Apr 2020 20:39:35 -0400
Lines 59
Approved bug-bash@gnu.org
Message-ID <mailman.919.1587515998.3066.bug-bash@gnu.org> (permalink)
References <87imhswdyw.fsf@hobgoblin.ariadne.com>
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1587515999 13195 209.51.188.17 (22 Apr 2020 00:39:59 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=1587515976; bh=mz64tiTTxxSiYmu62v7x6XGPTfUWYF0Q2HsFvcMGVP0=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=AEBHLraWwdUTfE7cKHunJAO6QHhnLzFB/Us177bEFDPbbZUOlrXH5NVXtVnS0rgUW MjcQm8+ymWaTpgPTcHNkKCQzWPzG3rXEMxDY2hR8lIe7upF0ryuz4L7fvQHGYzbq3N 0h7hVVWJRwAo6OOUz5HzCi8onLaZDj/EPyFLfz3WIop+lU26QCtFHkZIZUPLDot1RQ 4Aqoo3zUeh+UXZMa13QLzx1PPvhj0LaJtXDQT+q0SKwEmo4jCsoCJM812Sz9eHa0dV qAoRDxdN2m19dZhmH8dYtwPr0vrtyVTsZdya7v4w3prjovBo6PPdpUAXf0GsBLq1ce BKnXJmXXw28/A==
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:43; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-11v.sys.comcast.net
X-detected-operating-system by eggs.gnu.org: First seen = 2020/04/21 20:39:37
X-ACL-Warn Detected OS = ???
X-Received-From 2001:558:fe21:29:69:252:207:43
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 <87imhswdyw.fsf@hobgoblin.ariadne.com>
Xref csiph.com gnu.bash.bug:16223

Show key headers only | View raw


The baseline behavior is that this command, after 10 seconds, outputs
10 lines of output:

$ bash -c 'for I in $( seq 10 ) ; do echo ABCDE ; sleep 1 ; done | grep A | cat'

To build and run a demo of the "unbuffered pipes" feature:

Create and cd to a scratch directory.

Build a modified Bash:

$ wget http://ftp.wayne.edu/gnu/bash/bash-5.0.tar.gz
$ tar -xf bash-5.0.tar.gz
$ pushd bash-5.0
$ patch -p1 <bash.diff    # from the message in this series
$ ./configure
$ make
$ export BASH=$( pwd )/bash
$ ls -l $BASH
$ popd

Build a modified glibc:

$ git clone git://sourceware.org/git/glibc.git
$ pushd glibc
$ git checkout release/2.31/master
$ patch -p1 <glibc.diff    # from the message in this series
$ popd
$ mkdir install
$ mkdir glibc-build
$ pushd glibc-build
$ ../glibc/configure --prefix=$( pwd )/../install
$ make
$ export LIBC=$( pwd )/libc.a
$ ls -l $LIBC
$ popd

Statically link a grep that uses this glibc:

$ wget https://gnu.askapache.com/grep/grep-3.4.tar.xz
$ tar -xf grep-3.4.tar.xz
$ pushd grep-3.4
$ ./configure
$ make
$ # On Fedora 32, this is the command that "make" above used to create
$ # the executable "grep", modified to statically link it with $LIBC.
$ # I had to install the "pcre-static" and "glibc-static" packages to make
$ # it work.
$ pushd src
$ gcc -static -g -O2 -o grep dfasearch.o grep.o kwsearch.o kwset.o searchutils.o pcresearch.o ../lib/libgreputils.a ../lib/libgreputils.a -lpcre -lpthread $LIBC
$ export GREP=$( pwd )/grep
$ ls -l $GREP
$ file $GREP

The desired behavior is that this command outputs one line of output
each second for 10 seconds:

$ $BASH -c 'for I in $( seq 10 ) ; do echo ABCDE ; sleep 1 ; done | $GREP A >|> cat'

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


Thread

Proposed new feature for bash:  unbuffered pipes, part 2: demo implementation worley@alum.mit.edu (Dale R. Worley) - 2020-04-21 20:39 -0400

csiph-web