FS#74800 - [haskell-lens] registration script involves an escape character breaking the script in dash

Attached to Project: Community Packages
Opened by Nils Trubkin (zeraoo) - Thursday, 19 May 2022, 19:00 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:03 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

(Edit: typos fixed as per comment 1)

Description:
The package does not install (register) correctly if the /bin/sh is linked to dash instead of bash.
The error message only mentions that registration failed like so:

(2/2) Registering Haskell modules...
error: command failed to execute correctly

The error originates from the /usr/share/haskell/register/haskell-lens.sh script.
In the haskell-lens.sh line 70 column 33 there is a "documentation/comment" piece that involves a lambda (as Haskell sees it) or an escape symbol \ as dash sees it.

Here is the entire line that is causing the issue (the 'a' in the fmap lambda is escaped):
> bar f (Foo a b c) = fmap (\a'\'' -> Foo a'\'' b c) (f a)

Here is the same line without the illegal character:
> bar f (Foo a b c) = fmap (a'\'' -> Foo a'\'' b c) (f a)

Running this script gives an error below:

Reading package info from stdin ... ghc-pkg: "the input" (line 68, column 5):
unexpected character in input '\a'
expecting field or section name or end of file

To fix this, the user should do one of the following:
(1) change shebang to #!/bin/bash
(2) run script as bash haskell-lens.sh
(3) remove the escape character at position (70, 33)

Additional info:
haskell-lens-5.1-37-x86_64

Steps to reproduce:
rm /bin/sh
ln -s dash /bin/sh
pacman -Suy haskell-lens

This is my first bug report, and took me many hours to get to the bottom of.
Let me know if I've incorrectly reported it or if this is considered as an upstream issue, thanks.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:03 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/haskell-lens/issues/1
Comment by Nils Trubkin (zeraoo) - Thursday, 19 May 2022, 19:33 GMT
typos fixes:
(1) change shebang to #!/bin/bash
The package does not install (register) correctly [IF] the...

Loading...