Skip to content

Snapshot "import" cycle not detected #6927

@philderbeast

Description

@philderbeast

Using a snapshot field in a stack.yaml project is a bit like an import isn't it but with some restrictions. If there is a cycle between these imports then Stack hangs or overflows the stack with the build, clean and purge commands.

Steps to reproduce

It was hanging but here I set the stack size to show the overflow:

$ cat stack.yaml
snapshot: stack.fwd.yaml
packages: [.]

$ cat stack.fwd.yaml
snapshot: stack.bwd.yaml

$ cat stack.bwd.yaml
snapshot: stack.fwd.yaml

$ GHCRTS='-K1m' stack build
         
stack: Stack space overflow: current size 33608 bytes.
stack: Use `+RTS -Ksize -RTS' to increase it.

$ GHCRTS='-K1m' stack clean
stack: Stack space overflow: current size 33608 bytes.
stack: Use `+RTS -Ksize -RTS' to increase it.

GHCRTS='-K1m' stack purge
stack: Stack space overflow: current size 33608 bytes.
stack: Use `+RTS -Ksize -RTS' to increase it.

Note

Found while testing well-typed/haskell-debugger#322.
That project builds with GHCRTS='-K1m' stack build.

Expected

The snapshot import cycle is detected and stopped.

Stack version

Also happens with 3.9.3.

$ stack --version
Version 3.12.0, Git revision 971deb7280f2007d15f2e86f97a979fa22506deb (11752 commits) PRE-RELEASE x86_64

Method of installation

  • Via GHCup for 3.9.3

Platform

Ubuntu 25.10

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions