Skip to content

feat!: Store logs under XDG_STATE_HOME#12051

Open
e-kwsm wants to merge 3 commits into
haskell:masterfrom
e-kwsm:logs
Open

feat!: Store logs under XDG_STATE_HOME#12051
e-kwsm wants to merge 3 commits into
haskell:masterfrom
e-kwsm:logs

Conversation

@e-kwsm

@e-kwsm e-kwsm commented Jun 28, 2026

Copy link
Copy Markdown

https://specifications.freedesktop.org/basedir/0.8/#variables:

The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

  • actions history (logs, history, recently used files, …)
  • current state of the application that can be reused on a restart (view, layout, open files, undo history, …)

Please read Github PR Conventions and then fill in one of these two templates.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

Comment thread changelog.d/pr-12051.md
---

- before: logs are stored under `${XDG_CACHE_HOME:-$HOME/.cache}/cabal/logs`
- after: logs are stored under `${XDG_STATE_HOME:-$HOME/.local/state}/cabal/logs`

@philderbeast philderbeast Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is related documentation that would need to be changed alongside this *.hs change.

logs-dir: /home/alice/.cabal/logs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The location can be varied with this option marked as "Not implemented yet".

.. cfg-field:: logs-dir: directory
--logs-dir=DIR
:synopsis: Directory to store build logs.
:default: ``~/.cabal/logs``
:strike:`The location where build logs for packages are stored.`
Not implemented yet.
The command line variant of this flag is ``--logs-dir=DIR``.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review.

Comment thread doc/cabal-commands.rst Outdated
Comment on lines 758 to 763
"cabal-version": "3.14.1.0",
"compiler": {
"flavour": "ghc",
"id": "ghc-9.8.2",
"path": "/home/alice/.ghcup/bin/ghc"
},

This comment was marked as resolved.

@e-kwsm

e-kwsm commented Jun 29, 2026

Copy link
Copy Markdown
Author

I expect $XDG_STATE_HOME is already used because of

defaultStoreDir :: IO FilePath
defaultStoreDir =
getDefaultDir XdgState "store"

but cabal path, even HEAD version, does show no entries with fresh config:

$ ghcup install cabal -u https://github.com/haskell/cabal/releases/download/cabal-head/cabal-head-Linux-x86_64.tar.gz head
$ cabal-head --version
cabal-install version 3.17.0.0
compiled using version 3.17.0.0 of the Cabal library
$ cabal-head user-config init --force
$ cabal-head path | grep -F /.local/state
Warning: this is a debug build of cabal-install with assertions enabled.

I failed to build cabal locally, so I’m not confident if this patch change the location.

@ulysses4ever

Copy link
Copy Markdown
Collaborator

failed to build cabal locally, so I’m not confident if this patch change the location.

If you make sure CI succeeded, you can get binaries in the artifacts section

@e-kwsm

e-kwsm commented Jul 1, 2026

Copy link
Copy Markdown
Author

@ulysses4ever Thank you for your suggestion.
By using artifacts, bd3860b updates the cabal path output messages as of master 57e070f.

e-kwsm added 2 commits July 2, 2026 20:45
https://specifications.freedesktop.org/basedir/0.8/#variables:

> The $XDG_STATE_HOME contains state data that should persist between
> (application) restarts, but that is not important or portable enough
> to the user that it should be stored in $XDG_DATA_HOME. It may
> contain:
>
> • actions history (logs, history, recently used files, …)
> • current state of the application that can be reused on a restart
>   (view, layout, open files, undo history, …)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants