Menu

Git Repository Merge Request #8: (merged)

Merging...

Merged

Something went wrong. Please, merge manually

Checking if merge is possible...

Something went wrong. Please, merge manually

Michael Kuron wants to merge 1 commit from /u/mkuron/gnuplot/ to master, 2020-04-23

Sample script:

set terminal tikz
set output '/dev/null'

set xrange [0:1]
set yrange [0:1]

set object polygon from 2,2 to 3,2 to 3,3 to 2,3 to 2,2

plot 0.5

unset out

causes the following error:

"test.gp", line 9: warning: Error re-writing output file: Invalid argument
"test.gp", line 9: /usr/share/gnuplot/gnuplot/5.2/lua/gnuplot-tikz.lua:439: attempt to index a nil value (field '?')
stack traceback:
    /usr

line 0: Missing Lua context! No script?

line 0: Missing Lua context! No script?

[...repeated...]

This merge request fixes the issue by not drawing any polygons that have less than two (visible) points. I have observed the above error on gnuplot 5.0 and 5.2 and believe it remains present in the current master branch.

Commit Date  
[ec090b] (HEADmastertikz) by Michael Kuron Michael Kuron

Prevent polygons outside plot range from breaking tikz

2019-02-12 15:32:45 Tree

Discussion

  • Michael Kuron

    Michael Kuron - 2019-02-12

    For some reason Sourceforge doesn't want to show my commit right now. This is the patch:

    --- term/lua/gnuplot-tikz.lua   2019-01-27 14:49:51.000000000 +0100
    +++ term/lua/gnuplot-tikz.lua   2019-01-27 14:49:24.000000000 +0100
    @@ -422,6 +422,9 @@
    
    
     pgf.draw_fill = function(t, pattern, color, saturation, opacity)
    
    +  if #t < 2 then
    +    return
    +  end
       local fill_path = ''
       local fill_style = color
    
     
  • Ethan Merritt

    Ethan Merritt - 2019-02-12

    Hmm, I see what you mean. The merge request executes but reports "nothing to merge". I have no idea what's going on there.

    Notes:
    1) Some other terminals check for a minimum of 3 points rather than 2.
    2) In this particular problematic example the entire rectangle is out of range, causing the terminal routine to be called with 0 points. That strikes me as a top-level error since it makes no sense to call the terminal at all in this case. Therefore in addition to the check in your patch, the equivalent check should also be made in the calling routine.

     
  • Michael Kuron

    Michael Kuron - 2019-02-12

    Well, I managed to get Sourceforge to show the commit. Even though it stopped showing me HTTP 500 error messages now, my forked Git repo is still behaving odd.

    1) 2 is the minimum that the logic in the Lua code needs. Of course, a 2-gon is just a line, but there is not explicit reason to prevent 2 here.
    2) That's correct, though I couldn't find the right place in the code for that. Furthermore, other terminals seem to be fine with 0 points.

     
  • Ethan Merritt

    Ethan Merritt - 2019-02-12

    Applied to both 5.2 and 5.3
    I added a check to the caller also (graphics.c:do_polygon).

     
  • Bastian Märkisch

    • Status: open --> merged
     

Log in to post a comment.

MongoDB Logo MongoDB