bugGNU Octave - Bugs: bug #44720, edit.m: Fails to open protected...

 
 

bug #44720: edit.m: Fails to open protected file if ~/octave does not exist

Submitted by:  Julien Bect <jbect>
Submitted on:  Sat 04 Apr 2015 04:30:00 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: DuplicateAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.0.0Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 02 Jun 2015 04:42:57 PM UTC, comment #11:

Retagging release from 4.0.0-rc2 to 4.0.0.

John W. Eaton <jwe>
Project Administrator
Tue 07 Apr 2015 04:26:05 PM UTC, comment #10:

Since this bug is marked as duplicate, shouldn't it be closed ?

Julien Bect <jbect>
Sat 04 Apr 2015 06:43:35 PM UTC, comment #9:

I meant : It can be marked as duplicate, of course...

Julien Bect <jbect>
Sat 04 Apr 2015 06:38:02 PM UTC, comment #8:

Sure, this is obviously a duplicate of bug #41278, sorry about that. I can be marked as duplicate.

(In my defense: bug #41278 doesn't show up if I search for "cannot create regular file" in all bug reports...)

Julien Bect <jbect>
Sat 04 Apr 2015 06:21:09 PM UTC, comment #7:

@Rik: make sure you don't have write permissions on hadamard.m, and also make sure that you don't have a ~/octave directory.

Mike Miller <mtmiller>
Project Administrator
Sat 04 Apr 2015 06:02:00 PM UTC, comment #6:

I can't reproduce this. Can you try running with the '-f' option and see if it still gives an error?

Rik <rik5>
Project Administrator
Sat 04 Apr 2015 05:59:40 PM UTC, comment #5:

I think this is essentially a duplicate of bug #41278, any reason not to close this as a duplicate and move discussion/patches to that report?

Mike Miller <mtmiller>
Project Administrator
Sat 04 Apr 2015 05:57:25 PM UTC, comment #4:

See also bug #41278.

Mike Miller <mtmiller>
Project Administrator
Sat 04 Apr 2015 05:56:36 PM UTC, comment #3:

The HOME that edit.m talks about is not the same as the $HOME environment variable.

This is an old feature of edit.m that differs from Matlab I think, and probably isn't used much these days. The intent, I think, was to allow you to edit an m-file even if you don't have write permission. If the file is not writable, e.g. part of Octave's system path, it would copy it to your writable HOME directory, which is also supposed to be in your load path, and that copy would then override the one in the system path.

If you set the EDITINPLACE variable to true, it will open the non-writeable file in your editor anyway without making a copy.

I asked about some bugs in edit.m when I first started working with Octave and got the impression that a lot of these features are legacy and could probably be deprecated. E.g. we might make EDITINPLACE true by default, deprecate it, and remove it at some point.

IMHO these are more sensible defaults:

Mike Miller <mtmiller>
Project Administrator
Sat 04 Apr 2015 05:38:47 PM UTC, comment #2:

The doc says: "If `NAME.ext' is not modifiable, it will be copied to `HOME' before editing."

This is inaccurate, since the file copied to $HOME/octave and not to $HOME directly (which would be even worse in my opinion).

((My initial message sounds weird because I initially intended to send an email to the maintainers list, which is why I wrote "should I file a bug report for this", and then copy-pasted it a little too fast...))

Julien Bect <jbect>
Sat 04 Apr 2015 05:20:22 PM UTC, comment #1:

I think this is a bug. There's no need to open a path/file without the user intending to do so. I'd say just open the file, perhaps with a dialog notice saying it isn't editable but can be saved elsewhere or maybe some other indication such as a grey background. If the user attempts to save the file then the system should complain.

Dan Sebald <sebald>
Sat 04 Apr 2015 04:30:00 PM UTC, original submission:

I get the following error (on hg rev cf9b94a89620) when trying to open hadamard.m (which is a protected file) from the GUI by typing "edit hadamard".

>> edit hadamard

cp: cannot create regular file '/home/high/bect/octave/hadamard.m': No such file or directory

/home/high/bect is my HOME directory and I don't have a ~/octave subdirectory.

Of course, the problem disappears if I create ~/octave but is this really the expected behaviour, or should I file a bug report for this ?

Proposed fixes : either create ~/octave when it does not exist, or instead create the copy of hadamard.m in /tmp ?

@++
Julien

Julien Bect <jbect>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by sebald (Posted a comment)
  • -unavailable- added by jbect (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 02 Jun 2015 04:42:57 PM UTCjweRelease4.0.0-rc2=>4.0.0
    Tue 07 Apr 2015 05:47:01 PM UTCrik5Open/ClosedOpen=>Closed
    Sat 04 Apr 2015 06:51:52 PM UTCrik5StatusNone=>Duplicate
    Sat 04 Apr 2015 06:51:22 PM UTCrik5Dependencies-=>Depends on bugs #41278
    Sat 04 Apr 2015 06:02:00 PM UTCrik5StatusDuplicate=>None
    Sat 04 Apr 2015 05:59:40 PM UTCmtmillerStatusNone=>Duplicate

    Back to the top


    Powered by Savane 3.1-cleanup1