Skip to content
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

Using allow-newer-deps without allow-newer is a confusing experience #6086

Closed
pbrisbin opened this issue Apr 5, 2023 · 4 comments
Closed

Comments

@pbrisbin
Copy link
Contributor

pbrisbin commented Apr 5, 2023

General summary/comments (optional)

I was compiling a package that needed to relax some upper bounds. I had set allow-newer-deps but didn't set allow-newer. I know this is required as per documentation, and it failed in an expected way, but the messaging is confusing:

WARNING: Ignoring hoauth2's bounds on memory (^>=0.17); using memory-0.18.0.
Reason: allow-newer-deps are specified but allow-newer isn't enabled.
WARNING: Ignoring hoauth2's bounds on text (>=0.11 && <1.3); using text-2.0.1.
Reason: allow-newer-deps are specified but allow-newer isn't enabled.

Error: [S-4804]
       Stack failed to construct a build plan.

       While constructing the build plan, Stack encountered the following errors:

       In the dependencies for hoauth2-2.7.0:
           memory-0.18.0 from Stack configuration does not match ^>=0.17 (latest matching version is
                         0.17.0)
           text-2.0.1 from Stack configuration does not match >=0.11 && <1.3 (latest matching
                      version is 1.2.5.0)
       needed due to yesod-auth-oauth2-0.7.0.3 -> hoauth2-2.7.0

       Some different approaches to resolving this:

         * Set 'allow-newer: true'
           in /home/patrick/.stack/config.yaml to ignore all version constraints and build anyway.

         * Recommended action: try adding the following to your extra-deps
           in /home/patrick/code/freckle/yesod-auth-oauth2/stack-nightly.yaml:

       - memory-0.17.0@sha256:ebbd89ead51a2d80176ed2f842d4f7d8d7ac41843783aa429527fc69c471cbbf,4619
       - text-1.2.5.0@sha256:791f0f6c97ed96113f17ab520cf0efe1a3a4f883a8c85910a5660567c8241c40,7895

You'll notice:

WARNING: Ignoring hoauth2's bounds on memory (^>=0.17); using memory-0.18.0.

This is not true, it's not going to do this. If it did, it would not fail.

Reason: allow-newer-deps are specified but allow-newer isn't enabled.

That's true, and is the information I needed, but it's not the "reason" for the "warning", right?

I think this case should instead look something like this:

WARNING: Ignoring allow-newer-deps because allow-newer isn't enabled

Error: [S-4804]
       Stack failed to construct a build plan.

       While constructing the build plan, Stack encountered the following errors:

       In the dependencies for hoauth2-2.7.0:
           memory-0.18.0 from Stack configuration does not match ^>=0.17 (latest matching version is
                         0.17.0)
           text-2.0.1 from Stack configuration does not match >=0.11 && <1.3 (latest matching
                      version is 1.2.5.0)
       needed due to yesod-auth-oauth2-0.7.0.3 -> hoauth2-2.7.0

       Some different approaches to resolving this:

         * Set 'allow-newer: true'
           in /home/patrick/.stack/config.yaml to ignore all version constraints and build anyway.

         * Recommended action: try adding the following to your extra-deps
           in /home/patrick/code/freckle/yesod-auth-oauth2/stack-nightly.yaml:

       - memory-0.17.0@sha256:ebbd89ead51a2d80176ed2f842d4f7d8d7ac41843783aa429527fc69c471cbbf,4619
       - text-1.2.5.0@sha256:791f0f6c97ed96113f17ab520cf0efe1a3a4f883a8c85910a5660567c8241c40,7895

Steps to reproduce

I can put together a reproduction if necessary, but I think my description above should be sufficient.

  1. Have package that needs allow-newer to compile
  2. Add allower-newer-deps, but not allow-newer
  3. Observe error message

Expected

A warning saying dependency bounds are NOT being ignored because allow-newer-deps is present but allow-newer is not specified.

Actual

A warning saying dependency bounds ARE being ignored because allow-newer-deps is present but allow-newer is not specified.

Stack version

stack --version
Version 2.9.3, Git revision 6cf638947a863f49857f9cfbf72a38a48b183e7e x86_64 hpack-0.35.1

Method of installation

  • Official binary, downloaded via haskellstack.org or from Stack's repository
  • Via GHCup
  • Via Cabal (the tool)
  • An unofficial package repository (please specify which)
  • Other (please specify)

Platform

Your platform (machine architecture and operating system)

@mpilgrem
Copy link
Member

mpilgrem commented Apr 6, 2023

@pbrisbin , thanks for reporting. The documentation certainly implies that allow-newer-deps should have 'no effect' if allow-newer is false. So that I have a benchmark for what 'no effect' should look like, what is actually reported for your example if allow-newer-deps is not set and allow-newer is false?

@mpilgrem
Copy link
Member

mpilgrem commented Apr 6, 2023

So, if I build hoauth2-2.7.-0 with Stack using snapshot nightly-2023-04-05, the output I get is:

Error: [S-4804]
       Stack failed to construct a build plan.

       While constructing the build plan, Stack encountered the following errors:

       In the dependencies for hoauth2-2.7.0:
           memory-0.18.0 from Stack configuration does not match ^>=0.17 (latest matching version is 0.17.0)
           text-2.0.1 from Stack configuration does not match >=0.11 && <1.3 (latest matching version is 1.2.5.0)
       needed since hoauth2 is a build target.

       Some different approaches to resolving this:

         * Set 'allow-newer: true' in C:\sr\config.yaml to ignore all version constraints and build anyway.

         * Recommended action: try adding the following to your extra-deps
           in D:\Users\mike\Code\Haskell\hoauth2-2.7.0\stack.yaml:

       - memory-0.17.0@sha256:ebbd89ead51a2d80176ed2f842d4f7d8d7ac41843783aa429527fc69c471cbbf,4619
       - text-1.2.5.0@sha256:791f0f6c97ed96113f17ab520cf0efe1a3a4f883a8c85910a5660567c8241c40,7895

So, I confirm that the two WARNINGs are not consistent with the documentation.

@pbrisbin
Copy link
Contributor Author

pbrisbin commented Apr 6, 2023

what is actually reported for your example if allow-newer-deps is not set and allow-newer is false?

Looks like you've already got it, but it's just the same exact error (which is not surprising the behavior's no different) but without the warning preamble.


Error: [S-4804]
       Stack failed to construct a build plan.

       While constructing the build plan, Stack encountered the following errors:

       In the dependencies for hoauth2-2.7.0:
           memory-0.18.0 from Stack configuration does not match ^>=0.17 (latest matching version is
                         0.17.0)
           text-2.0.1 from Stack configuration does not match >=0.11 && <1.3 (latest matching
                      version is 1.2.5.0)
       needed due to yesod-auth-oauth2-0.7.0.3 -> hoauth2-2.7.0

       Some different approaches to resolving this:

         * Set 'allow-newer: true'
           in /home/patrick/.stack/config.yaml to ignore all version constraints and build anyway.

         * Recommended action: try adding the following to your extra-deps
           in /home/patrick/code/freckle/yesod-auth-oauth2/stack-nightly.yaml:

       - memory-0.17.0@sha256:ebbd89ead51a2d80176ed2f842d4f7d8d7ac41843783aa429527fc69c471cbbf,4619
       - text-1.2.5.0@sha256:791f0f6c97ed96113f17ab520cf0efe1a3a4f883a8c85910a5660567c8241c40,7895

@mpilgrem
Copy link
Member

mpilgrem commented Apr 6, 2023

@pbrisbin, I've identifed the problem and I have a pull request that is intended to fix it.

@mpilgrem mpilgrem self-assigned this Apr 6, 2023
mpilgrem added a commit that referenced this issue Apr 6, 2023
Fix #6086 Correct warning when allow-newer-deps but allow-newer is false
mpilgrem added a commit that referenced this issue Apr 8, 2023
mpilgrem added a commit that referenced this issue Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants