NetBSD Problem Report #46804

From www@NetBSD.org  Wed Aug 15 22:06:55 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 0BB6E63C3D5
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 15 Aug 2012 22:06:55 +0000 (UTC)
Message-Id: <20120815220653.CCBE263B882@www.NetBSD.org>
Date: Wed, 15 Aug 2012 22:06:53 +0000 (UTC)
From: cfuhrman@panix.com
Reply-To: cfuhrman@panix.com
To: gnats-bugs@NetBSD.org
Subject: Emacs Load Path issues when using emacs-nox11 w/ other packages such as flim, semi, and skk
X-Send-Pr-Version: www-1.0

>Number:         46804
>Category:       pkg
>Synopsis:       Emacs Load Path issues when using emacs-nox11 w/ other packages such as flim, semi, and skk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 15 22:10:00 +0000 2012
>Last-Modified:  Wed Aug 22 19:20:02 +0000 2012
>Originator:     Christopher M. Fuhrman
>Release:        N/A : Using Darwin 10.8.0 and Darwin 11.4.0
>Organization:
>Environment:
Darwin m240-sm-20-mbpt 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64

Darwin dn0a2071e1.sunet 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
>Description:
When EMACS_TYPE=emacs23nox and one attempts to install certain packages (for the sake of example, let's say mail/wl-snapshot), the emacs batch command does not have the correct load path resulting in failed compilation as so:

==========================================================================
The following variables will affect the build process of this package,
wl-2.15.9.20110420.  Their current value is shown below:

        * EMACS_TYPE = emacs23nox
        * SSLBASE = /usr
        * SSLCERTS = /etc/ssl/certs
        * SSLDIR = /etc/ssl
        * SSLKEYS = /etc/ssl/private

Based on these variables, the following variables have been set:

        * EMACS_BIN = /usr/pkg/bin/emacs
        * EMACS_ETCPREFIX = /usr/pkg/share
        * EMACS_FLAVOR = emacs
        * EMACS_INFOPREFIX = /usr/pkg/info
        * EMACS_LISPPREFIX = /usr/pkg/share/emacs/site-lisp
        * EMACS_PKGNAME_PREFIX (defined, but empty)
        * EMACS_VERSION_MAJOR = 23
        * EMACS_VERSION_MICRO (defined, but empty)
        * EMACS_VERSION_MINOR = 3

You may want to abort the process now with CTRL-C and change their value
before continuing.  Be sure to run `/usr/pkg/bin/bmake clean' after
the changes.
==========================================================================
=> Build dependency nbpatch-[0-9]*: found nbpatch-20100124
=> Full dependency emacs-nox11>=23.2<24: found emacs-nox11-23.4
=> Full dependency emacs-nox11>=23.2<24: found emacs-nox11-23.4
=> Full dependency emacs-w3m>=1.4.364: found emacs-w3m-1.4.442.20110729nb1
=> Full dependency apel>=10: found apel-10.8
=> Full dependency semi>=1.14: found semi-1.14.6nb6
=> Full dependency bbdb>=2: found bbdb-2.35
===> Overriding tools for wl-2.15.9.20110420
===> Extracting for wl-2.15.9.20110420
===> Patching for wl-2.15.9.20110420
=> Applying pkgsrc patches for wl-2.15.9.20110420
===> Creating toolchain wrappers for wl-2.15.9.20110420
===> Configuring for wl-2.15.9.20110420
=> Fixing wl-icon-directory default value (defvar)
===> Building for wl-2.15.9.20110420
/usr/pkg/bin/emacs -batch -q -no-site-file -l WL-MK -f compile-wl-package  /Volumes/TempStorage/pkgsrc-2012Q2/mail/wl-snapshot/work/.destdir/usr/pkg/share/emacs/site-lisp /Volumes/TempStorage/pkgsrc-2012Q2/mail/wl-snapshot/work/.destdir/usr/pkg/share/wl
Warning: Could not find simple.el nor simple.elc
Cannot open load file: cl
*** Error code 255

Stop.
bmake: stopped in /Volumes/TempStorage/pkgsrc-2012Q2/mail/wl-snapshot/work/wanderlust
*** Error code 1

Stop.
bmake: stopped in /Volumes/TempStorage/pkgsrc-2012Q2/mail/wl-snapshot
*** Error code 1

Stop.
bmake: stopped in /Volumes/TempStorage/pkgsrc-2012Q2/mail/wl-snapshot
*** Error code 1

Stop.
bmake: stopped in /Volumes/TempStorage/pkgsrc-2012Q2/editors/emacs-packages

The issue here is that EMACSLOADPATH, as defined in editors/emacs/modules.mk, isn't complete enough for emacs to locate the required dependencies and thus fails.

Currently, this impacts the following packages:

 - devel/flim
 - devel/semi
 - inputmethod/skk
 - mail/wl-snapshot

Probably more I haven't checked.
>How-To-Repeat:
1) Remove any prior version of emacs installed via pkgsrc

2) Edit /usr/pkg/etc/mk.conf and set EMACS_TYPE=emacs23nox

3) Attempt to install devel/flim (emacs-nox11 v23.4 will be installed)

Building of package will fail as so:

/usr/pkg/bin/emacs -batch -q -no-site-file -l FLIM-MK -f compile-flim NONE NONE  NONE
Warning: Could not find simple.el nor simple.elc
Loading /Volumes/TempStorage/pkgsrc-2012Q2/devel/flim/work/flim-1.14.9/FLIM-CFG...
Loading /Volumes/TempStorage/pkgsrc-2012Q2/devel/flim/work/flim-1.14.9/FLIM-ELS...
Cannot open load file: advice
*** Error code 255

>Fix:
A temporary workaround is do invoke bmake as follows:

 $ cd path/to/package (e.g., /usr/pkgsrc/devel/flim)

 $ bmake EMACSLOADPATH=$PWD/work/.buildlink/share/emacs/site-lisp/:$PWD/work/.buildlink/share/emacs/23.4/lisp/:$PWD/work/.buildlink/share/emacs/23.4/site-lisp/ install

A longer term solution would be to fix how EMACSLOADPATH is defined in editors/emacs/modules.mk.  One clue to fixing the issue can be found at http://www.ki.nu/~makoto/diary/2012/03/06/1.html although be warned that the provided patch found at http://www.ki.nu/~makoto/diary/attach/2012/20120306-emacs-modules.mk-diff did not work for me :/

>Audit-Trail:
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other
 packages such as flim, semi, and skk
Date: Thu, 16 Aug 2012 14:11:21 +0900

 workaround is "update pkgsrc/editos/emacs-nox11/version.mk to reflect reality",
 but this issue should be fixed exactly.

 -- 
 OBATA Akio / obache@NetBSD.org

From: Makoto Fujiwara <makoto@ki.nu>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other packages such as flim, semi, and skk
Date: Thu, 16 Aug 2012 20:19:40 +0900

 | From: cfuhrman@panix.com
 | Date: Wed, 15 Aug 2012 22:10:00 +0000 (UTC)

 > >Fix:
 ....

 > A longer term solution would be to fix how EMACSLOADPATH is
 > defined in editors/emacs/modules.mk.  One clue to fixing the
 > issue can be found at
 > http://www.ki.nu/~makoto/diary/2012/03/06/1.html although be
 > warned that the provided patch found at
 > http://www.ki.nu/~makoto/diary/attach/2012/20120306-emacs-modules.mk-diff
 > did not work for me :/

 The revised version of the fix will be:

 Index: editors/emacs/modules.mk
 ===================================================================
 RCS file: /cvs/cvsroot/pkgsrc/editors/emacs/modules.mk,v
 retrieving revision 1.16
 diff -u -r1.16 modules.mk
 --- editors/emacs/modules.mk	16 Jun 2012 21:04:56 -0000	1.16
 +++ editors/emacs/modules.mk	16 Aug 2012 09:37:27 -0000
 @@ -345,11 +345,16 @@

  .if defined(EMACS_BUILDLINK)
  _EMACS_DIR=	${BUILDLINK_DIR}/share/emacs
 -.  if empty(EMACS_TYPE:Memacs25)
 -ALL_ENV+=	EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}/lisp:${_EMACS_DIR}/site-lisp
 -.  else
 -ALL_ENV+=	EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}.${_EMACS_VERSION_MICRO}/lisp:${_EMACS_DIR}/site-lisp
 -.  endif
 +
 +# (Hopefully) matches only to emacs-[1-9]+, emacs-nox11-[1-9]+
 +_EMACS_VERSION_DIR!=   \
 +       (${PKG_INFO} -e emacs-'[1-9n]*' || ${ECHO} "") |	\
 +       ${SED} -e 's/emacs-nox11-//' |			\
 +       ${SED} -e 's/emacs-//' |				\
 +       ${SED} -e 's/\.[0-9]\{8,\}//' |			\
 +       ${SED} -e 's/nb.*//'
 +
 +ALL_ENV+=      EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_DIR}/lisp:${_EMACS_DIR}/site-lisp
  .include	"${_EMACS_PKGDIR}/buildlink3.mk"
  .endif



 ---
 Makoto Fujiwara, 
 Chiba, Japan, Narita Airport and Disneyland prefecture.

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other
 packages such as flim, semi, and skk
Date: Thu, 16 Aug 2012 21:03:53 +0900

 Fujiwara-san, do you know the way to retrieve default `load-path' variable of emacs
 (PATH_LOADSEARCH in generated src/epaths.h)?
 Then, we can replace ${LOCALBASE} in it with ${BUILDLINK_DIR} and use the result as EMACSLOADPATH.

 -- 
 OBATA Akio / obache@NetBSD.org

From: Aleksej Saushev <asau@inbox.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other packages such as flim, semi, and skk
Date: Fri, 17 Aug 2012 00:28:16 +0400

 "OBATA Akio" <obache@netbsd.org> writes:

 > The following reply was made to PR pkg/46804; it has been noted by GNATS.
 >
 > From: "OBATA Akio" <obache@netbsd.org>
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other
 >  packages such as flim, semi, and skk
 > Date: Thu, 16 Aug 2012 21:03:53 +0900
 >
 >  Fujiwara-san, do you know the way to retrieve default `load-path' variable of emacs

 emacs -batch -eval "(print load-path)"

From: Makoto Fujiwara <makoto@ki.nu>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other packages such as flim, semi, and skk
Date: Fri, 17 Aug 2012 21:46:41 +0900

 The patch for today follows 
 (I do not insist for this, just a way to real solution :-)

 Index: editors/emacs/modules.mk
 ===================================================================
 RCS file: /e/cvsync/cvsync/pkgsrc/editors/emacs/modules.mk,v
 retrieving revision 1.15
 diff -u -r1.15 modules.mk
 --- editors/emacs/modules.mk	23 Mar 2011 15:15:20 -0000	1.15
 +++ editors/emacs/modules.mk	16 Aug 2012 14:57:47 -0000
 @@ -343,11 +343,15 @@

  .if defined(EMACS_BUILDLINK)
  _EMACS_DIR=	${BUILDLINK_DIR}/share/emacs
 -.  if empty(EMACS_TYPE:Memacs24)
 -ALL_ENV+=	EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}/lisp:${_EMACS_DIR}/site-lisp
 -.  else
 -ALL_ENV+=	EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}.${_EMACS_VERSION_MICRO}/lisp:${_EMACS_DIR}/site-lisp
 -.  endif
 +_EMACS_VERSION_DIR!=   \
 +  emacs -q -batch -f eval '(print load-path)' --no-site-lisp 2>&1 | \
 +  ${TR} ' ' '\012' | \
 +  ${SED} -e 's|.*/share|/share|'  -e 's/(//' | \
 +  rev | ${CUT} -d '/' -f 2- | rev | ${SORT} -u | \
 +  ${GREP} lisp | ${SED} -e 's|share/emacs/||' -e 's|/lisp||'
 +
 +ALL_ENV+=      EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_DIR}/lisp:${_EMACS_DIR}/site-lisp
 +
  .include	"${_EMACS_PKGDIR}/buildlink3.mk"
  .endif

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/
 other packages such as flim, semi, and skk
Date: Wed, 22 Aug 2012 08:13:48 +0000

 On Fri, Aug 17, 2012 at 12:50:08PM +0000, Makoto Fujiwara wrote:
  >  +_EMACS_VERSION_DIR!=   \
  >  +  emacs -q -batch -f eval '(print load-path)' --no-site-lisp 2>&1 | \
  >  +  ${TR} ' ' '\012' | \
  >  +  ${SED} -e 's|.*/share|/share|'  -e 's/(//' | \
  >  +  rev | ${CUT} -d '/' -f 2- | rev | ${SORT} -u | \
  >  +  ${GREP} lisp | ${SED} -e 's|share/emacs/||' -e 's|/lisp||'
  >  +
  >  +ALL_ENV+=      EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_DIR}/lisp:${_EMACS_DIR}/site-lisp
  >  +

 That doesn't work with emacs20 :(

 % emacs -q -batch -f eval '(print load-path)' --no-site-lisp
 Wrong number of arguments: #<subr eval>, 0
 % 

 Wouldn't a better solution to be to define EMACSLOADPATH when building
 emacs, add it to BUILD_DEFS so it's in +BUILD_INFO, and fetch it back
 with pkg_info -B?

 -- 
 David A. Holland
 dholland@netbsd.org

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other
 packages such as flim, semi, and skk
Date: Wed, 22 Aug 2012 17:36:42 +0900

 On Wed, 22 Aug 2012 17:15:04 +0900, David Holland <dholland-pbugs@netbsd.org> wrote:

 >  That doesn't work with emacs20 :(
 > % emacs -q -batch -f eval '(print load-path)' --no-site-lisp
 >  Wrong number of arguments: #<subr eval>, 0
 >  %

 How about following instead?
   emacs -q -batch -eval '(print load-path)' --no-site-lisp

 >  Wouldn't a better solution to be to define EMACSLOADPATH when building
 >  emacs, add it to BUILD_DEFS so it's in +BUILD_INFO, and fetch it back
 >  with pkg_info -B?

 Packages don't know about default EMACSLOADPATH of built emacs.

 -- 
 OBATA Akio / obache@NetBSD.org

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/
 other packages such as flim, semi, and skk
Date: Wed, 22 Aug 2012 08:46:29 +0000

 On Wed, Aug 22, 2012 at 08:40:05AM +0000, OBATA Akio wrote:
  >  >  That doesn't work with emacs20 :(
  >  > % emacs -q -batch -f eval '(print load-path)' --no-site-lisp
  >  >  Wrong number of arguments: #<subr eval>, 0
  >  >  %
  >  
  >  How about following instead?
  >    emacs -q -batch -eval '(print load-path)' --no-site-lisp

 Also need to remove --no-site-lisp; then it works.

 emacs23 produces the same behavior, btw.

  >  >  Wouldn't a better solution to be to define EMACSLOADPATH when building
  >  >  emacs, add it to BUILD_DEFS so it's in +BUILD_INFO, and fetch it back
  >  >  with pkg_info -B?
  >  
  >  Packages don't know about default EMACSLOADPATH of built emacs.

 I don't understand the objection. Isn't it easier to define
 EMACSLOADPATH correctly in each of the emacs packages (which can be
 version-specific) than to try to extract it afterwards?

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/
 other packages such as flim, semi, and skk
Date: Wed, 22 Aug 2012 09:13:00 +0000

 On Fri, Aug 17, 2012 at 12:50:08PM +0000, Makoto Fujiwara wrote:
  >  +_EMACS_VERSION_DIR!=   \
  >  +  emacs -q -batch -f eval '(print load-path)' --no-site-lisp 2>&1 | \
  >  +  ${TR} ' ' '\012' | \
  >  +  ${SED} -e 's|.*/share|/share|'  -e 's/(//' | \
  >  +  rev | ${CUT} -d '/' -f 2- | rev | ${SORT} -u | \
  >  +  ${GREP} lisp | ${SED} -e 's|share/emacs/||' -e 's|/lisp||'

 Also, while I'm at it, that seems excessively complicated. How about

    emacs -q -batch -eval '(print load-path)' |\
      ${TR} ' ' '\n' |\
      ${GREP} '/share/emacs/[^/]*/lisp' |\
      ${SED} -e 's|.*/share/emacs/\([^/]*\)/lisp.*|\1|' |\
      ${SORT} -u

 ?

 One can also do

    emacs -q -batch -eval '(print load-path)' |\
      ${SED} -n 'y/ /\n/;\,/share/emacs/[^/]*/lisp,{s|.*/share/emacs/\([^/]*\)/lisp.*|\1|;p;q;}'

 That is not a win on clarity, but if we're going to run this every
 time the .mk file is loaded having fewer forks will help slow systems...

 -- 
 David A. Holland
 dholland@netbsd.org

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/ other
 packages such as flim, semi, and skk
Date: Wed, 22 Aug 2012 18:36:31 +0900

 On Wed, 22 Aug 2012 17:50:04 +0900, David Holland <dholland-pbugs@netbsd.org> wrote:

 >  I don't understand the objection. Isn't it easier to define
 >  EMACSLOADPATH correctly in each of the emacs packages (which can be
 >  version-specific) than to try to extract it afterwards?

 Origin of this PR is "hand-made maintenance of variables is sometimes not correct".

 -- 
 OBATA Akio / obache@NetBSD.org

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46804: Emacs Load Path issues when using emacs-nox11 w/
 other packages such as flim, semi, and skk
Date: Wed, 22 Aug 2012 19:18:00 +0000

 On Wed, Aug 22, 2012 at 09:40:03AM +0000, OBATA Akio wrote:
  >  >  I don't understand the objection. Isn't it easier to define
  >  >  EMACSLOADPATH correctly in each of the emacs packages (which can be
  >  >  version-specific) than to try to extract it afterwards?
  >  
  > Origin of this PR is "hand-made maintenance of variables is
  > sometimes not correct".

 true.

 ah, I see the problem: I misunderstood what the issue was, because I'd
 confused it with the problem I created by sticking "nox11" in the wrong
 place when importing emacs24. So maybe I should just be quiet :-)

 However, if the load path we want is always based on
 ${PREFIX}/share/emacs/${VERSION}/lisp, wouldn't it be better to get
 the version with emacs -q -batch -eval '(print emacs-version)' than to
 grind the load path? (And if you use princ instead of print, it
 doesn't emit quotes and they don't need to be stripped off.)

 One other thing: as per earlier discussion on tech-pkg I'm still
 intending at some point to fix the emacs packages to include the major
 version in the package name (emacs20-20.7.1, emacs23-23.4.1, etc.) so
 if possible try to avoid doing anything that'll break on that...

 -- 
 David A. Holland
 dholland@netbsd.org

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.