[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ast-developers
Subject:    Re: [ast-developers] Standard error redirection blocks script
From:       David Korn <dgk () research ! att ! com>
Date:       2011-06-06 15:22:08
Message-ID: 201106061522.p56FM8Rl018527 () penguin ! research ! att ! com
[Download RAW message or body]

cc: jro@suse.de
Subject: Re: [ast-developers] Standard error redirection blocks script
--------

I will have to investigate this.  Here is what I remember.

With the Bourne shell, command substitution completed when the pipe
was closed.  In ksh93, command substitution completed when the
command completed and in many cases ksh93 doesn't even set up a pipe
and doesn't fork().

The difference showed up on an existing script in which a command that forked()
and exited, was used in a command substitution and the child process
did the write.  With ksh93 there was no output whereas the Bourne
shell waited for the child process to complete or close the pipe.

While the standard does not specify the behavior, I wanted to avoid
breaking old scripts as much as feasible.

The way I wound up doing this was to use continuing using memory and/or
files, and only creating the pipe() in cases the the fork() is
required.  At the time of the fork() any existing data is written
to the pipe() and at the end, the data is copied from the pipe()
to the file.

Now, the reason for the subdup was to track file descriptors that
were duplicates of the standard output in the case of command
substitution so that their data would be treated like standard output
data.

I thought that I had a regression test that required this but I just
ran with these lines commented out and nothing broke.

I will have to look at this in more detail to see whether tracking
dups of standout output for command substituion is needed or not.

David Korn
dgk@research.att.com
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic