From e045eabad63e40684fcb335247ed6cfe0ec5493a Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 4 Jan 2015 14:18:06 -0800 Subject: [PATCH] Add tests to verify pipes do not conflict with fd redirections --- tests/test1.in | 16 ++++++++++++++++ tests/test1.out | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/test1.in b/tests/test1.in index 424b931a6..6f25e8ae6 100644 --- a/tests/test1.in +++ b/tests/test1.in @@ -123,6 +123,22 @@ echo -e Catch your breath echo -e 'abc\x21def' echo -e 'abc\x211def' +# Verify that pipes don’t conflict with fd redirections +# This code is very similar to eval. We go over a bunch of fads +# to make it likely that we will nominally conflict with a pipe +# fish is supposed to detect this case and dup the pipe to something else +echo "/bin/echo pipe 3 <&3 3<&-" | source 3<&0 +echo "/bin/echo pipe 4 <&4 4<&-" | source 4<&0 +echo "/bin/echo pipe 5 <&5 5<&-" | source 5<&0 +echo "/bin/echo pipe 6 <&6 6<&-" | source 6<&0 +echo "/bin/echo pipe 7 <&7 7<&-" | source 7<&0 +echo "/bin/echo pipe 8 <&8 8<&-" | source 8<&0 +echo "/bin/echo pipe 9 <&9 9<&-" | source 9<&0 +echo "/bin/echo pipe 10 <&10 10<&-" | source 10<&0 +echo "/bin/echo pipe 11 <&11 11<&-" | source 11<&0 +echo "/bin/echo pipe 12 <&12 12<&-" | source 12<&0 + + # Make sure while loops don't run forever with no-exec (#1543) echo "Checking for infinite loops in no-execute" echo "while true; end" | ../fish --no-execute diff --git a/tests/test1.out b/tests/test1.out index e79d75bc9..5f002f2a1 100644 --- a/tests/test1.out +++ b/tests/test1.out @@ -37,5 +37,15 @@ abc Catch your breath abc!def abc!1def +pipe 3 +pipe 4 +pipe 5 +pipe 6 +pipe 7 +pipe 8 +pipe 9 +pipe 10 +pipe 11 +pipe 12 Checking for infinite loops in no-execute 1