Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: =?UTF-8?B?T8SfdXo=?= Newsgroups: gnu.bash.bug Subject: Re: Undocumented feature: Unnamed fifo '<(:)' Date: Sun, 28 Jun 2020 19:31:53 +0300 Lines: 68 Approved: bug-bash@gnu.org Message-ID: References: <20200628134945.GB24863@medium.hauri> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1593361919 27267 209.51.188.17 (28 Jun 2020 16:31:59 GMT) X-Complaints-To: action@cs.stanford.edu Cc: "bug-bash@gnu.org" To: felix Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yquSsPF8rdz8BxAL8cmBRW7A/2Qz0DDk0vnb4Ylfm+E=; b=LYFoVLLcHQA3nFaU5cvRk9u4T+kGCDdGEPtv9szWfOXvjbKB/QxM5eDZYTD0CA84Aj MmaUhDh06HIbsFyaVG5adT88QSBkKSlqkuwVC+ysgupekpi43oL3pjK5WkSJQ9ZhdnXe YdQ2faw4jbW95HjzjziXGxTdEK1IhsToDC8Ug0AKUBqBNHXi4umoE4MmrBzz5TURXjGY kkm3Dha/goDuUT/oWwYPNBRI0XI5BAih09CYdoJ9vRYhISuy25Zzm5i9TA21wLYqscMF aULXMoEscOcd/VOwQyQQuz8oTOVUURGNhfaCs2ccSDtfR0Hy+eUbB6GjIYDuByKB7BPh XLdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yquSsPF8rdz8BxAL8cmBRW7A/2Qz0DDk0vnb4Ylfm+E=; b=HNAiYe35uNuL0Br/TYYX2jMbAezP4XaFKERhoZhMBIoJmXlLdaYXqGvx40giXTUriG 9p/6vB3B/wXKf6+3yEWOXtHfRwsyTIgG9av5xuCMivX/909eT8+3+72SJy7UADjLWi1H FcUGI37wcB3//Gjr1duYO+3CJdT/PTSRMABrKLs/QUADBXJjpt36aQvuovWj3lIa4bq8 5nhARNfslcV0tQyk9s7+06BSMoHmtdOxLh87eW/wUBTapkqwRo1bAXK7ezr0fgZ6/Asa gjf4JnSMKXpugFy/J9QdOocEb34mvp8Z6y/pSpVBCJBlWhGFUE7ekTC6R3ALwPdbXSeV 2B7A== X-Gm-Message-State: AOAM531QSmuMnXv4SpoRZyDDTFq6gBE2Bywskq+oGBg78kcG7SfgNMx0 buMqn9X/k5eJ9GzI4yQVYM9vfzgSutz0kxuOu3TcXgt1 X-Google-Smtp-Source: ABdhPJyophI92XbADot3KASYW1iHojQQUFyHmRIC6VY+LFBHoSYqzGOTi1mdLfdl6mabxGrJ1aimAYbsy6kSjshvf9w= X-Received: by 2002:ae9:ea13:: with SMTP id f19mr5911383qkg.331.1593361913675; Sun, 28 Jun 2020 09:31:53 -0700 (PDT) In-Reply-To: <20200628134945.GB24863@medium.hauri> Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=oguzismailuysal@gmail.com; helo=mail-qk1-x734.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <20200628134945.GB24863@medium.hauri> Xref: csiph.com gnu.bash.bug:16469 28 Haziran 2020 Pazar tarihinde felix yazd=C4=B1: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -g -O2 -fdebug-prefix-map=3D/build/bash-2bxm7h/bash-5= .0=3D. > -fstack-protector-strong -Wformat -Werror=3Dformat-security -Wall > -Wno-parentheses -Wno-format-security > uname output: Linux medium 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 > (2020-04-29) x86_64 GNU/Linux > Machine Type: x86_64-pc-linux-gnu > > Bash Versions: 3.2.57(1)-release, 5.0.3(1)-release, 5.1.0(1)-alpha > > In order to reduce forks and make some tasks a lot quicker, I run > forked filters as background tasks, with dedicated I/O fd. > > For sample, to convert human datetime to UNIX SECONDS, instead of running > _out=3D$(date -d "$_string" +%s) > many time in same script, I run something like: > > _fifo=3D$(mktemp -u /tmp/fifo-XXXXXXXX) > mkfifo $_fifo > exec 9> >(exec stdbuf -o0 date -f - +%s >$_fifo 2>&1) > exec 8<$_fifo > rm $_fifo > > Then to convert human datetime to UNIX SECONDS: > > echo >&9 $_string > read -t 1 -u 8 _out > > become a lot quicker! > > But I recently discovered another way for this: > > exec 8<> <(:) > exec 9> >(exec stdbuf -o0 date -f - +%s >&8 2>&8) > > usable in same way: > > echo >&9 $_string > read -t 1 -u 8 _out > > maybe a little more quicker... Seems like a bug to me. The FIFO created for <(:) shouldn't be writable. > > This was tested using https://f-hauri.ch/vrac/date1fork-demo.sh under > latest version of bash: 5.1.0(1), debian stable version: 5.0.3(1) and > old 3.2: 3.2.57(1). > > There is maybe something to document or even create a new feature > about open2 and open3... > > (I will have to rewrite https://f-hauri.ch/vrac/shell_connector.sh.txt ;) > > -- > F=C3=A9lix Hauri - - http://www.f-hauri.ch > > --=20 O=C4=9Fuz