New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use full $libname in default build-log filename template #3807

hvr opened this Issue Sep 8, 2016 · 1 comment


None yet
3 participants
Copy link

hvr commented Sep 8, 2016

filename templates are used in flags like

    --build-log=TEMPLATE             Log all builds to file (name template can
                                     use $pkgid, $compiler, $os, $arch)
    --remote-build-reporting=LEVEL   Generate build reports to send to a remote
                                     server (none, anonymous or detailed).

Currently, $pkgid expands to the source pkg id, rather than the installed package id (which contains a hash), E.g. for a package that gets registered as


the flag --build-log='log/$pkgid.log' expands to "log/text-", which results in build logs overwriting each (which happens quite frequently with nix-local-build).

One way to address this is to

  • introduce a new interpolation variable $unitid (or $ipkgid) to hold the full package-id, and
  • change the default templates prone to name-clashes to use this new variable
    ( e.g. ~/.cabal/logs/$unitid.log )

/cc @ezyang @dcoutts

PS: For consistency with ~/.cabal/store/$compiler/... I'd suggest we switch the default log location to ~/.cabal/logs/$compiler/$unitid.log as that would also avoid name-clashing for cases where the hash was left off for ghc boot packages, as well as allow to delete old logs for a specific compiler version more conveniently.


This comment has been minimized.

Copy link

ezyang commented Sep 8, 2016

We already have the poorly named $libname which outputs the unit id. So it's more a matter of changing the default log locations. @hvr, do you want to try changing the default?

@ezyang ezyang changed the title Add support for and use full pkg-id in default build-log filename template Use full $libname in default build-log filename template Sep 8, 2016

hvr added a commit to hvr/cabal that referenced this issue Sep 8, 2016

Change default logfile template to use more unique name
Specifically, this changes the default from `.../$pkgid.log`
to `.../$compiler/$libname.log`, which avoids logfiles overwriting
each other even though theyty refer to different artifacts, as well
as aligning the format with `~/.cabal/store`'s structure.

This addresses haskell#3807

@ezyang ezyang added this to the 2.0 milestone Sep 8, 2016

@hvr hvr closed this Sep 10, 2016

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