bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Process Substitution Errors (Will Help With Coding)


From: Jon Clark
Subject: Process Substitution Errors (Will Help With Coding)
Date: Fri, 10 Sep 2010 09:39:01 -0400

From: jhclark
To: address@hidden,address@hidden
Subject: [50 character or so descriptive subject here (for reference)]

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OS\
TYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc\
' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG\
_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux barrow 2.6.32-24-server #39-Ubuntu SMP Wed Jul 28 06\
:21:40 UTC 2010 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.1
Patch Level: 5
Release Status: release

Description:
        Error codes from process substitution subshells go undetected,
even with current most-paranoid flags set. I propose "set -o
procsubfail" to fix this, though I'm unsure what changes to the
codebase this will entail. I'm willing to hack some code if you agree
and can point me in the right direction.

Repeat-By:

#!/usr/bin/env bash
set -e
set -o pipefail
cat <(echo hi; exit 1)
echo 'There should be a way of making this not print'

Fix (Workaround):

#!/usr/bin/env bash
set -e
set -o pipefail
cat <( (echo hi; exit 1) || kill $$)
echo 'This probably doesn't print now, but this is messy'

Fix (Preferred):

#!/usr/bin/env bash
set -e
set -o pipefail
set -o procsubfail

cat <(echo hi; exit 1)
echo 'This doesn't print now and code isn't messy'


Thanks for the wonderful shell,
Jon

address@hidden
http://www.cs.cmu.edu/~jhclark
PhD Student
School of Computer Science
Carnegie-Mellon University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]