Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: =?UTF-8?B?T8SfdXo=?= Newsgroups: gnu.bash.bug Subject: Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'command' Date: Mon, 20 Jul 2020 08:10:06 +0300 Lines: 72 Approved: bug-bash@gnu.org Message-ID: References: <20200719204836.GA1184@mutt> 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 1595221811 9173 209.51.188.17 (20 Jul 2020 05:10:11 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: rustybird@net-c.com 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=DjZGHRgz/iz/5lVqLWZ7ZwqkvfAr++SoBui2T7HgoDY=; b=c7AdnzC53Cf7ehvu0HA71TJ4AUMuCZqXu2lmYkKww6DCbAIvpF5oLDrgVQRfWafvqG rWFrQvQXGvNT9BPtgAYQfZUMPXXSGMORAqhTu9xw5qwDuZ4Djuhl2AV0WjFISac+taJR SLgGEphCtHlVjxGwcgcsc5k8hEUiC4qk75wXiusZwPukgx5k2RaxdurbBRP1VCheVrep sCIRP0V+goo/Q/MhsfHPf/utLvpvMXopZRzofnyxuGxGnofWFPEw8iXVs5FtYrcFWaj7 yrYAS5x6x+fDEa6HamhL2Bs2uhxOWPJEYLIeXF1Hl6QmCopNApUd3I6DM+9hhS21lErD wnVQ== 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=DjZGHRgz/iz/5lVqLWZ7ZwqkvfAr++SoBui2T7HgoDY=; b=PDydiLk/FL/PpsFAhi1Hc9qkVXPnLbxxp7MNwEU+zEAUHXgeX5syaP6YyNvq0M3zcK QZeBumC3ETVr3rE/mWJjbgXCOQ2dyNXIPGgWfHYLr0OSR6UhKc7jsOCNy7H58Ol4XtNC jFnNkpDFkHyXBMYC0IPuHRkLkvbw01kKXWJ+c9Ooe8RDnRsbB3OT7fBs+cpRogLLne/J j3DXsfQQfxsg5dN18STB0EMTEUhK4qZEsakeg87Y+bnFflFWyaLRRriYyjzFG8+iDLyj bHd5gvrL7bIvO4qMX5VBELvA1jikemTjSaVjLRbexcLQhFwq4oO+BA7ILWPDfmHeA9a1 TQyQ== X-Gm-Message-State: AOAM533aR99BbHMCb+HD3TMf7ZyIQuSYbPttoS69dbM9Yu8MCaa1UH66 DiWpaIceWtIfiQx8mZz2H1H0eYgtoBLS2xndR/cCzkGs X-Google-Smtp-Source: ABdhPJzLUuJ0zZx2fHlcf0plbQmba7xtvVehL8rzCw6OjOJek/6tocD+p2pPVwkrvEiS9Sw2+xpKB2OuUIhm4snhwDE= X-Received: by 2002:aed:3f09:: with SMTP id p9mr22348988qtf.259.1595221806738; Sun, 19 Jul 2020 22:10:06 -0700 (PDT) In-Reply-To: <20200719204836.GA1184@mutt> Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=oguzismailuysal@gmail.com; helo=mail-qt1-x82f.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 autolearn=ham autolearn_force=no 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: <20200719204836.GA1184@mutt> Xref: csiph.com gnu.bash.bug:16584 19 Temmuz 2020 Pazar tarihinde Rusty Bird yazd=C4=B1: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=3Dformat-security > -Wp,-D_FORTIFY_SOURCE=3D2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions > -fstack-protector-strong -grecord-gcc-switches -specs=3D/usr/lib/rpm/redh= at/redhat-hardened-cc1 > -specs=3D/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=3Dgeneric > -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection > -Wno-parentheses -Wno-format-security > uname output: Linux [...] 4.19.132-1.pvops.qubes.x86_64 #1 SMP Tue Jul 14 > 03:42:21 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux > Machine Type: x86_64-redhat-linux-gnu > > Bash Version: 5.0 > Patch Level: 17 > Release Status: release > > Description: > $! isn't set to the PID of 'bar' for > > foo > >(bar) > > if 'foo' is an external program (as opposed to a builtin or > function) - unless it's invoked via 'command'. > > Repeat-By: > type date # "date is /usr/bin/date" > set -u > echo $! # "bash: $!: unbound variable" > > date > >(sleep 20) > echo $! # "bash: $!: unbound variable" > > command date > >(sleep 21) > echo $! # "123" > > date_wrapper() { date; } > date_wrapper > >(sleep 22) > echo $! # "234" > > > For context - I'm filtering a program's stdout and stderr > (separately), requiring successful exit statuses for the program and > both filters: > > set -u -o pipefail > { program 2> >(stderr_filter >&2) && wait $!; } | stdout_filter &= & > ... > Not sure if process substitution is really necessary here, set -u -o pipefail { program 2>&3 | stdout_filter; } 3>&1 | stderr_filter && ... does the same thing. > This only works if 'program' is changed to 'command program'. > > Rusty > --=20 O=C4=9Fuz