Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 800177 - app-emacs/helm: emacs-helm.sh is installed but is non-functional
Summary: app-emacs/helm: emacs-helm.sh is installed but is non-functional
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: GNU Emacs project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-03 13:14 UTC by akater
Modified: 2021-07-04 12:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
app-emacs/helm: Fix path of autoloads file in emacs-helm.sh (0001-app-emacs-helm-Fix-path-of-autoloads-file-in-emacs-h.patch,2.45 KB, patch)
2021-07-03 17:21 UTC, Ulrich Müller
Details | Diff
app-emacs/helm: Don't check for autoload file in emacs-helm.sh (0001-app-emacs-helm-Don-t-check-for-autoload-file-in-emac.patch,2.50 KB, patch)
2021-07-04 10:28 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description akater 2021-07-03 13:14:08 UTC
Upstream bug report instructions for app-emacs/helm recommend to use the sandboxed environment for reporducing bugs.  The environment is recognized in the ebuild, namely, in helm-3.6.0.ebuild, src_install is defined as

src_install() {
	elisp_src_install
	exeinto "${SITEETC}/${PN}"
	doexe emacs-helm.sh
}

To report Helm bugs, users are supposed to (and I quote):

> When possible, use [emacs-helm.sh] to reproduce your Helm issue to ensure no other package is
interfering.

> To run it, simply switch to the directory where Helm is installed and call ./emacs-helm.sh.
If necessary you can specify emacs executable path on command line with "-P" option.

Currently, emacs-helm.sh expects to find helm-autoloads.el file in the current directory.  Ebuild installs it into "${SITEETC}/${PN}", it fails to find helm-autoloads and exits with unhelpful message

> No autoloads found, please run make first to generate autoload file

even though the autolad file acutally is generated by the ebuild and is simply not installed so that emacs-helm.sh could find it.

Relevant excerpt from emacs-helm.sh:

# Check if autoload file exists.
# It may be in a different directory if emacs-helm.sh is a symlink.
TRUENAME=$(ls -l "$0" | awk '{print $11}')
if [ ! -z "$TRUENAME" ]; then
    AUTO_FILE="${TRUENAME%/*}/helm-autoloads.el"
else
    AUTO_FILE="helm-autoloads.el"
fi
if [ ! -e "$AUTO_FILE" ]; then
    echo No autoloads found, please run make first to generate autoload file
    exit 1
fi

I use custom ebuild for helm.  My src_install is

src_install() {
	elisp_src_install
	exeinto "${SITEETC}/${PN}"
	doexe emacs-helm.sh
	dosym "${SITELISP}/${PN}"/helm-autoloads.el \
		  "${SITEETC}/${PN}"/helm-autoloads.el
	dosym "${SITEETC}/${PN}"/emacs-helm.sh /usr/bin/emacs-helm.sh
}

which wight not be the recommended vay to to do this but it does allow to run emacs-helm.sh without issues and reproduce bugs.

One alternative would be to install emacs-helm.sh into elisp directory.

Upstream has separate instructions for users of straight.el, I think if we go the /usr/bin way, it would not be a problem to add “On Gentoo, simply run the command `emacs-helm.sh` in the terminal” there.  We could also emit a similar message when emerging helm.


Reproducible: Always

Steps to Reproduce:
1. Find emacs-helm (non-trivial already!)
2. Run emacs-helm, see it not working
Actual Results:  
helm-autoloads not found

Expected Results:  
Emacs with predefined helm environment running
Comment 1 akater 2021-07-03 13:20:28 UTC
It will be true at least for helm-3.8.0 but it might not be true for helm-3.6.0 which is currently the latest in the tree so I changed the importance to “enhancement”.
Comment 2 akater 2021-07-03 13:31:36 UTC
No, unfortunately it's broken in 3.6.0 proper, sorry for the confusion.
Comment 3 Ulrich Müller gentoo-dev 2021-07-03 17:21:18 UTC
Created attachment 721267 [details, diff]
app-emacs/helm: Fix path of autoloads file in emacs-helm.sh

Please test if attached patch fixes the problem.
Comment 4 akater 2021-07-04 09:36:21 UTC
The emacs-helm.sh script does start now but

• How is user supposed to find it?

• Why is altering the script preferrable to creating symlinks?  I'd like to understand Gentoo's best practices.
Comment 5 Ulrich Müller gentoo-dev 2021-07-04 10:28:35 UTC
Created attachment 721642 [details, diff]
app-emacs/helm: Don't check for autoload file in emacs-helm.sh

We can install the script in /usr/bin if you prefer.

About modifying the script, IMHO a better way to do that check would be with locate-library in the elisp code (helm-cfg.el), which would search the load-path. Using find to sniff around in some random locations doesn't make much sense IMHO, and I won't add symlinks to work around the resulting breakage. Besides, placing a symlink to an elisp file in /usr/bin is out of the question (and the same reasoning applies to ${SITEETC}).

Thinking about it, for the Gentoo pacakge it may be easier to remove that test altogether, because the AUTO_FILE variable isn't even used, and it's guaranteed that the autoloads file is installed.

Updated patch is attached.
Comment 6 akater 2021-07-04 11:14:49 UTC
This is much better, I'll use that.  Thank you.
Comment 7 Larry the Git Cow gentoo-dev 2021-07-04 12:46:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1162299d4546ec32ef26bf78816989761b591f4c

commit 1162299d4546ec32ef26bf78816989761b591f4c
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-07-03 17:16:15 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-07-04 12:39:25 +0000

    app-emacs/helm: Don't check for autoload file in emacs-helm.sh
    
    Closes: https://bugs.gentoo.org/800177
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 .../helm/files/helm-3.6.0-no-autoload-check.patch  | 24 ++++++++++++++++++++++
 .../{helm-3.6.0.ebuild => helm-3.6.0-r1.ebuild}    |  6 +++---
 2 files changed, 27 insertions(+), 3 deletions(-)