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

Comments

@pbrisbin
Copy link

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

I believe I've fixed this in #4974

pbrisbin added a commit to restyled-io/restyler that referenced this issue Aug 2, 2019
borsboom added a commit that referenced this issue Sep 20, 2019
…tive-links

Haddock use relative paths in output (fixed #4971)
@borsboom borsboom closed this in c83934f Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.