#10339: Simplify spkg/pipestatus
---------------------------------+------------------------------------------
 Reporter:  jdemeyer             |         Owner:  GeorgSWeber                  
 
     Type:  defect               |        Status:  closed                       
 
 Priority:  major                |     Milestone:  sage-4.6.1                   
 
Component:  scripts              |    Resolution:  fixed                        
 
 Keywords:  pipestatus Makefile  |        Author:  Jeroen Demeyer, Leif 
Leonhardy
 Upstream:  N/A                  |      Reviewer:  Leif Leonhardy               
 
   Merged:  sage-4.6.1.rc0       |   Work_issues:                               
 
---------------------------------+------------------------------------------
Changes (by newvalueoldvalue):

  * status:  positive_review => closed
  * resolution:  => fixed
  * author:  Jeroen Demeyer => Jeroen Demeyer, Leif Leonhardy


Old description:

> spkg/pipestatus currently uses two different mechanisms, depending on the
> bash version.  Unfortunately, the two alternatives differ in behaviour
> (the consequence is an {{{install.log}}} file appearing in the wrong
> place).
>
> Consider a command
> {{{
> pipestatus "A && B" "C"
> }}}
>
> Alternative 1 (for new versions of bash) does {{{A && (B | C)}}} while
> alternative 2 (for old versions of bash) does {{{(A && B) | C}}}.
>
> In my opinion, there should be only one alternative.  If we have
> something which works for old versions, why not use that for new versions
> also?
>
> In any case, it would be good to think of a more robust implementation of
> pipestatus.  I can think of the following:
>  1. Write a simple C program using pipe(), fork(), exec(), wait().
>  1. Use the `mkfifo` command.
>  1. Use a temporary file:
> {{{
> EXITSTATUS=/tmp/pipestatus$$     # Obviously, we should use TMPDIR if set
> ( A; echo $? >$EXITSTATUS ) | B
> }}}
>  1. Use `bash`'s `PIPESTATUS` array.

New description:

 spkg/pipestatus currently uses two different mechanisms, depending on the
 bash version.  Unfortunately, the two alternatives differ in behaviour
 (the consequence is an {{{install.log}}} file appearing in the wrong
 place).

 Consider a command
 {{{
 pipestatus "A && B" "C"
 }}}

 Alternative 1 (for new versions of bash) does {{{A && (B | C)}}} while
 alternative 2 (for old versions of bash) does {{{(A && B) | C}}}.

 The attached patch makes `pipestatus` behave like alternative 1 for
 ''all'' versions of `bash`.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10339#comment:45>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to