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

Links with absolute paths in --haddock #4971

Closed
pbrisbin opened this issue Jul 22, 2019 · 2 comments
Closed

Links with absolute paths in --haddock #4971

pbrisbin opened this issue Jul 22, 2019 · 2 comments

Comments

@pbrisbin
Copy link
Contributor

@pbrisbin pbrisbin commented Jul 22, 2019

General summary/comments (optional)

Prior to stack-2, stack build --haddock would produce HTML files with relative links. This made it simple to (e.g.) aws s3 sync to serve the documentation, and also worked when viewing the files locally.

Since stack-2, I get absolute filesystem paths in all the links:

<a href="/home/patrick/code/project/.stack-work/.../doc/...">

This still works locally, but won't work when served.

I've looked through the documentation for Stack and Haddock (specifically --source-base and friends) but nothing I try will recover the old behavior.

My general question is, does anyone know how to get relative links back? For now, I'm resorting to seding them out before uploading.

CAVEAT: I'm only 90% sure this is a stack-2 thing. I don't refresh my documentation super frequently so it's possible it worked on an old resolver/GHC/haddock and is breaking on a newer one, but I believe it was the upgrade to stack-2 that did it. Apologies in advance if I'm incorrect. This has been confirmed below.

Steps to reproduce

  1. Have an S3 bucket as a website to serve documentation from

  2. Run something like:

    stack build --haddock
    aws s3 sync --acl public-read --delete \
      "$(stack path --local-doc-root)"/ \
      s3://{BUCKET}/{PREFIX}/

Expected

Links from the main S3 website should work (because they are relative).

Actual

Links do not work because they include /home/$USER/blah/blah in them.

Stack version

$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2

Method of installation

https://aur.archlinux.org/packages/stack-static/, which packages the official binary for Arch.

@borsboom
Copy link
Contributor

@borsboom borsboom commented Jul 22, 2019

I can confirm this is a difference in behaviour between stack-1.9.3 (got relative paths) and stack-2.1.3 (got absolute paths), using official binaries on macOS. It's definitely supposed to use relative paths for exactly the reason you articulate.

@borsboom
Copy link
Contributor

@borsboom borsboom commented Jul 23, 2019

I believe I've fixed this in #4974

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants