#10339: Simplify spkg/pipestatus
------------------------------+---------------------------------------------
Reporter: jdemeyer | Owner: GeorgSWeber
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.6.1
Component: scripts | Keywords: pipestatus Makefile
Author: Jeroen Demeyer | Upstream: N/A
Reviewer: Leif Leonhardy | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Description changed by jdemeyer:
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
> }}}
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}}}.
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.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10339#comment:41>
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.