Package: dh-elpa
Version: 2.1.5
Severity: important

This is a follow-up of bug#1069210[1] and bug#1076964[2].  The
implementation of supporting sub-directories for elpa packages has
mostly been released in dh-elpa except for the `load-path' handling.
The original approach of adding `.nosearch' sentinels in
`/usr/share/emacs/site-lisp/elpa{,-src}' was discovered to be broken[2]:
though it works for normal mode, in batch mode it will disable loading
path for all sub-directories from these two path.  This was reverted in
2.1.5.

I am now proposing another approach: only adding `.nosearch' sentinels
in any sub-directories from the root directory of a package, e.g. for
package `foo' with a sub-directory `bar', only add `.nosearch' under
`foo/bar' but no `foo'.  This was proven to work well using an elpafied
auctex package, and doesn't break any tests using ERT or Buttercup.

I have prepared a patch at [3] and also attached.  Please help review
and comment.  I'll merge it once it's approved.

[1] https://bugs.debian.org/1069210
[2] https://bugs.debian.org/1076964
[3] 
https://salsa.debian.org/manphiz/dh-elpa/-/compare/master...no-recursive-handling?from_project_id=18920

-- System Information:
Debian Release: 12.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-23-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dh-elpa depends on:
ii  debhelper               13.11.4
ii  emacs                   1:29.4+1-3~bpo12+0manphiz1
ii  emacs-gtk [emacs]       1:29.4+1-3~bpo12+0manphiz1
ii  libarray-utils-perl     0.5-3
ii  libconfig-tiny-perl     2.28-2
ii  libdebian-source-perl   0.122
ii  libdpkg-perl            1.21.22
ii  libfile-find-rule-perl  0.34-3
ii  libtext-glob-perl       0.11-3
ii  perl                    5.36.0-7+deb12u1

dh-elpa recommends no packages.

dh-elpa suggests no packages.

-- no debconf information

-- 
Xiyue Deng
From ff24a2bcaf7f8fdb4e3507842b822974163d2843 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Wed, 24 Jul 2024 14:22:05 -0700
Subject: [PATCH] Properly disable recursive load-path handling in
 sub-directories

* Create the `.nosearch' files only in package sub-directories in
helper/install, and remove them in helper/remove.
---
 helper/install | 3 +++
 helper/remove  | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/helper/install b/helper/install
index 8d748c8..0139b84 100755
--- a/helper/install
+++ b/helper/install
@@ -42,6 +42,9 @@ elc_dir=/usr/share/${FLAVOR}/site-lisp/elpa/${ELPA_DIR}/
 export EMACSLOADPATH
 EMACSLOADPATH=${ELPA_LOAD_PATH}
 
+# Disable adding sub-directories to `load-path'
+for DIR in ${el_dir}/*; do [ -d ${DIR} ] && touch ${DIR}/.nosearch; done
+
 echo "install/${ELPA_DIR}: byte-compiling for ${FLAVOR}"
 
 [ -d "${elc_dir}" ] || mkdir -p "${elc_dir}"
diff --git a/helper/remove b/helper/remove
index 3182eeb..6ab9d17 100755
--- a/helper/remove
+++ b/helper/remove
@@ -24,6 +24,8 @@ ELPA_DIR=${ELPA_PACKAGE}-${ELPA_VERSION}
 
 elpa_root="/usr/share/${FLAVOR}/site-lisp/elpa"
 elc_dir="${elpa_root}/${ELPA_DIR}"
+elpa_src_root="/usr/share/${FLAVOR}/site-lisp/elpa-src"
+el_dir="${elpa_src_root}/${ELPA_DIR}"
 
 FLAVOR=$1
 case $FLAVOR in
@@ -43,6 +45,11 @@ echo dh-elpa: purging flavor specific files for ${FLAVOR}
 rm -f ${elc_dir}/*.elc
 [ -d ${elc_dir} ] && find ${elc_dir} -type l -delete
 rm -f ${elc_dir}/Install.log*
+
+# Remove entries that disable recursive `load-path' handling in sub-directories
+find ${elc_dir} -name ".nosearch" -exec rm {} \;
+find ${el_dir} -name ".nosearch" -exec rm {} \;
+
 if test -e "${elc_dir}"
 then
     rmdir --ignore-fail-on-non-empty "${elc_dir}"
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature

Reply via email to