Re: Re*: [PATCH] t1503: Fix arithmetic expansion syntax error when using dash
Ævar Arnfjörð Bjarmason wrote:
Show 20 quoted lines
> On Sat, Sep 25, 2010 at 17:08, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>> Junio C Hamano wrote:
>>> I just left it vague by saying "e.g. older dash" in below, but we may want
>>> to be more precise in the documentation.
>> I found a bug report:
>>
>> http://bugs.launchpad.net/ubuntu/+source/dash/+bug/92189
>>
>> which had a post against it which implied that this was fixed in
>> version 0.5.4-3. I went over to packages.debian.org to read the
>> ChangeLog for this version, but I could not conclude anything
>> from that text. :(
>>
>> Do we need to be more precise?
>
> If you want to spend the effort to track it down that would be
> great. There's a dash git repository on kernel.org you can probably
> bisect:
>
> http://git.kernel.org/?p=utils/dash/dash.git;a=summary
I don't think we need to be more precise here, but just for the giggle, I cloned the dash repository to take a quick look.
It was actually very easy to spot the commit that adds the missing capability; I fired up gitk and (starting from v0.5.3) just scanned the commits "upward" until I found the culprit ;-) Having said that, I would not have found it just by reading the commit message; I had to read the "patch" text to discover the "fix", which I suppose could have been an unintended side effect! :-D
BTW the answer is: commit f6e3b2f8a59922405f42c8bc283e0f5546c25d0e or, if you prefer:
$ git describe --tags f6e3b2f8
v0.5.4-26-gf6e3b2f[But this does not help too much in identifying the downstream version(s) from, say, the debian project.]
I decided to actually perform a git-bisect to confirm that I had actually found the correct commit. I used a script (see below) to build and test dash, so that I could use "git bisect run ./test.sh" to find it automatically. (The script may seem to return backward results, but we need to consider a version that *does* support the extended syntax to be a *bad* commit for the purposes of bisect! ;-) )
A transcript of the git-bisect run is given below.
ATB, Ramsay Jones
$ git tag -l v0.5.2 v0.5.3 v0.5.4 v0.5.5 v0.5.5.1 v0.5.6 v0.5.6.1
$ cat -n test.sh
1 #!/bin/sh
2
3 make clean >/dev/null 2>&1
4 make >make-out 2>&1 || { echo CANNOT BUILD; exit 125; }
5
6 if src/dash -c 'N=20; echo $(( N + 3))'
7 then
8 echo "--- works OK => BAD ---"
9 exit 1;
10 else
11 echo "--- syntax error => GOOD ---"
12 exit 0;
13 fi$ git bisect start v0.5.5 v0.5.3
Bisecting: 41 revisions left to test after this (roughly 5 steps)
[aa82f69dea2f2d5fe4337dfb12cea54fabdab175] [BUILTIN] Use intmax_t arithmetic in test
$ git bisect run ./test.sh
running ./test.sh
src/dash: arith: syntax error: " N + 3"
--- syntax error => GOOD ---
Bisecting: 20 revisions left to test after this (roughly 4 steps)
[f0f930d60cd62f5fe5ba28460b43f333e8062b94] [CD] Restored non-glibc getcwd support
running ./test.sh
23
--- works OK => BAD ---
Bisecting: 10 revisions left to test after this (roughly 3 steps)
[d39c8628b8594c29d234427ba07a12538ab36f41] [PARSER] Fix here-doc corruption
running ./test.sh
23
--- works OK => BAD ---
Bisecting: 4 revisions left to test after this (roughly 2 steps)
[7454c1e3b90f51a49e563323db38bafa50776533] [BUILTIN] Use setvarint to set OPTIND
running ./test.sh
23
--- works OK => BAD ---
Bisecting: 2 revisions left to test after this (roughly 1 step)
[f6e3b2f8a59922405f42c8bc283e0f5546c25d0e] [ARITH] Add assignment and intmax_t support
running ./test.sh
23
--- works OK => BAD ---
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[3df3edd13389ae768010bfacee5612346b413e38] [PARSER] Report substition errors at expansion time
running ./test.sh
src/dash: arith: syntax error: " N + 3"
--- syntax error => GOOD ---
f6e3b2f8a59922405f42c8bc283e0f5546c25d0e is the first bad commit
commit f6e3b2f8a59922405f42c8bc283e0f5546c25d0e
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu Oct 11 22:36:28 2007 +0800
[ARITH] Add assignment and intmax_t support
This patch adds assignment operator support in arithmetic expansions. It
also changes the type used to intmax_t.:100644 100644 69ba464a3219d6979aa1150c15e279d3adf423ac 895c6072294f13f2a434c52752dc839afd412c0b M ChangeLog :040000 040000 6640114c4a8d35cbcfaf6fa44b888195270a3ae1 06a80af3e532959cddd422f921e66cb679fc8760 M src bisect run success
$ git describe --tags f6e3b2f8 v0.5.4-26-gf6e3b2f
$