bugGNU Octave - Bugs: bug #57463, History should be stored at...


bug #57463: History should be stored at platform specific location

Submitted by:  Markus Mützel <mmuetzel>
Submitted on:  Sun 22 Dec 2019 04:20:04 PM UTC  
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Patch Submitted Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating 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)

Fri 15 May 2020 07:09:37 PM UTC, comment #6: 

@Mike: Thanks for the review and feedback.
I hope to have addressed the issues you mentioned in the attached patch.

(file #49079)

Markus Mützel <mmuetzel>
Project Member
Thu 14 May 2020 09:21:24 PM UTC, comment #5: 

Note to self, or Markus or others testing this, it's very important to make sure that 'octave --no-history' does not try to create the ~/.local/share/octave (or %APPDATA%/octave) directory when it doesn't exist. The most ideal behavior may be to create the directory only when the history file needs to be written.

Notes to Markus: please fix the references in the commit message to refer to 'get_user_data_directory' instead of 'config'. It would also be better to name the local variable 'data_dir' instead of 'hist_dir' in oct-env, since it isn't about history at this layer.

Mike Miller <mtmiller>
Project Administrator
Thu 14 May 2020 09:02:44 PM UTC, comment #4: 

Looks good on reading, not yet tested.

Please take note that we try to avoid using shortcuts or globs for file names in commit messages, so use "oct-env.cc, oct-env.h (env::get_user_data_directory) ..." instead of "oct-env.[cc,h]" or "oct-env.{cc,h}". I'll add that to the wiki if it's not already mentioned.

Mike Miller <mtmiller>
Project Administrator
Thu 14 May 2020 08:00:15 PM UTC, comment #3: 

The attached changeset moves the default location of the history to %APPDATA%/octave/history on Windows or ${XDG_DATA_HOME}/octave/history on Unix-like OSs. If XDG_DATA_HOME is not set, it uses ~/.local/share as a fallback. I hope I got this right.

This seems to work for me on Ubuntu 20.04 and Windows 10 1909.

(file #49067)

Markus Mützel <mmuetzel>
Project Member
Mon 23 Dec 2019 06:45:00 PM UTC, comment #2: 

I'd opt for interpreting history as "data", too. Motive: there can be days or sometimes even weeks in between Octave sessions and I don't script all my activities not do I keep diaries of everything.

As many Windows users work on school or company networks with persistent roaming profiles I think something like %APPDATA%/Roaming/octave/ would be the best location.
Usually with such roaming profiles the local temp dirs are wiped after logout so there's little use in keeping history files there.

BTW I'd figure that roaming profiles should be possible on *nix as well. As on Windows it's just a question of linking to some persistent network location where /home lives at login time.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 23 Dec 2019 06:20:59 PM UTC, comment #1: 

Fortunately, this can already be configured by the user, see `help history_file`.

If we want to change the defaults to conform with OS expectations, a couple of questions for consideration.

  • Would the history file be considered more like a "cache" file, or more like a "data" file?
  • Would Windows users want to have Octave history saved in the per-machine profile directory or in the roaming profile directory? Would it be more useful to have a shared history between multiple machines by default or to have a unique history per machine?

My preference would be for "data", and I think shared history in the roaming profile probably makes sense. So on GNU, macOS, and other Unix-likes, the history file would be something like ${XDG_DATA_HOME}/octave/history, or ~/.local/share/octave/history if XDG_DATA_HOME is not defined. On Windows, the history file would be something like %APPDATA%\octave\history.

My ~/.octaverc already redefines the history_file to be ~/.local/share/octave/history, I've been using that for a while.

Mike Miller <mtmiller>
Project Administrator
Sun 22 Dec 2019 04:20:04 PM UTC, original submission:  

The .octave_hist file is currently stored in the home directory.
It would be nice if a location preferred by the OS would be used. This could be the XDG directories on POSIX systems or LOCALAPPDATA/APPDATA on Windows.

See also bug #36477 for the configuration files and bug #40444.

Markus Mützel <mmuetzel>
Project Member


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

Attach Files:

Attached Files
file #49079:  bug57463_xdg_history_v2.patch added by mmuetzel (6KiB - application/octet-stream)
file #49067:  bug57463_xdg_history.patch added by mmuetzel (6KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Submitted the item)

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

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-15 mmuetzel Attached File- => Added bug57463_xdg_history_v2.patch, #49079
    2020-05-14 mmuetzel Attached File- => Added bug57463_xdg_history.patch, #49067
        StatusConfirmed => Patch Submitted
    2019-12-23 mtmiller Severity2 - Minor => 1 - Wish
        StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.5