Skip to content

Haddock links to types in other packages are broken #1231

Closed

Description

@massysett

When I build Haddocks, the links to types from other packages are broken.

Steps to replicate:

  1. wget https://github.com/massysett/penny/archive/stack-haddock-bug.tar.gz
  2. tar xf stack-haddock-bug.tar.gz
  3. cd penny-stack-haddock-bug
  4. ./buildprep
  5. cd package
  6. stack build --haddock --haddock-deps
  7. open .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc/html/penny/index.html
  8. Click on "Penny.Commodity", then "Text"

I get a 404. Links work to other types in the same package, but all links to types in other packages are broken. I believe this used to work with older versions of stack.

Output from stack --version:

Version 0.1.6.0, Git revision e22271f (2313 commits) x86_64

Activity

  1. snoyberg commented on Oct 25, 2015

    @snoyberg
    Contributor

    I think I saw that this was just fixed on master. Can you try upgrading and
    see if the behavior is corrected?

    On Sun, Oct 25, 2015 at 6:37 PM, Omari Norman notifications@github.com
    wrote:

    When I build Haddock, the links to types from other packages are broken.

    Steps to replicate:

    wget
    https://github.com/massysett/penny/archive/stack-haddock-bug.tar.gz
    2.

    cd penny-stack-haddock-bug
    3.

    ./buildprep
    4.

    cd package
    5.

    stack build --haddock --haddock-deps
    6.

    open
    .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc/html/penny/index.html
    7.

    Click on "Penny.Commodity", then "Text"

    I get a 404. Links work to other types in the same package, but all links
    to types in other packages are broken. I believe this used to work with
    older versions of stack.

    Output from stack --version:

    Version 0.1.6.0, Git revision e22271f
    e22271f
    (2313 commits) x86_64

    —
    Reply to this email directly or view it on GitHub
    #1231.

  2. massysett commented on Oct 25, 2015

    @massysett
    ContributorAuthor

    Unfortunately I'm getting the same behavior on master. Output from stack --version:

    Version 0.1.7.0, Git revision b6c5233 (2413 commits) x86_64

  3. massysett commented on Oct 26, 2015

    @massysett
    ContributorAuthor

    After looking at issue #1105 I see a few things that aren't working:

    1. The Haddock HTML links to other packages in the package's .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc directory are still pointing at the .stack-work directory, when they need to be pointing at the .stack/snapshots directory.
    2. The Haddock index.html in my ~/.stack/snapshots/x86_64-osx/nightly-2015-09-21/7.10.2/doc directory has no links to the Data.Text modules or to many other modules that are part of that snapshot. It appears there are no links to packages that were originally installed as part of other snapshots and that are being linked to from this snapshot.
  4. massysett commented on Oct 26, 2015

    @massysett
    ContributorAuthor

    Because this bug seems to depend on what other snapshots are installed, it may not replicate on different systems.

  5. added this to the P1: Must milestone on Oct 26, 2015
  6. self-assigned this
    on Oct 26, 2015
  7. borsboom commented on Nov 8, 2015

    @borsboom
    Contributor

    @massysett: I haven't been able to reproduce your exact issue, but in the process of trying I did come across other problems with haddocks for packages that were copied from another snapshot. I've overhauled the way haddocks for dependencies are found and then put where they belong, and I don't think the issue you're describing should happen anymore. Can you try the latest master, and close this issue if it is resolved for you?

    @massysett said:

    The Haddock HTML links to other packages in the package's .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc directory are still pointing at the .stack-work directory, when they need to be pointing at the .stack/snapshots directory.

    This is actually expected. All links in the HTML are relative to make it easy to copy the haddocks elsewhere (e.g. to a web server) and have all the inter-package links continue to work. What was broken is that the haddocks for dependencies were not copied to .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc properly.

  8. massysett commented on Nov 9, 2015

    @massysett
    ContributorAuthor

    After doing stack build --haddock --haddock-deps I have only the Haddocks for my project in .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc. None of the other dependencies are in there. Links to other packages in the Haddocks for my project are broken; I've got a link to Text that points to something in a Turtle directory in .stack-work. My index.html in /Users/massysett/unix/penny/.stack-work/install/x86_64-osx/nightly-2015-11-08/7.10.2/doc/all/index.html also is not fully populated with all packages. This is with stack from Git 7019ed3.

    I made a tarball of my project directory with the Haddocks and put it here:

    https://drive.google.com/file/d/0B2jkntipVFPZOEZ5clQ5S2tOdFk/view?usp=sharing

    I will try nuking my ~/.stack directory and trying again.

  9. massysett commented on Nov 9, 2015

    @massysett
    ContributorAuthor

    Nuking the ~/.stack directory and rerunning stack build --haddock --haddock-deps improves the quality of /Users/massysett/unix/penny/.stack-work/install/x86_64-osx/nightly-2015-11-08/7.10.2/doc/all/index.html but none of the hyperlinks to types to other packages in .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/doc/html/penny/index.html are working.

  10. massysett commented on Nov 9, 2015

    @massysett
    ContributorAuthor

    I'm on Mac OS X El Capitan if that makes any difference.

  11. borsboom commented on Nov 12, 2015

    @borsboom
    Contributor

    Based on what I see in your tarball, this looks like the same problem reported in #1317. When I run stack haddock in there, the files end up in the right places (I'm on Yosemite).

  12. borsboom commented on Nov 19, 2015

    @borsboom
    Contributor

    I've pushed a fix for #1317. Can you try the latest master and close this
    issue if that fixes it?

    On Sun, Nov 8, 2015 at 8:00 PM Omari Norman notifications@github.com
    wrote:

    I'm on Mac OS X El Capitan if that makes any difference.

    —
    Reply to this email directly or view it on GitHub
    #1231 (comment)
    .

  13. massysett commented on Nov 19, 2015

    @massysett
    ContributorAuthor

    It's working great with the latest master, thanks!

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions