#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 shell environment tee exit code status  |       
 Author:  Jeroen Demeyer, Leif Leonhardy
 Upstream:  N/A                                                         |      
Reviewer:  Leif Leonhardy                
   Merged:  sage-4.6.1.rc0                                              |   
Work_issues:                                
------------------------------------------------------------------------+---
Changes (by jdemeyer):

  * status:  needs_review => closed
  * resolution:  => fixed
  * merged:  => sage-4.6.1.rc0


Old description:

> `spkg/pipestatus` currently uses two different mechanisms, depending on
> the `bash` version (>=3.0 or not).  Unfortunately, the two alternatives
> currently differ in behaviour (the consequence in one case being an
> `install.log` file appearing in the wrong place).
>
> Consider a command
> {{{
> pipestatus "A && B" "C"
> }}}
>
> '''Alternative 1''' (for new versions of bash) does
> {{{
> #!sh
> A && (B | C)
> }}}
> (which is - without regard of the subshell environment - equivalent to
> the command list without parentheses, i.e. `A && B | C`, since the pipe
> symbol has higher precedence),[[BR]]
>
> while '''alternative 2''' (for very old versions of bash) does
> {{{
> #!sh
> (A && B) | C
> }}}
>
> ----
>
> The attached / merged patch makes `pipestatus` behave like '''alternative
> 1''' for ''all'' versions of `bash`, and executes all commands in the
> ''same'' environment.
>
> It also patches the top-level `Makefile` to no longer depend on
> (previously) varying behavior of `pipestatus` by changing a receipt to
> {{{
> #!sh
>         cd some_dir && pipestatus "A" "B"
> }}}
> (where `A` and `B` are simple commands).

New description:

 `spkg/pipestatus` currently uses two different mechanisms, depending on
 the `bash` version (>=3.0 or not).  Unfortunately, the two alternatives
 currently differ in behaviour (the consequence in one case being an
 `install.log` file appearing in the wrong place).

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

 '''Alternative 1''' (for new versions of bash) does
 {{{
 #!sh
 A && (B | C)
 }}}
 (which is - without regard of the subshell environment - equivalent to the
 command list without parentheses, i.e. `A && B | C`, since the pipe symbol
 has higher precedence),[[BR]]

 while '''alternative 2''' (for very old versions of bash) does
 {{{
 #!sh
 (A && B) | C
 }}}

 ----

 The attached / merged patch makes `pipestatus` behave like '''alternative
 1''' for ''all'' versions of `bash`, and executes all commands in the
 ''same'' environment.

 It also patches the top-level `Makefile` to no longer depend on
 (previously) varying behavior of `pipestatus` by changing a receipt to
 {{{
 #!sh
         cd some_dir && pipestatus "A" "B"
 }}}
 (where `A` and `B` are simple commands).

 ----

 Merged patches: [attachment:10339_pipestatus.v3.patch] and
 [attachment:10339_pipestatus.v3_spkg_install.patch]

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10339#comment:49>
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