From: evgeny <illumsoft.org@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: t0005-signals.sh fails with ksh
Date: Sat, 9 May 2015 02:05:06 +0300 [thread overview]
Message-ID: <727591966.20150509020506@gmail.com> (raw)
In-Reply-To: <xmqq1tiqkdue.fsf@gitster.dls.corp.google.com>
Hello Junio,
Friday, May 8, 2015, 11:34:49 PM, you wrote:
> evgeny <illumsoft.org@gmail.com> writes:
>> expecting success:
>> OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
>> test "$OUT" -eq 141
>>
>> t0005-signals.sh[499]: eval: syntax error at line 4: `(' unmatched
>> Memory fault
> Does this work if you did
> OUT=$( ( (large_git ; echo $? 1>&3) | : ) 3>&2 ) &&
> instead?
Yes. when I add a space between parentheses and change 141 to 269 all tests in
t0005-signals.sh are passed.
... stripped first lines ...
ok 3 - create blob
expecting success:
OUT=$( ( (large_git; echo $? 1>&3) | :) 3>&1 ) &&
test "$OUT" -eq 269
ok 4 - a constipated git dies with SIGPIPE
expecting success:
OUT=$( ( (trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
test "$OUT" -eq 269
ok 5 - a constipated git dies with SIGPIPE even if parent ignores it
# passed all 5 test(s)
1..5
>> 'man ksh' reads:
>> (list)
>> Execute list in a separate environment.
>> Note, that if two adjacent open parentheses are needed for nesting,
>> a space must be inserted to avoid evaluation as an arithmetic command as
>> described above.
> Hmm, I cannot see "as described above" in your message, but isn't
> that talking about a common mistake of turning cmd1 in this pipeline
> x=$(cmd1 | cmd2)
> into a series of two commands, e.g. (cmd1a && cmd1b) and saying
> x=$((cmd1a && cmd1b) | cmd2)
> which does make "$((" interpreted as the beginning of arithmetic
> expansion?
> And the "OUT=$( ((large..." construct seems to be written in order
> to avoid that exact issue (notice the SP after "$(").
> Puzzled....
It was an excerpt from ksh's man page, and "as described above" refers to
previous paragraph where "((expression))" expained.
I think the space after "$(" refers to "Arithmetic Substitution" paragraph
and the following two parentheses are about "Note, that if two adjacent open
parentheses are needed for nesting, a space must be inserted"
$ man ksh
... skipped ...
Arithmetic Substitution.
An arithmetic expression enclosed in double parentheses preceded by a dollar sign ( $(()) ) is replaced by the
value of the arithmetic expression within the double parentheses.
... skipped ...
((expression))
The expression is evaluated using the rules for arithmetic evaluation described below. If the value of the
arithmetic expression is non-zero, the exit status is 0, otherwise the exit status is 1.
(list)
Execute list in a separate environment. Note, that if two adjacent open parentheses are needed for nesting,
a space must be inserted to avoid evaluation as an arithmetic command as described above.
... skipped ...
Some info about my system:
$ head -1 /etc/os-release
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
$ ksh --version
version sh (AT&T Research) 93u+ 2012-02-29
It is surprise for me that ksh is so old.
$ ls -l $(which ksh)
lrwxrwxrwx 1 root root 29 May 6 22:44 /usr/bin/ksh -> /etc/alternatives/usr.bin.ksh
$ ls -l /etc/alternatives/usr.bin.ksh
lrwxrwxrwx 1 root root 10 May 6 22:44 /etc/alternatives/usr.bin.ksh -> /bin/ksh93
$ ls -l /bin/ksh93
-rwxr-xr-x 1 root root 1446836 Jan 3 2013 /bin/ksh93
--
Best regards,
evgeny
prev parent reply other threads:[~2015-05-08 22:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 20:15 t0005-signals.sh fails with ksh evgeny
2015-05-08 20:34 ` Junio C Hamano
2015-05-08 20:55 ` Jeff King
2015-05-08 21:14 ` Jeff King
2015-05-08 21:39 ` Junio C Hamano
2015-05-08 23:43 ` evgeny
2015-05-09 8:20 ` Andreas Schwab
2015-05-08 21:16 ` Junio C Hamano
2015-05-08 21:21 ` Jeff King
2015-05-09 20:01 ` brian m. carlson
2015-05-08 23:05 ` evgeny [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=727591966.20150509020506@gmail.com \
--to=illumsoft.org@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).