Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1942237

Summary: hakyll-init fails to create example site
Product: [Fedora] Fedora Reporter: Martin B. <martin.bukatovic>
Component: ghc-hakyllAssignee: Jens Petersen <petersen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 33CC: petersen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ghc-hakyll-4.13.4.0-5.fc34 ghc-hakyll-4.13.4.0-5.fc33 ghc-hakyll-4.13.4.0-5.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-30 00:16:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin B. 2021-03-23 22:36:08 UTC
Description of problem
======================

Cli tool `hakyll-init` fails to create example site, as explained in
Building the example site[1] (upstream documentation).

[1] https://jaspervdj.be/hakyll/tutorials/01-installation.html

Version-Release number of selected component
============================================

```
# rpm -qa | grep hakyll
ghc-hakyll-4.13.4.0-3.fc33.x86_64
ghc-hakyll-doc-4.13.4.0-3.fc33.noarch
ghc-hakyll-devel-4.13.4.0-3.fc33.x86_64
```

How reproducible
================

100%

Steps to Reproduce
==================

1. mkdir my-example
2. hakyll-init my-example
3. ls my-example

Actual results
==============

The tool doesn't create an example site, it only creates a cabal file:

```
$ hakyll-init my-example
Creating my-example/my-example.cabal
$ ls my-example/
my-example.cabal
```

Expected results
================

All files for the hakyll example site are present in the my-example dir.

See eg. files created by hakyll-init when installed via stack:

```
$ stack exec hakyll-init -- -f .
Creating ./about.rst
Creating ./templates/default.html
Creating ./templates/post-list.html
Creating ./templates/post.html
Creating ./templates/archive.html
Creating ./contact.markdown
Creating ./css/default.css
Creating ./images/haskell-logo.png
Creating ./site.hs
Creating ./index.html
Creating ./posts/2015-11-28-carpe-diem.markdown
Creating ./posts/2015-12-07-tu-quoque.markdown
Creating ./posts/2015-08-12-spqr.markdown
Creating ./posts/2015-10-07-rosa-rosa-rosam.markdown
Creating ./hakyll-tutorial.cabal
```

Additional info
===============

I'm not sure if hakyll-init is expected to work in the rpm package.

Related problem is that hakyll-init fails to create my-example directory if such directory doesn't exist:

```
$ hakyll-init my-example
Creating my-example/my-example.cabal
hakyll-init: my-example/my-example.cabal: openFile: does not exist (No such file or directory)
```

Comment 1 Martin B. 2021-03-24 22:44:09 UTC
The example is actually packaged though:

```
$ ls -l /usr/share/doc/ghc-hakyll-devel/example
total 32
-rw-r--r--. 1 root root  724 Dec 19  2015 about.rst
-rw-r--r--. 1 root root  129 Dec 19  2015 contact.markdown
drwxr-xr-x. 2 root root 4096 Jan  9 17:57 css
drwxr-xr-x. 2 root root 4096 Jan  9 17:57 images
-rw-r--r--. 1 root root  352 Dec 19  2015 index.html
drwxr-xr-x. 2 root root 4096 Jan  9 17:57 posts
-rw-r--r--. 1 root root 2202 Feb 26  2020 site.hs
drwxr-xr-x. 2 root root 4096 Jan  9 17:57 templates
$ rpm -qf /usr/share/doc/ghc-hakyll-devel/example
ghc-hakyll-devel-4.13.4.0-3.fc33.x86_64
```

Comment 2 Martin B. 2021-03-24 23:07:10 UTC
Looking at output of `strace hakyll-init .`, I see that hakyll-init looks for the example file in /usr/share/hakyll-4.13.4.0/example directory:

```
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0                                    
stat("/usr/share/hakyll-4.13.4.0/example", 0x4200106a70) = -1 ENOENT (No such file or directory)
getcwd("/home/martin/tvorba/hakyll-tutorial", 4096) = 36 
```

And indeed if I symlink the example directory there:

```
# ls -l /usr/share/hakyll-4.13.4.0/example
lrwxrwxrwx. 1 root root 39 Mar 24 23:58 /usr/share/hakyll-4.13.4.0/example -> /usr/share/doc/ghc-hakyll-devel/example
```

hakyll-init starts to work:

```
$ hakyll-init .
Creating ./templates/post-list.html
Creating ./templates/post.html
Creating ./templates/default.html
Creating ./templates/archive.html
Creating ./index.html
Creating ./images/haskell-logo.png
Creating ./site.hs
Creating ./contact.markdown
Creating ./css/default.css
Creating ./about.rst
Creating ./posts/2015-10-07-rosa-rosa-rosam.markdown
Creating ./posts/2015-08-12-spqr.markdown
Creating ./posts/2015-11-28-carpe-diem.markdown
Creating ./posts/2015-12-07-tu-quoque.markdown
Creating ./hakyll-tutorial.cabal
```

So this bug could be solved either by packaging the example into expected location, or patching hakyll to look for the example files in the %doc dir instead.

The 1st option would be bit easier to do, the latter would requite bit tweaking, as hakyll-init searches for location of the example directory via cabal function getDataFileName.

Comment 3 Jens Petersen 2021-03-25 03:56:24 UTC
Thank you for reporting this.
I don't actually use hakyll myself - so it is helpful feedback.

Comment 4 Fedora Update System 2021-03-25 05:28:24 UTC
FEDORA-2021-fb5b8cf6f2 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-fb5b8cf6f2

Comment 5 Fedora Update System 2021-03-25 06:42:06 UTC
FEDORA-2021-dc750b96a0 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-dc750b96a0

Comment 6 Fedora Update System 2021-03-25 07:51:06 UTC
FEDORA-2021-e76664b72d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e76664b72d

Comment 7 Martin B. 2021-03-25 19:23:29 UTC
Thanks for the quick fix.

Comment 8 Fedora Update System 2021-03-26 01:10:48 UTC
FEDORA-2021-e76664b72d has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-e76664b72d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-e76664b72d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2021-03-26 01:34:07 UTC
FEDORA-2021-dc750b96a0 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-dc750b96a0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-dc750b96a0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Jens Petersen 2021-03-26 02:33:49 UTC
(In reply to Martin B. from comment #7)
> Thanks for the quick fix.

Thank you for testing

Comment 11 Fedora Update System 2021-03-26 18:33:32 UTC
FEDORA-2021-fb5b8cf6f2 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-fb5b8cf6f2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-fb5b8cf6f2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2021-03-30 00:16:04 UTC
FEDORA-2021-fb5b8cf6f2 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2021-04-03 00:47:49 UTC
FEDORA-2021-dc750b96a0 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2021-04-03 01:21:44 UTC
FEDORA-2021-e76664b72d has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.