rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

plot2d prints SVG output to console after failure to open output file #1167

Open rtoy opened 1 week ago

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-04 01:45:50 Created by robert_dodier on 2022-04-22 16:51:04 Original: https://sourceforge.net/p/maxima/bugs/3969


Working w/ Maxima 5.46.0 on macOS, same observed on Linux. If the SVG output file can't be opened, the SVG output is printed to the terminal. I didn't check to see if other output types (PNG, etc) have the same problem or not.

E.g. no such file or directory:

(%i1) plot2d(sin,[x,0,1],[svg_file, "/tmp/foobaz/1.svg"]);
(%o1)                         [/tmp/foobaz/1.svg]
(%i2) 
gnuplot> set output "/tmp/foobaz/1.svg"
                                       ^
         line 0:          cannot open file; output not changed
system error: No such file or directory

<?xml version="1.0" encoding="utf-8"  standalone="no"?>
<svg 
 width="600" height="480"
 viewBox="0 0 600 480"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
>

<title>Gnuplot</title>
<desc>Produced by GNUPLOT 5.4 patchlevel 1 </desc>

etc etc.

E.g. permission denied:

(%i3) plot2d(sin,[x,0,1],[svg_file, "/tmp.svg"]);
(%o3)                             [/tmp.svg]
(%i4) 
gnuplot> set output "/tmp.svg"
                              ^
         line 118:          cannot open file; output not changed
system error: Read-only file system

<?xml version="1.0" encoding="utf-8"  standalone="no"?>
<svg 
 width="600" height="480"
 viewBox="0 0 600 480"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
>

<title>Gnuplot</title>
<desc>Produced by GNUPLOT 5.4 patchlevel 1 </desc>

etc etc.

Not sure what's going on here. I would expect Gnuplot to just give up if set output fails. Ideally Maxima would notice Gnuplot ran into an error. I'll open a feature request about that.

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-04 01:45:51 Created by robert_dodier on 2022-04-22 16:52:04 Original: https://sourceforge.net/p/maxima/bugs/3969/#a64d


Feature request for Maxima/Gnuplot error handling: https://sourceforge.net/p/maxima/feature-requests/169/

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-04 01:45:55 Created by robert_dodier on 2022-06-15 00:09:52 Original: https://sourceforge.net/p/maxima/bugs/3969/#a52e


Another datum. It appears that the SVG output goes to the console only if the plot format is gnuplot_pipes (the default). If the plot format is gnuplot, the "no such file or directory" error is printed, but no SVG output is observed on the console.