octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #44292] Frequent crashes when printing to eps


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #44292] Frequent crashes when printing to eps on Windows platform
Date: Fri, 27 Feb 2015 01:03:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

Follow-up Comment #14, bug #44292 (project octave):

Oh, it may or may not be a pipe.  (On linux it is.)  I see that the expression
entered for the pipeline is decomposed in the function


DEFUN (drawnow, args, ,


in graphics.cc.  The file name is then used to open a file of sort.  I suppose
this is to handle OS's not having a pipe.

I have done some debugging.  After adding some fprintf() statements to
graphics.c and saving, I find it takes 2 minutes and 38 seconds to recompile
and link Octave.  Despite that, I persevered and slogged through
trial-and-error compilation.

If I pass the empty string in for the pipeline argument, i.e.,


+    drawnow (gl2ps_device{n}, "");


and run with the --no-gui option that the standard error output can be seen. 
The first time I attempted to "print -depsc tst.eps", I saw no crash. 
However, subsequent "print -depsc tst.eps" tests resulted in the following
error:


terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr
panic: Aborted -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
Aborted (core dumped)


In the file graphics.cc, function drawnow() is this test


                  size_t pos = file.find_first_not_of ("|");
                  if (pos > 0)
                    file = file.substr (pos);


but size_t variables are not signed so that test >0 always passes.  Apparently
passing in what is effectively the maxim string length to the substr() routine
causes problems.  I've attached a changeset that properly tests for "not
found".  With that change, I'm seeing the following result for the empty
string pipeline:


octave:1> surf (peaks)
octave:2> print -depsc tst.eps
warning: broken pipe

octave:2> 


which looks correct.  Please apply the changeset and check if that helps in
the Windows case.  Probably not, but who knows.

I was going to include a second changeset for what I think should be a check
for a file being opened correctly in the gl2ps_print() function.  That isn't
causing a problem that I'm aware of.  However, I see that change was made
recently in the canonical repository.


(file #33198)
    _______________________________________________________

Additional Item Attachment:

File name: octave-substring_error-djs2015feb26.patch Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44292>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]