Fix to allow 'compare_versions.m' handle version numbers ending with period

Ben Abbott bpabbott at mac.com
Mon Jan 26 14:34:51 CST 2009


On Monday, January 26, 2009, at 02:57PM, "John W. Eaton" <jwe at octave.org> wrote:
>On 26-Jan-2009, Ben Abbott wrote:
>
>| On Monday, January 26, 2009, at 01:42PM, "Muthiah Annamalai" <muthuspost at gmail.com> wrote:
>| >Hello there,
>| >
>| >I built Octave from sources (3.1.51+) and my gnuplot interface failed, 
>| >for the following
>| >reason: __gnuplot_version__() returns 4.2. in my computer, and 
>| >compare_versions.m
>| >script doesnt recognize version numbers ending with a "." as you can see 
>| >from the
>| >runs below.
>| >
>| >__gnuplot_version__()
>| >ans = 4.2.
>| 
>| We should look more closely at __gnuplot_version__ as well. There may be a bug here.
>| 
>| What do you get when you type the following?
>| 
>|     [status, output] = system (sprintf ("%s --version", gnuplot_binary ()))
>| 
>| I get
>| 
>|     status = 0
>|     output = gnuplot 4.2 patchlevel 4 
>| 
>| __gnuplot_version__ replies  "4.2"
>| 
>| I would have expected to get 4.2.4.
>
>What does
>
>  pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)";
>  [d1, d2, d3, d4, matches] = regexp ("gnuplot 4.2 patchlevel 4", pattern)
>
>return on your system?  I see
>
>  d1 =  1
>  d2 =  24
>  d3 =
>  {
>    [1,1] =
>
>	9   11
>       24   24
>  }
>
>  d4 =
>  {
>    [1,1] = gnuplot 4.2 patchlevel 4
>  }
>
>  matches =
>  {
>    [1,1] =
>
>    {
>      [1,1] = 4.2
>      [1,2] = 4
>    }
>
>  }
>
>If you see something different, what regexp library are you using?
>
>Maybe the pattern should be written differently.
>
>jwe

opps ... I was using my desktop with 3.0.3 installed (not my usual notebook with the developers sources).

Looking at the developers sources, it looks like you fixed this  3 months ago.

Ben




More information about the Bug-octave mailing list