Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15019
| Path | csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Martijn Dekker <martijn@inlv.org> |
| Newsgroups | gnu.bash.bug |
| Subject | FIFO race condition on SunOS kernels |
| Date | Mon, 31 Dec 2018 18:37:42 +0100 |
| Lines | 38 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.6629.1546277883.1284.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1546277883 2383 208.118.235.17 (31 Dec 2018 17:38:03 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org> |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
| Content-Language | en-GB |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 3.x [fuzzy] |
| X-Received-From | 37.59.109.123 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| 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 | <http://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> |
| Xref | csiph.com gnu.bash.bug:15019 |
Show key headers only | View raw
You'd think that establishing a pipe between two processes is a very
basic UNIX feature that should work reliably on all UNIX variants.
But the following script seems to break consistently on Solaris and
variants (SunOS kernels) when executed by bash, ksh93, or dash. All it
does is make 100 FIFOs and read a line from each -- it should be trivial.
And it does work fine on (recent versions of) Linux, macOS, and all the
BSDs, on all shells.
#! /bin/sh
tmpdir=/tmp/FIFOs$$
trap "exec rm -rf $tmpdir" EXIT INT PIPE TERM
mkdir "$tmpdir" || exit
i=0; while test "$((i+=1))" -le 100; do
fifo=$tmpdir/FIFO$i
mkfifo "$fifo" || exit
echo "this is FIFO $i" >"$fifo" &
read foo <"$fifo" && echo "$foo"
done
Tested on Solaris 10.1, 11.3 and 11.4 and on OpenIndiana, all on
VirtualBox. They all fail in identical ways.
ksh93 (which is /bin/sh on Solaris) doesn't cope with the script either
but hangs slightly later. dash goes through all of them bust most fail
with 'interrupted system call'. However, zsh, yash, and /usr/xpg4/bin/sh
(ksh88) execute the script correctly on Solaris -- but about 20 times as
slowly as on other OSs.
This makes me suspect the SunOS kernel must have some very bad race
condition involving FIFOs, but some shells work around it.
Would it be possible to fix this on bash 5?
- M.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
FIFO race condition on SunOS kernels Martijn Dekker <martijn@inlv.org> - 2018-12-31 18:37 +0100
csiph-web