[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crash
From: |
Avinoam Kalma |
Subject: |
[Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave |
Date: |
Mon, 30 Jan 2017 05:18:53 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 |
Follow-up Comment #11, bug #49779 (project octave):
Please review the following diff.
The changes in print.m are according to comment#10.
I have also added another input check in /__print_parse_opts__.
I hope it is correct and I did not miss something.
diff -r 868daa374c49 scripts/plot/util/print.m
--- a/scripts/plot/util/print.m Tue Nov 15 23:10:15 2016 +0100
+++ b/scripts/plot/util/print.m Mon Jan 30 07:16:20 2017 +0200
@@ -314,6 +314,22 @@
opts = __print_parse_opts__ (varargin{:});
+ folder = fileparts (opts.name);
+ if (!isempty(folder))
+ if (!exist(folder,"dir"))
+ str = sprintf ("print: directory %s does not exist", folder);
+ error (str);
+ end
+ end
+
+ fid = fopen (opts.name, "w");
+ if (fid == -1)
+ str = sprintf ("print: cannot open file %s for writing", opts.name);
+ error (str);
+ end
+ fclose (fid);
+ unlink (opts.name);
+
opts.pstoedit_cmd = @pstoedit;
opts.fig2dev_cmd = @fig2dev;
opts.latex_standalone = @latex_standalone;
diff -r 868daa374c49 scripts/plot/util/private/__print_parse_opts__.m
--- a/scripts/plot/util/private/__print_parse_opts__.m Tue Nov 15 23:10:15
2016 +0100
+++ b/scripts/plot/util/private/__print_parse_opts__.m Mon Jan 30 07:16:20
2017 +0200
@@ -262,7 +262,8 @@
if (any (match))
default_suffix = suffixes{match};
else
- default_suffix = arg_st.devopt;
+ str = sprintf ("__print_parse_opts__: unknown device %s",
arg_st.devopt);
+ error (str);
endif
if (dot == 0 && ! isempty (arg_st.name))
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49779>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Avinoam Kalma, 2017/01/09
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Avinoam Kalma, 2017/01/27
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Pantxo Diribarne, 2017/01/27
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Rik, 2017/01/27
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Pantxo Diribarne, 2017/01/28
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave,
Avinoam Kalma <=
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Avinoam Kalma, 2017/01/30
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Avinoam Kalma, 2017/01/30
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Pantxo Diribarne, 2017/01/30
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Pantxo Diribarne, 2017/01/30
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Rik, 2017/01/30
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Pantxo Diribarne, 2017/01/30
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, John W. Eaton, 2017/01/31
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Pantxo Diribarne, 2017/01/31
- [Octave-bug-tracker] [bug #49779] print /non/existing/dir/file.svg crashes octave, Rik, 2017/01/31