Surprising behavior of stderr redirections #877

Closed
ridiculousfish opened this Issue Jun 16, 2013 · 2 comments

Comments

Projects
None yet
1 participant
@ridiculousfish
Member

ridiculousfish commented Jun 16, 2013

echo -n ^/tmp/temp.txt | test bad input

This sends the stderr of test to /tmp/temp.txt. The stderr redirection should have only applied to echo.

This reproduces on fish 1.x as well.

@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Aug 19, 2013

Member

I'm hopeful this can be fixed along with #110

Member

ridiculousfish commented Aug 19, 2013

I'm hopeful this can be fixed along with #110

ridiculousfish added a commit that referenced this issue Aug 20, 2013

Big fat refactoring of how redirections work. In fish 1.x and 2.0.0, …
…the redirections for a process were flattened into a big list associated with the job, so there was no way to tell which redirections applied to each process. Each process therefore got all the redirections associated with the job. See #877 for how this could manifest.

With this change, jobs only track their block-level redirections. Process level redirections are correctly associated with the process, and at exec time we stitch them together (block, pipe, and process redirects).

This fixes the weird issues where redirects bleed across pipelines (like #877), and also allows us to play with the order in which redirections are applied, since the final list is constructed right before it's needed.  This lets us put pipes after block level redirections but before process level redirections, so that a 2>&1-type redirection gets picked up after the pipe, i.e. it should fix #110

This is a significant change. The tests all pass. Cross your fingers.
@ridiculousfish

This comment has been minimized.

Show comment
Hide comment
@ridiculousfish

ridiculousfish Aug 20, 2013

Member

Ought to be fixed by 4899086

Member

ridiculousfish commented Aug 20, 2013

Ought to be fixed by 4899086

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment