Opened 4 months ago

Last modified 4 months ago

#15540 new bug

GHCi does not follow the XDG Base Directory Specification

Reported by: rszibele Owned by:
Priority: normal Milestone: 8.6.1
Component: GHCi Version: 8.0.2
Keywords: newcomer Cc: gueux
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #6077 Differential Rev(s):
Wiki Page:

Description

Hello,

GHCi does not follow the XDG Base Directory Specification by default on GNU/Linux based operating systems.

It creates for instance the file $HOME/.ghc/ghci_history which belongs in $XDG_CACHE_HOME/ghc/ , or $HOME/.cache/ghc/ if $XDG_CACHE_HOME is not set.

$ ghci --version The Glorious Glasgow Haskell Compilation System, version 8.0.2

Change History (5)

comment:1 Changed 4 months ago by bgamari

Keywords: newcomer added

For the record, the specification says the following:

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

Indeed .ghci_history is rather non-essential.

However, what is the argument for singling out .ghci_history? GHC puts all kinds of things in ~/.ghc, including the user package database.

comment:2 Changed 4 months ago by rszibele

The package database would also belong in $XDG_CACHE_HOME/ghc, I used .ghci_history as an example.

Supporting the XDG Base Directory Specification would allow users to easily back up their configuration files while at the same time not including cache in the backup. It also allows for deleting the cache of a user without having to check which files are essential and which files aren't, as one could simply delete all files in $XDG_CACHE_HOME/.

comment:3 Changed 4 months ago by potato44

The package database would also belong in $XDG_CACHE_HOME/ghc

I don't think this is quite right, I believe you are meant to be able to delete the cache directory without ill effect. I believe the correct directory would be $XDG_DATA_HOME/ghc.

comment:4 Changed 4 months ago by potato44

comment:5 Changed 4 months ago by gueux

Cc: gueux added
Note: See TracTickets for help on using tickets.