Webrev: "arithmetic syntax error" when working with non-commited changes

Stanislav Baiduzhyi sbaiduzh at redhat.com
Wed May 6 09:15:30 UTC 2015


On Tuesday 05 May 2015 23:36:56 Magnus Ihse Bursie wrote:
> On 2015-05-04 14:56, Stanislav Baiduzhyi wrote:
> > Hi All,
> > 
> > I'm getting multiple "arithmetic syntax error" when working with
> > non-commited changes. I've made a small fix, could anyone please take a
> > look, and incorporate those changes into upstream if you like the fix?
> > 
> > https://e5decb045a719fb58df46fd7e03c2f98cddc1ac6.googledrive.com/host/0B5K
> > p-cB1sXJrfk9NQTVHMTJTdWpYX3dWaExreWN0V0hQZ3d0eGIyZDltdHBCbmhYcXpzRFk/fix-a
> > rithmetic/
> Hi Stanislav,
> 
> While the changes look reasonable, I'm curious why this hasn't surfaced
> as a problem before. The missing $ just looks plain broken, but why is
> the extra -n test needed?
> 
> What do you do to trigger the problem? What version of ksh are you using?

Hi Magnus,

Thanx for your reply. I was wondering myself how is this possible. I'm using 
the tip from http://hg.openjdk.java.net/code-tools/webrev/ . I think it works 
fine without that -n check, error only goes to output and as in any shell the 
failing command means 'false'. So that check only affects the output.

Distribution is openSUSE 13.2.

Reproducing the issue like this:
$ ksh --version
  version         sh (AT&T Research) 93v- 2014-06-25
$ hg clone http://hg.openjdk.java.net/code-tools/webrev/
$ cd webrev
# changing anything:
$ echo 'echo "the quick brown fox"' >>webrev.ksh
# launching webrev:
$ ksh webrev.ksh -N -m -u 'Stanislav Baiduzhyi'
   SCM detected: mercurial                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                               
 No outgoing, perhaps you haven't commited.                                                                                                                                                                                                                                    
      Workspace: /home/user/work/src/jdk-dev/showroom/webrev                                                                                                                                                                                                                   
      Output to: /home/user/work/src/jdk-dev/showroom/webrev/webrev                                                                                                                                                                                                            
   Output Files:                                                                                                                                                                                                                                                               
webrev.ksh: line 2282: i: arithmetic syntax error                                                                                                                                                                                                                              
# fixing the missing $ error:
$ sed -i 's;\[\[ i -lt;\[\[ $i -lt;' webrev.ksh
# trying once again:
$ ksh webrev.ksh -N -m -u 'Stanislav Baiduzhyi'
   SCM detected: mercurial

 No outgoing, perhaps you haven't commited.
      Workspace: /home/user/work/src/jdk-dev/showroom/webrev
      Output to: /home/user/work/src/jdk-dev/showroom/webrev/webrev
   Output Files:
        webrev.ksh
                webrev.ksh[2366]: build_old_new[1792]: 
build_old_new_mercurial[1744]: [: : arithmetic syntax error
 patch cdiffs udiffs sdiffs frames old new
     index.html: Done.
Output to: /home/user/work/src/jdk-dev/showroom/webrev/webrev
the quick brown fox

-- 
Regards,
    Stas



More information about the code-tools-dev mailing list