Skip to content

Bug: guidata writes its configuration to ~/.config/.none/none.ini #113

Description

@StefanoPierini-Codra

Component: guidata.config / guidata.userconfig
Affected version: 3.15.0 and, as far as can be told, every earlier version
Severity: low to medium — settings are stored under a meaningless name, in a directory shared with any other unnamed UserConfig

Symptom

Importing guidata creates ~/.config/.none/ (Windows: %USERPROFILE%\.none\), and guidata's own settings are persisted to ~/.config/.none/none.ini, with sections:

[faulthandler] [arrayeditor] [dicteditor] [texteditor] [codeeditor] [console] [color_schemes]

Expected location would be something like ~/.config/.guidata/guidata.ini.

Root cause

guidata/config.py:

CONF = UserConfig(DEFAULTS)

UserConfig.__init__ sets self.name = "none" as a placeholder, and set_application() is never called on this instance. Since UserConfig.get_path() builds ~/.config/.{self.name}/… and filename() returns {self.name}.ini, everything ends up in .none/none.ini.

Two aggravating factors:

  • get_path() has a side effect: it calls os.makedirs on the directory. The stray directory is therefore created even by a read-only path lookup, e.g. when guidata merely checks whether a file exists.
  • The .none directory is a shared namespace: any library that forgets to call set_application resolves to the same directory, and to the same none.ini filename. Two such libraries saving in the same process would overwrite each other's file, since ConfigParser.write() rewrites the whole file from the sections the instance knows about. PlotPy currently falls in this category (it never names its CONF), though it happens not to call CONF.save(), so no collision is observed today.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions