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


Groups > gnu.bash.bug > #15020

Re: FIFO race condition on SunOS kernels

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 Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: FIFO race condition on SunOS kernels
Date Mon, 31 Dec 2018 14:05:06 -0500
Organization ITS, Case Western Reserve University
Lines 45
Approved bug-bash@gnu.org
Message-ID <mailman.6636.1546283127.1284.bug-bash@gnu.org> (permalink)
References <eda3efb7-98d4-6a2d-a9d1-cb82f43a5f02@inlv.org>
Reply-To chet.ramey@case.edu
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1546283127 4984 208.118.235.17 (31 Dec 2018 19:05:27 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu
To Martijn Dekker <martijn@inlv.org>, Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from:openpgp :autocrypt:organization:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=aXiGNzf1TknrGply7v5dGNmjXJR+xB+0pQtz6YIIEuc=; b=UEiivaY/1z9avTgKrwcpO17NxPmcR0IhqTE0XOnBP8tftLaDnv7++dXbutMx0wpM1t GILN+uFzBvWXY3ANL43iFQEduiIMJ8bzJGAVJjUW4JHHpJfFXUbUf0+v+U61JJ+oYbYs AmF51hpGAcwt1e4TM1T1m3YLyPLjUeSi4nUKZyyY20jycq2RA6IX+Lee1bsfeKkPC4kj CYSoZmA83LBYIFA87bzXIm0dlIHW1I+1r1zcOUGnXezCjrD1uXEELkx1V5bFX2HoG7OF Nx0fAJ+NaHhwEQLRkoj3cu0hMitZB5uT2oqX7ZOUDot+k4vTJDzySdJlX0AMwa1fIy4l RpEw==
X-Gm-Message-State AJcUukd31qKWosOJbEl+BKXXTWhoXAQviKccq59YVb54hIkdyTwuZ04j kClKMjh5o2oqAS5t3yddJgkH10t6CdE7nEOK4nFuBD5ot93KxNRxAGd131DikmXHBNWUR5iMRdZ qWGX8PnD08VE=
X-Received by 2002:a25:ba01:: with SMTP id t1mr5020818ybg.296.1546283108923; Mon, 31 Dec 2018 11:05:08 -0800 (PST)
X-Google-Smtp-Source ALg8bN6tFqgsuJuYOKMjWXzBsPAmsQD4Gf1ISpd1cIA8AZb5lbtBHnRpa4YjuNmZdFAGyyBUOG05eA==
X-Received by 2002:a25:ba01:: with SMTP id t1mr5020793ybg.296.1546283108641; Mon, 31 Dec 2018 11:05:08 -0800 (PST)
Openpgp preference=signencrypt
Autocrypt addr=chet.ramey@case.edu; prefer-encrypt=mutual; keydata= mQGiBEEOsGwRBACFa0A1oa71HSZLWxAx0svXzhOZNQZOzqHmSuGOG92jIpQpr8DpvgRh40Yp AwdcXb8QG1J5yGAKeevNE1zCFaA725vGSdHUyypHouV0xoWwukYO6qlyyX+2BZU+okBUqoWQ koWxiYaCSfzB2Ln7pmdys1fJhcgBKf3VjWCjd2XJTwCgoFJOwyBFJdugjfwjSoRSwDOIMf0D /iQKqlWhIO1LGpMrGX0il0/x4zj0NAcSwAk7LaPZbN4UPjn5pqGEHBlf1+xDDQCkAoZ/VqES GZragl4VqJfxBr29Ag0UDvNbUbXoxQsARdero1M8GiAIRc50hj7HXFoERwenbNDJL86GPLAQ OTGOCa4W2o29nFfFjQrsrrYHzVtyA/9oyKvTeEMJ7NA3VJdWcmn7gOu0FxEmSNhSoV1T4vP2 1Wf7f5niCCRKQLNyUy0wEApQi4tSysdz+AbgAc0b/bHYVzIf2uO2lIEZQNNt+3g2bmXgloWm W5fsm/di50Gm1l1Na63d3RZ00SeFQos6WEwLUHEB0yp6KXluXLLIZitEJLQwQ2hldCBSYW1l eSAoQ2FzZSBzdGFuZGFyZCkgPGNoZXQucmFtZXlAY2FzZS5lZHU+iF8EExECAB8FAkPi19EC GwMHCwkIBwMCAQMVAgMDFgIBAh4BAheAAAoJELtYafBk6nSrelkAn31Gsuib7GcCZHbv5L5t VKYR9LklAJ4hzUHKA49Z0QXR+qCb80osIcmPSbkBDQRBDrBvEAQAkK6TAOKBEM+EC4j6V/7o /riVZqcgU5cid2qG9TXdwNtD9a3kvA/ObZBO93sX59wc6Bnwo4VJxsOmMlpGrAjJsxNwg3QH akEtf8LXRbVpj5xStdmBdQZUhIQyalo/2/TZq5OijtddUQcL5cs70hTv/FpT3wUvr2Xr8rjF 41IFEz8AAwcD/A0CZEGlzIrT5WCBnl6xBog/8vKiUCbarByat3d1mL6DbizvKNXQRTC9E/vE dENAWCQCjr75Bu55xT8n3SXGtWdDC5xmZ/P3OBYORP8yl8H8I1FIosWOFirbIeYdZPq8SPD1 HL+EXo9zSiHVrrZRJ19ooCKKbSdXHFCY+aJG+0KZiEkEGBECAAkFAkEOsG8CGwwACgkQu1hp 8GTqdKvjcACfZlkVCDwaz/NTO9cy3t69oWpVPNwAnRwe0qk/WL/gfhH346xh5B3HFbFN
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3
In-Reply-To <eda3efb7-98d4-6a2d-a9d1-cb82f43a5f02@inlv.org>
Content-Language en-US
X-Junkmail-Status score=7/90, host=mpv2-2015.case.edu
X-Junkmail-PrAS-Raw score=7/90, refid=2.7.2:2018.12.31.180616:17:7.944, ip=, rules=__YOUTUBE_RCVD, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH, __URI_NO_WWW, __HIGHBITS, __CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW, BODY_SIZE_1700_1799, BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy]
X-Received-From 129.22.103.227
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:15020

Show key headers only | View raw


On 12/31/18 12:37 PM, Martijn Dekker wrote:
> 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?

Maybe as a patch, when I have some time to investigate it.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

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


Thread

Re: FIFO race condition on SunOS kernels Chet Ramey <chet.ramey@case.edu> - 2018-12-31 14:05 -0500

csiph-web