Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ defaultStoreDir =

defaultLogsDir :: IO FilePath
defaultLogsDir =
getDefaultDir XdgCache "logs"
getDefaultDir XdgState "logs"

defaultReportsDir :: IO FilePath
defaultReportsDir =
Expand Down
9 changes: 9 additions & 0 deletions changelog.d/pr-12051.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
synopsis: Store logs under XDG_STATE_HOME instead of XDG_CACHE_HOME
packages: [cabal-install]
prs: 12051
---

- 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.

- ref: <https://specifications.freedesktop.org/basedir/0.8/#variables>
36 changes: 20 additions & 16 deletions doc/cabal-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ cabal preferences. It is very useful when you are e.g. first configuring

.. option:: --config-file=PATH

Specify config file path. (default: ``~/.cabal/config``).
Specify config file path. (default: ``~/.config/cabal/config``).

.. option:: -f, --force

Expand Down Expand Up @@ -738,13 +738,15 @@ installed binaries, and so on.
$ cabal path
compiler-flavour: ghc
compiler-id: ghc-9.8.2
compiler-abi-tag: ghc-9.8.2
compiler-path: /home/alice/.ghcup/bin/ghc
cache-home: /home/alice/.cabal
remote-repo-cache: /home/alice/.cabal/packages
logs-dir: /home/alice/.cabal/logs
store-dir: /home/alice/.cabal/store
config-file: /home/alice/.cabal/config
installdir: /home/alice/.cabal/bin
compiler-store-path: /home/alice/.local/state/cabal/store/ghc-9.8.2
cache-home: /home/alice/.cache/cabal
remote-repo-cache: /home/alice/.cache/cabal/packages
logs-dir: /home/alice/.local/state/cabal/logs
store-dir: /home/alice/.local/state/cabal/store
config-file: /home/alice/.config/cabal/config
installdir: /home/alice/.local/bin

Or using the json output:

Expand All @@ -755,18 +757,20 @@ Or using the json output:
.. code-block:: json

{
"cabal-version": "3.13.0.0",
"cabal-version": "3.17.0.0",
"compiler": {
"flavour": "ghc",
"id": "ghc-9.8.2",
"path": "/home/alice/.ghcup/bin/ghc"
"abi-tag": "ghc-9.8.2",
"path": "/home/alice/.ghcup/bin/ghc",
"store-path": "/home/alice/.local/state/cabal/store/ghc-9.8.2"
},
"cache-home": "/home/alice/.cabal",
"remote-repo-cache": "/home/alice/.cabal/packages",
"logs-dir": "/home/alice/.cabal/logs",
"store-dir": "/home/alice/.cabal/store",
"config-file": "/home/alice/.cabal/config",
"installdir": "/home/alice/.cabal/bin"
"cache-home": "/home/alice/.cache/cabal",
"remote-repo-cache": "/home/alice/.cache/cabal/packages",
"logs-dir": "/home/alice/.local/state/cabal/logs",
"store-dir": "/home/alice/.local/state/cabal/store",
"config-file": "/home/alice/.config/cabal/config",
"installdir": "/home/alice/.local/bin"
}

If ``cabal path`` is passed a single option naming a path, then that
Expand All @@ -775,7 +779,7 @@ path will be printed *without* any label:
::

$ cabal path --installdir
/home/alice/.cabal/bin
/home/alice/.local/bin

While this interface is intended to be used for scripting, it is an experimental command.
Scripting example:
Expand Down
6 changes: 3 additions & 3 deletions doc/cabal-project-description-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ Advanced global configuration options
--remote-repo-cache=DIR
:synopsis: Location of packages cache.

:default: ``~/.cabal/packages``
:default: ``~/.cache/cabal/packages``

The location where packages downloaded from remote repositories will be
cached.
Expand All @@ -1863,7 +1863,7 @@ Advanced global configuration options
--logs-dir=DIR
:synopsis: Directory to store build logs.

:default: ``~/.cabal/logs``
:default: ``~/.local/state/cabal/logs``

:strike:`The location where build logs for packages are stored.`
Not implemented yet.
Expand All @@ -1874,7 +1874,7 @@ Advanced global configuration options
--build-summary=TEMPLATE
:synopsis: Build summaries location.

:default: ``~/.cabal/logs/build.log``
:default: ``~/.local/state/cabal/logs/build.log``

:strike:`The file to save build summaries.` Not implemented yet.

Expand Down
Loading