[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposed new feature for bash: unbuffered pipes, part 2: demo implement
From: |
Dale R. Worley |
Subject: |
Proposed new feature for bash: unbuffered pipes, part 2: demo implementation |
Date: |
Tue, 21 Apr 2020 20:39:35 -0400 |
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'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Proposed new feature for bash: unbuffered pipes, part 2: demo implementation,
Dale R. Worley <=