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
14 changes: 8 additions & 6 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ Other enhancements:

Bug fixes:

* `stack test --no-rerun-tests` correctly skips test suites that have
previously been built and run successfully, including for non-Backpack
* `stack test --no-rerun-tests` correctly skips test suites that have
previously been built and run successfully, including for non-Backpack
packages built by the per-component planner.
* Stack's per-component build planner correctly handles the cross-package
test/library cycle shape from issue #6905: project package A's library
depending on project package B's library, with B's test suite depending on A,
* Stack's per-component build planner correctly handles the cross-package
test/library cycle shape from issue #6905: project package A's library
depending on project package B's library, with B's test suite depending on A,
builds in the right order with the right configure flags.

* If snapshot locations are cyclic, Stack reports an error rather than going
round in circles.

## v3.11.1 - 2026-06-13

**Changes since v3.9.3:**
Expand Down
2 changes: 1 addition & 1 deletion cabal.config
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ constraints:
, optparse-applicative ==0.18.1.0
, optparse-simple ==0.1.1.4
, os-string ==2.0.7
, pantry ==0.11.3
, pantry ==0.11.4
, parsec ==3.1.18.0
, parser-combinators ==1.3.1
, path ==0.9.6
Expand Down
6 changes: 3 additions & 3 deletions doc/topics/custom_snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ has changed by hashing the contents of the involved files, and using it to
identify the snapshot internally. It is often reasonably efficient to modify a
custom snapshot, due to Stack sharing snapshot packages whenever possible.

!!! warning "Cyclic snapshot locations"
!!! note "Cyclic snapshot locations"

If snapshot locations form a cycle, Stack will not detect this but will go
round in circles and appear to hang.
If Stack detects that snapshot locations form a cycle, it will report an
error.

### Overriding the compiler

Expand Down
6 changes: 3 additions & 3 deletions doc/topics/snapshot_location.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ There are four ways to specify a snapshot location:

This allows local file paths and covenience synonyms to be disambiguated.

!!! warning "Cyclic snapshot locations"
!!! note "Cyclic snapshot locations"

If snapshot locations form a cycle, Stack will not detect this but will go
round in circles and appear to hang.
If Stack detects that snapshot locations form a cycle, it will report an
error.

## At the command line

Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dependencies:
- neat-interpolation
- open-browser
- optparse-applicative >= 0.18.1.0
- pantry >= 0.11.3
- pantry >= 0.11.4
- path >= 0.9.5
- path-io
# In order for Cabal (the tool) to build Stack, it needs to be told of the
Expand Down
8 changes: 4 additions & 4 deletions stack.cabal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ extra-deps:
# lts-24.43 specifies open-browser-0.4.0.0
- open-browser-0.5.1.0@sha256:0dc8dc33b9bba0e025e444355f6c2d806f62a4656446961c3647165f80f0d278,1959
# lts-24.43 specifies pantry-0.10.1
- pantry-0.11.3@sha256:96fa2c7fa6cee9e470f984da567492f6bfaee058d14c1456f4f79b68a78d7be2,7668
# We refer to the pull request at the pantry repository while testing Stack:
- github: commercialhaskell/pantry
commit: 7eae6adc4583f1cedb33f115a6396dfa78b57bb9
# lts-24.43 specifies persistent-2.17.1.0
- persistent-2.18.1.0@sha256:6a111b26c3e710f1e080a7543cf93766c4cc53ac560dbaa0d4b7ddc98a2f7b1d,7096
# lts-24.43 excludes ram
Expand Down
12 changes: 8 additions & 4 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ packages:
original:
hackage: open-browser-0.5.1.0@sha256:0dc8dc33b9bba0e025e444355f6c2d806f62a4656446961c3647165f80f0d278,1959
- completed:
hackage: pantry-0.11.3@sha256:96fa2c7fa6cee9e470f984da567492f6bfaee058d14c1456f4f79b68a78d7be2,7668
name: pantry
pantry-tree:
sha256: bedd749e9cfdb8adb1a253b34a3350aa89f5ca903aa341579351ce0a937af1f5
size: 2722
sha256: e9326d0cbb8e33197d4008bcedb61061b39ab820562cdbcb4bd07216af1a556f
size: 3763
sha256: c41520e493e14baef2bdf14b529be1c13c3ee2a7055adffa3f1fbd8139d6d59f
size: 116083
url: https://github.com/commercialhaskell/pantry/archive/7eae6adc4583f1cedb33f115a6396dfa78b57bb9.tar.gz
version: 0.11.4
original:
hackage: pantry-0.11.3@sha256:96fa2c7fa6cee9e470f984da567492f6bfaee058d14c1456f4f79b68a78d7be2,7668
url: https://github.com/commercialhaskell/pantry/archive/7eae6adc4583f1cedb33f115a6396dfa78b57bb9.tar.gz
- completed:
hackage: persistent-2.18.1.0@sha256:6a111b26c3e710f1e080a7543cf93766c4cc53ac560dbaa0d4b7ddc98a2f7b1d,7096
pantry-tree:
Expand Down
32 changes: 32 additions & 0 deletions tests/integration/tests/6927-cyclic-snapshots/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- | Stack detects when snapshot locations form a cycle and reports an error.
--
-- See: https://github.com/commercialhaskell/stack/issues/6927

import Control.Monad ( unless )
import Data.List ( isInfixOf )
import StackTest

main :: IO ()
main = do
-- `stack build` makes use of pantry's loadAndCompleteSnapshotRaw':
stackErrStderr
["--stack-yaml", "stack1.yaml", "build"]
(expectMessage cycleDetected)
stackErrStderr
["--stack-yaml", "stack2.yaml", "build"]
(expectMessage cycleDetected)
-- `stack --snapshot <snapshot> list` makes use of pantry's loadSnapshot:
stackErrStderr
["--snapshot", "my-snapshot.yaml", "list", "base"]
(expectMessage cycleDetected)
stackErrStderr
["--snapshot", "my-snapshot1.yaml", "list", "base"]
(expectMessage cycleDetected)

cycleDetected :: String
cycleDetected = "Cycle detected while reading snapshot."

expectMessage :: String -> String -> IO ()
expectMessage msg stderr =
unless (words msg `isInfixOf` words stderr) $
error $ "Expected:\n\n" <> msg <> "\n\nin stderr, got:\n\n" <> stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
myPackage.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: my-snapshot

# In error, refers to itself:
snapshot: my-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: my-snapshot1

snapshot: my-snapshot2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: my-snapshot2

snapshot: my-snapshot3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: my-snapshot3

# In error, refers to my-snapshot1, creating a cycle:
snapshot: my-snapshot4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: my-snapshot4

# In error, refers to my-snapshot2, creating a cycle:
snapshot: my-snapshot2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
spec-version: 0.36.0

name: myPackage

dependencies:
- base

library:
source-dirs: src
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Lib where
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
snapshot: my-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
snapshot: my-snapshot1.yaml
Loading