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

gitit seems to refer to default.conf #622

Open
chrisSCM opened this issue Aug 19, 2018 · 3 comments
Open

gitit seems to refer to default.conf #622

chrisSCM opened this issue Aug 19, 2018 · 3 comments

Comments

@chrisSCM
Copy link

When starting gitit with a non-privileged user, I find that despite using "-f" with a specific config file, gitit still refers to the default.conf. Of course, the non-privileged user doesn't have the right to access the build directory and its contents.
The error is:
gitit: /root/gitit/.stack-work/install/x86_64-linux/lts-12.4/8.4.3/share/x86_64-linux-ghc-8.4.3/gitit-0.12.2.1/data/default.conf: openFile: permission denied (Permission denied)
The command was:
sudo -u gitit /var/local/wiki/startup.sh
with startup.sh containing:
/usr/local/bin/gitit -f wiki.conf
and being located in the wiki folder.

@jgm
Copy link
Owner

jgm commented Aug 19, 2018 via email

Rufflewind added a commit to Rufflewind/aur-packages that referenced this issue Nov 17, 2020
Relocatable data files are still not supported in Stack, and there are
no per-package workarounds in Gitit or its dependencies other than
Pandoc's embed_data_files flag. Therefore, I will continue the existing
approach of using Cabal with frozen deps instead of Stack.

jgm/gitit#622
haskell/cabal#462
commercialhaskell/stack#848
@bfrk
Copy link

bfrk commented May 30, 2024

This can be a problem even when you install with cabal. I used cabal install and then copied the binary to the actual install location (as root). Months later I nuked my cabal store and now gitit won't start. Earlier versions of cabal had options like --datadir similar to the Unix-style configure scripts. This was, I believe, thrown out in order to make build results reproducible. (Which could have been achieved as well by factoring user inputs like the value of --datadir into the binary hash, no idea why they didn't do that.) While cabal build still has the --datadir option, be prepared for surprises: with --datadir=/tmp/gitit/data I get

datadir    = "/tmp/gitit/data/x86_64-linux-ghc-8.6.5/gitit-0.15.1.2"

To summarize, there are two solutions:

  1. Use cabal install gitit, copy the data directory from the cabal store to somewhere else on the system and then run gitit with gitit_datadir=/whatever/path/ in the environment.
  2. Get the sources (from github or via cabal get), run cabal build --datadir=/path/to/data, look for a file named Paths_gitit.hs under dist-newstyle and in there for the definition of datadir, then manually copy binaries and data files to the appropriate locations found in the Paths_gitit.hs module.

It would be nice if you could document this in the installation instructions.

@jgm
Copy link
Owner

jgm commented May 30, 2024

A better solution, I think, would be to add an embed_data_files flag like we have on pandoc; then the data files would be in the binary and we wouldn't need to worry about finding them.

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

No branches or pull requests

3 participants