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

Use $0/../share/… as a default search path for --data-dir [feature request] #6143

Closed
sjackman opened this issue Feb 14, 2020 · 2 comments
Closed

Comments

@sjackman
Copy link

When Pandoc is moved after installation, it would be really helpful for Pandoc to search $(realpath $0)/../share/… for its data directory (where $0 is argv[0]). My motivating use case is when installing a binary Pandoc package in my home directory using the Homebrew for Linux package manager. The workaround of creating a ~/.pandoc symlink is pretty straight forward, but it would be fantastic if it worked out of the box. Compiling Pandoc from source also works, but it's much faster to use a binary package.

$ brew install --force-bottle pandoc
$ pandoc -o foo.html foo.md
Could not find data file /home/linuxbrew/.linuxbrew/Cellar/pandoc/2.9.1.1/share/x86_64-linux-ghc-8.8.1/pandoc-2.9.1.1/data/abbreviations
$ ln -s ~/.linuxbrew/Cellar/pandoc/2.9.1.1/share/x86_64-linux-ghc-8.8.1/pandoc-2.9.1.1/data ~/.pandoc
$ pandoc -o foo.html foo.md
# Success!
@jgm
Copy link
Owner

jgm commented Feb 15, 2020

This is a problem with the way homebrew is building pandoc. It should use the embed_data_files flag so that the data files are baked in. (Background: in the old days cabal had nice support for installing data files to the right place, and pandoc could find them, but this is broken in stack. See commercialhaskell/stack#848. Embedding the data files fixes the problem.)
I would suggest reporting this to homebrew.

I don't want to implement your suggestion; it strikes me as potential a security risk.

@jgm jgm closed this as completed Feb 15, 2020
sjackman added a commit to Homebrew/homebrew-core that referenced this issue Feb 15, 2020
> embed_data_files: embed all data files into the binary (default no).
This is helpful if you want to create a relocatable binary.

See https://pandoc.org/installing.html#custom-cabal-method
and jgm/pandoc#6143
@sjackman
Copy link
Author

That's very helpful! Thank you, John.

sjackman added a commit to Homebrew/homebrew-core that referenced this issue Feb 15, 2020
> embed_data_files: embed all data files into the binary (default no).
This is helpful if you want to create a relocatable binary.

See https://pandoc.org/installing.html#custom-cabal-method
and jgm/pandoc#6143

Closes #50292.

Signed-off-by: Shaun Jackman <sjackman@gmail.com>
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

2 participants