bugGNU Octave - Bugs: bug #53894, The file browser tries to open...

 
 

bug #53894: The file browser tries to open some m-files as data files instead

Submitter:  Lars Kindermann <larskindermann>
Submitted:  Mon 14 May 2018 06:32:19 AM UTC
   
 
Category:  GUI Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 24 May 2018 07:50:06 AM UTC, comment #7: 

I pushed the patch here:

http://hg.savannah.gnu.org/hgweb/octave/rev/ce725103ebf1

Closing report as fixed.

Pantxo Diribarne <pantxo>
Group Member
Wed 23 May 2018 07:55:35 AM UTC, comment #6: 

The patch for bug #50543 is ready. I'll push it soon to default unless someone wants to give it a try first.

Pantxo Diribarne <pantxo>
Group Member
Tue 15 May 2018 09:57:07 PM UTC, comment #5: 

I am currently reworking the patch from bug #50543, which basically will make the file browser rely on "open.m" for any other file than text files with specified extensions.

This is a purely extension based scheme (will eliminate the file recognition step) and is the way ML handles opening files from the GUI.

Pantxo Diribarne <pantxo>
Group Member
Tue 15 May 2018 06:41:29 PM UTC, comment #4: 

Obviously, the tooltip was never updated. What about
"Activate for default action, right click for alternatives"?

Torsten Lilge <ttl>
Group Member
Tue 15 May 2018 09:32:38 AM UTC, comment #3: 

Currently the tooltip when hovering over any file in the filebrowser is misleading, too. It says

Activate to open in editor, right click for altenatives

which is simply wrong in many cases.

Lars Kindermann <larskindermann>
Tue 15 May 2018 12:41:29 AM UTC, comment #2: 

Any plain text file that contains no spaces, commas, or tabs on each line is going to look like a Matlab format ASCII file according to Octave's current logic.


// FIXME: looks_like_mat_ascii_file does not check to see
// whether the file contains numbers.  It just skips comments
// and checks for the same number of words on each line.  We
// may need a better check here.  The best way to do that
// might be just to try to read the file and see if it works.


The following file also looks like a Matlab ASCII file to Octave's heuristics:


foo=12;
abs(foo)
plot(rand(12))


Mike Miller <mtmiller>
Group Member
Mon 14 May 2018 07:34:31 PM UTC, comment #1: 

It seems that two separate spaces are enough to get the file being opened in the editor. The decision on the file format is done by get_file_format () in load-save.cc.

Torsten Lilge <ttl>
Group Member
Mon 14 May 2018 06:32:19 AM UTC, original submission:  

Double-clicking some m-files in the file browser widget will not open them in the editor but will try to read them as data-files.

Éxample: opening a file init.m containing just the line


Answer=43


results in


>> error: load: failed to read matrix from file '/home/kinder/init.m'
error: parse error


This seems to happen when the file does not contain at least one of several keywords from the octave language.

Even the shebang line #!/usr/bin/octave will not help.

Lars Kindermann <larskindermann>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by larskindermann (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-24 pantxo StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2018-05-23 pantxo StatusConfirmed Patch Submitted
    2018-05-14 mtmiller Carbon-CopyRemoved 80942 -
    2018-05-14 mtmiller Severity3 - Normal 2 - Minor
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code