all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Help debugging a backtrace
@ 2016-04-27 18:28 Kaushal Modi
  2016-04-27 19:01 ` Nick Dokos
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-04-27 18:28 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi,

I was experimenting running emacs on Android using Termux (
https://play.google.com/store/apps/details?id=com.termux ) inspired by this
blog post by Artur Malabarba (
http://endlessparentheses.com/running-emacs-on-android.html ).

I have got things almost working except for seemingly random error messages
like the one in the below backtrace.

https://gist.github.com/kaushalmodi/4ec8d9b8e3dae268c951be743b5d05ae

Here, I was trying to use the er/expand-region command (
https://github.com/magnars/expand-region.el ). That in turn seems to
require clojure-mode (as I happen to have that installed too). And after
that it leads to this error:

Debugger entered--Lisp error: (wrong-type-argument stringp (require .
finder-inf))

string-match("\\(\\`\\|/\\)clojure-mode\\(\\.elc\\|\\.el\\)?\\(\\.gz\\)?\\'"
(require . finder-inf))

load-history-filename-element("\\(\\`\\|/\\)clojure-mode\\(\\.elc\\|\\.el\\)?\\(\\.gz\\)?\\'")
  eval-after-load("clojure-mode" #[nil "\300\301!\207" [require
clojure-mode-expansions] 2])

.. which I do not understand how and why.

I have seen the same (require . finder-inf) error pop-up when I tried to do
something in dired too.

This problem did not occur for the short time I tried out emacs -Q. This
problem also does not occur as soon as I launch emacs with my config in
Termux; it happens only when certain packages are required.

I'd like to understand the above backtrace so that I can possible fix
something in my config or at least understand if something went wrong in
the building of emacs for that platform.

Thanks for reading my email.

Kaushal
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-27 18:28 Kaushal Modi
@ 2016-04-27 19:01 ` Nick Dokos
  2016-04-27 19:37   ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Dokos @ 2016-04-27 19:01 UTC (permalink / raw)
  To: help-gnu-emacs

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Hi,
>
> I was experimenting running emacs on Android using Termux (
> https://play.google.com/store/apps/details?id=com.termux ) inspired by this
> blog post by Artur Malabarba (
> http://endlessparentheses.com/running-emacs-on-android.html ).
>
> I have got things almost working except for seemingly random error messages
> like the one in the below backtrace.
>
> https://gist.github.com/kaushalmodi/4ec8d9b8e3dae268c951be743b5d05ae
>

load-history-filename-element expects the variable load-history to be a
list of lists. The car of each of the sublists is supposed to be a string
(a pathname) and the cdr is supposed to be a list of dotted pairs of the form
(require . something)

Apparently, your load-history fails to conform by having a sublist
that's missing the pathname and starting with a dotted pair.

I think you should check load-history after every load and see where
it goes awry.

--
Nick




^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-27 19:01 ` Nick Dokos
@ 2016-04-27 19:37   ` Kaushal Modi
  2016-04-28 20:59     ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-04-27 19:37 UTC (permalink / raw)
  To: Nick Dokos, help-gnu-emacs

>
> Apparently, your load-history fails to conform by having a sublist
> that's missing the pathname and starting with a dotted pair.
>
> I think you should check load-history after every load and see where
> it goes awry.
>

Thanks for that tip. Now it looks I'm on to something..

Here are few lines of snippet from the 10's of thousands of lines I got on
doing C-h v load-history. The "finder-inf" part looks funny:

 ("/data/data/com.termux/files/home/.emacs.d/setup-files/setup-symbola.el"
font-symbola-p
  (provide . setup-symbola))
 ((require . finder-inf)) ; no path!!
 ("/data/data/com.termux/files/home/.emacs.d/elisp/smyx/smyx-theme.el"
  (provide . smyx-theme))
 ("/data/data/com.termux/files/usr/share/emacs/25.0.93/lisp/term/xterm.elc"
xterm--extra-capabilities-type xterm-extra-capabilities
xterm-extra-capabilities xterm-max-cut-length xterm-max-cut-length
xterm-paste-ending-sequence
  (defun . xterm-paste)
  xterm-rxvt-function-map xterm-function-map xterm-alternatives-map
xterm-standard-colors
  (defun . xterm--report-background-handler)
  (defun . xterm--version-handler)

So it looks like we do not have path to the file that requires finder-inf.
Correct? Any idea what could cause that?

-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-27 19:37   ` Kaushal Modi
@ 2016-04-28 20:59     ` Kaushal Modi
  2016-04-29 21:27       ` Michael Heerdegen
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-04-28 20:59 UTC (permalink / raw)
  To: Nick Dokos, help-gnu-emacs; +Cc: Bruce Connor

I use the exact same config on my RHEL machine and on phone.

After gradually commenting out stuff, I figured out that the file-path-less
((require . finder-inf)) gets added to load-history when I do

(require 'package)

.. even with (package-initialize) commented out.

So with just (require 'package) and many packages installed in my elpa/ dir
(none of them are loaded or required), I get that faulty entry in
load-history.

Any further tips to debug this?
In the meanwhile, I will try to go through package.el to understand what's
happening.
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-28 20:59     ` Kaushal Modi
@ 2016-04-29 21:27       ` Michael Heerdegen
  2016-04-29 21:36         ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Heerdegen @ 2016-04-29 21:27 UTC (permalink / raw)
  To: help-gnu-emacs

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Any further tips to debug this?

Looking for some code that `require's finder-inf would be a start.

BTW, `load-history' is in chronological order, the position of the
faulty entry in the list might give some hints as well.


Michael.




^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-29 21:27       ` Michael Heerdegen
@ 2016-04-29 21:36         ` Kaushal Modi
  2016-04-29 22:56           ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-04-29 21:36 UTC (permalink / raw)
  To: Michael Heerdegen, help-gnu-emacs

>
> Looking for some code that `require's finder-inf would be a start.
>

There's no occurrence of (require 'finder-inf) in my ~/.emacs.d/ (so that
includes the installed packages too). I had one package help-fns+ that had
that. So I uninstalled that, and I still get this error.

Then the only occurrences of that form are in the emacs elisp source code:

lisp/emacs-lisp/package.el
629:        (require 'finder-inf nil t) ; For `package--builtins'.
1295:  (require 'finder-inf nil t)
2167:     (require 'finder-inf nil t)
3356:  (require 'finder-inf nil t)
3394:  (require 'finder-inf nil t)

lisp/finder.el
36:(require 'finder-inf nil t)

test/automated/package-test.el
404:  (require 'finder-inf)

That makes sense because that error shows up after I (require 'package).
But that does not explain why the same is fine on my linux machine but not
on my phone. What dependencies could be missing on my phone's build that's
causing this.

Here is the build info for emacs built for Termux:

Emacs version: GNU Emacs 25.0.93 (aarch64-unknown-linux-android)
of 2016-04-29, built using commit .

./configure options:
--disable-dependency-tracking --prefix=/data/data/com.termux/files/usr
--disable-rpath --disable-rpath-hack --host=aarch64-linux-android
--without-x --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no
--with-tiff=no --without-gconf --without-gsettings --with-gnutls
--with-xml2 emacs_cv_sanitize_address=yes emacs_cv_prog_cc_nopie=no
--disable-nls --enable-shared --disable-static
--libexecdir=/data/data/com.termux/files/usr/libexec
'CFLAGS=-specs=/home/fornwall/dc/termux.spec -Os'
CPPFLAGS=-I/data/data/com.termux/files/usr/include
'LDFLAGS=-specs=/home/fornwall/dc/termux.spec
-L/data/data/com.termux/files/usr/lib
-Wl,-rpath-link,/data/data/com.termux/files/usr/lib
-Wl,-rpath-link,/home/fornwall/lib/android-standalone-toolchain-aarch64-api21-gcc4.9/sysroot/usr/lib'

Features:
NOTIFY GNUTLS LIBXML2 ZLIB

Does that ./configure have any red flags?


> BTW, `load-history' is in chronological order, the position of the
> faulty entry in the list might give some hints as well.
>

I know that the problem occurs as soon as I require package, even before I do
package-initialize or require any of my installed packages (I commented out
everything in my config after requiring package). If I comment out even the
(require 'package), which means that my config is as good as emacs -Q, this
problem goes away.

So debugging this seems to be out of reach of my basic elisp debugging fu.
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-29 21:36         ` Kaushal Modi
@ 2016-04-29 22:56           ` Kaushal Modi
  2016-05-01 14:22             ` Michael Heerdegen
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-04-29 22:56 UTC (permalink / raw)
  To: Michael Heerdegen, help-gnu-emacs

Thanks for this tip:


*BTW, `load-history' is in chronological order, the position of thefaulty
entry in the list might give some hints as well.*

The problem is not yet resolved, but looks like I made some debug progress.

If I launch emacs with my config, this problem exists (of course).
*But if I launch "emacs -Q" or "emacs -q" and then evaluate my init.el,
this problem goes away.*

Below is a part of load-history value after I started emacs with all my
config commented out except for the package requiring part.

Looks like something is messed up in emacs autoloading?
- lisp/thingatpt/elc is loaded
- Then lisp/help-fns.elc is loaded
- Then something is loaded that tries to require finder-inf
- Then lisp/term/xterm.elc is loaded

*Where can I find the order of where these inbuilt packages are loaded?
From what I see, that order is not alphabetical.*

Value: ((
*"/data/data/com.termux/files/usr/share/emacs/25.0.93/lisp/thingatpt.elc"*
(provide . thingatpt)
(t . forward-thing)
(defun . forward-thing)
(t . bounds-of-thing-at-point)

< -- snip -->

(defun . sexp-at-point)
(t . symbol-at-point)
(defun . symbol-at-point)
(t . number-at-point)
(defun . number-at-point)
(t . list-at-point)
(defun . list-at-point))
(*"/data/data/com.termux/files/usr/share/emacs/25.0.93/lisp/help-fns.elc"*
(require . cl-lib)
(require . help-mode)
help-fns-describe-function-functions describe-function-orig-buffer
(t . describe-function)
(defun . describe-function)

< -- snip -->

(defun . describe-syntax)
(defun . help-describe-category-set)
(t . describe-categories)
(defun . describe-categories)
(t . doc-file-to-man)
(defun . doc-file-to-man)
(t . doc-file-to-info)
(defun . doc-file-to-info)
(provide . help-fns))
* ((require . finder-inf)) ;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*
(*"/data/data/com.termux/files/usr/share/emacs/25.0.93/lisp/term/xterm.elc"*
xterm--extra-capabilities-type xterm-extra-capabilities
xterm-extra-capabilities xterm-max-cut-length xterm-max-cut-length
xterm-paste-ending-sequence
(defun . xterm-paste)
xterm-rxvt-function-map xterm-function-map xterm-alternatives-map
xterm-standard-colors
(defun . xterm--report-background-handler)
(defun . xterm--version-handler)
xterm-query-timeout
(defun . xterm--query)
(defun . xterm--push-map)

On Fri, Apr 29, 2016 at 5:36 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> Looking for some code that `require's finder-inf would be a start.
>>
>
> There's no occurrence of (require 'finder-inf) in my ~/.emacs.d/ (so that
> includes the installed packages too). I had one package help-fns+ that had
> that. So I uninstalled that, and I still get this error.
>
> Then the only occurrences of that form are in the emacs elisp source code:
>
> lisp/emacs-lisp/package.el
> 629:        (require 'finder-inf nil t) ; For `package--builtins'.
> 1295:  (require 'finder-inf nil t)
> 2167:     (require 'finder-inf nil t)
> 3356:  (require 'finder-inf nil t)
> 3394:  (require 'finder-inf nil t)
>
> lisp/finder.el
> 36:(require 'finder-inf nil t)
>
> test/automated/package-test.el
> 404:  (require 'finder-inf)
>
> That makes sense because that error shows up after I (require 'package).
> But that does not explain why the same is fine on my linux machine but not
> on my phone. What dependencies could be missing on my phone's build that's
> causing this.
>
> Here is the build info for emacs built for Termux:
>
> Emacs version: GNU Emacs 25.0.93 (aarch64-unknown-linux-android)
> of 2016-04-29, built using commit .
>
> ./configure options:
> --disable-dependency-tracking --prefix=/data/data/com.termux/files/usr
> --disable-rpath --disable-rpath-hack --host=aarch64-linux-android
> --without-x --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no
> --with-tiff=no --without-gconf --without-gsettings --with-gnutls
> --with-xml2 emacs_cv_sanitize_address=yes emacs_cv_prog_cc_nopie=no
> --disable-nls --enable-shared --disable-static
> --libexecdir=/data/data/com.termux/files/usr/libexec
> 'CFLAGS=-specs=/home/fornwall/dc/termux.spec -Os'
> CPPFLAGS=-I/data/data/com.termux/files/usr/include
> 'LDFLAGS=-specs=/home/fornwall/dc/termux.spec
> -L/data/data/com.termux/files/usr/lib
> -Wl,-rpath-link,/data/data/com.termux/files/usr/lib
> -Wl,-rpath-link,/home/fornwall/lib/android-standalone-toolchain-aarch64-api21-gcc4.9/sysroot/usr/lib'
>
> Features:
> NOTIFY GNUTLS LIBXML2 ZLIB
>
> Does that ./configure have any red flags?
>
>
>> BTW, `load-history' is in chronological order, the position of the
>> faulty entry in the list might give some hints as well.
>>
>
> I know that the problem occurs as soon as I require package, even before I do
> package-initialize or require any of my installed packages (I commented
> out everything in my config after requiring package). If I comment out even
> the (require 'package), which means that my config is as good as emacs -Q,
> this problem goes away.
>
> So debugging this seems to be out of reach of my basic elisp debugging fu.
> --
>
> --
> Kaushal Modi
>
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-04-29 22:56           ` Kaushal Modi
@ 2016-05-01 14:22             ` Michael Heerdegen
  2016-05-01 14:27               ` Michael Heerdegen
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Heerdegen @ 2016-05-01 14:22 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: help-gnu-emacs

Kaushal Modi <kaushal.modi@gmail.com> writes:

> The problem is not yet resolved, but looks like I made some debug
> progress.

Does the illegal entry already appear after starting emacs -q (i.e. load
site-start stuff, but not your init file), or only after you initialize
packages (`package-initialize' probably)?

Anyhow, such an entry should not appear in `load-history', I think, no
matter how you configured Emacs.


Michael.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-01 14:22             ` Michael Heerdegen
@ 2016-05-01 14:27               ` Michael Heerdegen
  2016-05-01 19:05                 ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Heerdegen @ 2016-05-01 14:27 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Anyhow, such an entry should not appear in `load-history', I think, no
> matter how you configured Emacs.

I mean, maybe building Emacs on your phone is just buggy, because it's
kind of an unusual building environment that has not yet been tested by
lots of people, so you have just hit some nasty bug.


Michael.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-01 14:27               ` Michael Heerdegen
@ 2016-05-01 19:05                 ` Kaushal Modi
  2016-05-01 20:45                   ` Michael Heerdegen
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-05-01 19:05 UTC (permalink / raw)
  To: Michael Heerdegen, Bruce Connor; +Cc: help-gnu-emacs

Hi Michael,

I have made some progress on the debug and have come to some strange
conclusions that might help you or anyone else familiar with package.el and
on how packages are loaded at emacs startup from the elpa/ dir.

Conclusion:
- This happens ONLY on my phone build as I earlier stated using the exact
same config I use on my RHEL 6.6 machine (
https://github.com/kaushalmodi/.emacs.d ).
- I prefer to put all package related stuff in a separate file. So this
issue is seen only if I do (package-initialize) in a separate file (not in
init.el).
- The issue is "gone" if I move (package-initialize) to init.el
- The issue is not seen with an empty elpa/. None of my packages directly
require finder-inf. But one of them probably does so indirectly (it's
probably requiring some package, which then requires finder-inf? Not sure
..). Here is my installed package list:
https://gist.github.com/kaushalmodi/e0de9d8dc2fff37b617f5ca0a52e6d0f
- The issue is not seen with "emacs -Q -l my-init.el", but it is seen with
"emacs" (even when init.el is the exact same as my-init.el. Also there is
no default.el or site-start.el.). Huh! My understanding is that results of
both "emacs -Q -l init.el" and "emacs" should be the same in absence of
default.el or site-start.el or any site-wide .el.

With that, if I set the below as my init.el and do "emacs", I do NOT see
the issue because (package-initialize) is happening in the init.el.

===== ~/.emacs.d/init.el =====
(package-initialize)
=====

BUT if I set the below as my init.el (move the (package-initialize) out of
init.el), then I see the ((require . finder-inf)) problem:

===== ~/.emacs.d/init.el =====
;; (package-initialize) ; Do NOT delete this comment
;; In emacs 25+, the `package-initialize' call is auto-added to the top of
;; init.el unless the user already has a commented or uncommented
;; `(package-initialize)' line present in their init.el.
;; I call this function in my-package-setup.el and so am keeping the
;; commented out version here so that package.el does not add it again.
(load (locate-user-emacs-file "my-package-setup.el") nil :nomessage)
=====

===== ~/.emacs.d/my-package-setup.el =====
(package-initialize) ; Do not delete this line
(provide 'my-package-setup)
=====

Note that I have the exact same elpa/ dir with the above linked list of
installed packages in both cases.

@Artur It would be great if you have time to recreate this issue on your
phone. See if you can recreate this issue with just the init.el and
my-package-setup.el approach above with your elpa/ dir intact without any
modification.

In the mean while, I will try to narrow down to the package(s) in my elpa/
that probably cause this problem.

Thanks!

Kaushal
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-01 19:05                 ` Kaushal Modi
@ 2016-05-01 20:45                   ` Michael Heerdegen
  2016-05-01 21:10                     ` Drew Adams
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Heerdegen @ 2016-05-01 20:45 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Bruce Connor, help-gnu-emacs

Hi Kaushal,

thanks for the update...interesting.

In addition to your strategies, you might want to try something like

#+begin_src emacs-lisp
(advice-add 'require :before
            (lambda (feature &optional filename _noerror)
              (when (or (eq feature 'finder-inf)
                        (and (stringp filename)
                             (string-match-p "finder-inf" filename)))
                (debug))))
#+end_src

at the beginning of your (outer) config file.  This pops up the debugger
as soon as "something" tries to `require' finder-inf.

In my setup, the debugger pops up with this content for example:

,----------------------------------------------------------------------
|   require(finder-inf nil t)
|   package-built-in-p(late-night-theme (0 0))
|   package-activate(late-night-theme)
|   package-initialize()
|   byte-code[...]
|   load("~/gnu-emacs/.gnu-emacs")
|   eval-buffer(#<buffer  *load*> nil "/home/micha/.emacs" nil t)  ; Reading at buffer position 261
|   load-with-code-conversion("/home/micha/.emacs" "/home/micha/.emacs" t t)
|   load("~/.emacs" t t)
|   [...]
|   command-line()
|   normal-top-level()
`----------------------------------------------------------------------

It would be interesting to see what happens at/after this moment in your
case, e.g. what's the value of `load-file-name' etc. (use R to eval stuff
from the debugger)


Good luck,

Michael.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* RE: Help debugging a backtrace
  2016-05-01 20:45                   ` Michael Heerdegen
@ 2016-05-01 21:10                     ` Drew Adams
  2016-05-02  4:20                       ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Drew Adams @ 2016-05-01 21:10 UTC (permalink / raw)
  To: Michael Heerdegen, Kaushal Modi; +Cc: Bruce Connor, help-gnu-emacs

> (advice-add 'require :before
>             (lambda (feature &optional filename _noerror)
>               (when (or (eq feature 'finder-inf)
>                         (and (stringp filename)
>                              (string-match-p "finder-inf" filename)))
>                 (debug))))

Typo: You probably mean `featurep', not `feature'.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-01 21:10                     ` Drew Adams
@ 2016-05-02  4:20                       ` Kaushal Modi
  2016-05-02  4:38                         ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-05-02  4:20 UTC (permalink / raw)
  To: Drew Adams, Michael Heerdegen; +Cc: Bruce Connor, help-gnu-emacs

>
> Typo: You probably mean `featurep', not `feature'.
>

feature is correct here; it's just the argument name.

@Michael Thanks for that help. Here's more info.

Here is what I got in my backtrace:

=====
Debugger entered: nil
  (progn (debug))
  (if (or (eq feature (quote finder-inf)) (and (stringp filename)
(string-match-p "finder-inf" filename))) (progn (debug)))
  (lambda (feature &optional filename _noerror) (if (or (eq feature (quote
finder-inf)) (and (stringp filename) (string-match-p "finder-inf"
filename))) (progn (debug))) (message "feature: %S" feature) (message
"filename: %S" filename))(finder-inf nil t)
  apply((lambda (feature &optional filename _noerror) (if (or (eq feature
(quote finder-inf)) (and (stringp filename) (string-match-p "finder-inf"
filename))) (progn (debug))) (message "feature: %S" feature) (message
"filename: %S" filename)) (finder-inf nil t))
  require(finder-inf nil t)
  package--build-compatibility-table()
  package-initialize()
  eval-buffer(#<buffer  *load*-296204> nil
"/data/data/com.termux/files/home/.emacs.d/my-package-setup.el" nil t)  ;
Reading at buffer position 21

load-with-code-conversion("/data/data/com.termux/files/home/.emacs.d/my-package-setup.el"
"/data/data/com.termux/files/home/.emacs.d/my-package-setup.el" nil t)
  load("~/.emacs.d/my-package-setup.el" nil :nomessage)
  eval-buffer(#<buffer  *load*> nil
"/data/data/com.termux/files/home/.emacs.d/init.el" nil t)  ; Reading at
buffer position 758

load-with-code-conversion("/data/data/com.termux/files/home/.emacs.d/init.el"
"/data/data/com.termux/files/home/.emacs.d/init.el" t t)
  load("/data/data/com.termux/files/home/.emacs.d/init" t t)
  #[0 " \205\266 \306=\203 \307 \310Q\202? \311=\204 \307
\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB
\323\202?\316\324 \325 \324\211#\210 \324=\203e\326\327\330\307
\331Q!\"\325 \324\211#\210 \324=\203d \210 \203\247\332
!\333\232\203\247\334 !\211\335P\336 !\203\201\211\202\214\336 !\203\213
\202\214\314\262 \203\245\337 \"\203\243\340\341 #\210\342\343!\210 \266
\f?\205\264\314 \325\344\324\211#)\262 \207" [init-file-user system-type
delayed-warnings-list user-init-file inhibit-default-init
inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs"
directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs"
"^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file
is deprecated, please use `.emacs'" "~/_emacs" t load expand-file-name
"init" file-name-as-directory "/.emacs.d" file-name-extension "elc"
file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message
"Warning: %s is newer than %s" sit-for 1 "default"] 7]()
  command-line()
  normal-top-level()
  eval((normal-top-level))
  load("loadup.el")

=====

I see a call to package--build-compatibility-table() in my backtrace
whereas it's not present in yours.

Then I slightly tweaked your require advice, and replaced (debug) with
messages.

=====

;; (package-initialize) ; Do NOT delete this comment
;;   In emacs 25+, the `package-initialize' call is auto-added to the top of
;; init.el unless the user already has a commented or uncommented
;; `(package-initialize)' line present in their init.el.
;;   I call this function in setup-packages.el and so am keeping the
;; commented out version here so that package.el does not add it again.

(advice-add 'require :before
   (lambda (feature &optional filename _noerror)
     (when (or (eq feature 'finder-inf)
(and (stringp filename)
    (string-match-p "finder-inf" filename)))
;; (debug)
(message "feature: %S" feature)
(message "load-file-name: %S" load-file-name)
(message "filename: %S" filename)
(message "---"))))

(load (locate-user-emacs-file "my-package-setup.el") nil :nomessage)

=====

Here's the full *Messages* buffer output when running "emacs":
https://gist.github.com/kaushalmodi/debb736534728df7482d4bc1487f2c3e

Here are the relevant lines from that:

=====

Loading
/data/data/com.termux/files/usr/share/emacs/25.0.93/lisp/leim/leim-list.el
(source)...done
Finding pointers to doc strings...done
feature: finder-inf
load-file-name:
"/data/data/com.termux/files/home/.emacs.d/my-package-setup.el"
filename: nil
---
feature: finder-inf
load-file-name:
"/data/data/com.termux/files/usr/share/emacs/25.0.93/lisp/loadup.el"
filename: nil
---
For information about GNU Emacs and the GNU system, type C-h C-a.

=====

When running "emacs", the finder-inf is required twice: once by
my-setup-package.el and second time by loadup.el.

When running "emacs -Q -l init.el" or "emacs -q -l init.el", finder-inf is
required just once, by my-setup-package.el.

Also, here are the patches needed to be done to few .el files for emacs to
work in Termux:
https://github.com/termux/termux-packages/tree/master/packages/emacs

I realized one important piece of info (I think) while reviewing those;
that emacs is running undumped. Could that be a source of this issue? Would
that explain the difference in behavior between "emacs" and "emacs -q -l
~/.emacs.d/init.el"?
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-02  4:20                       ` Kaushal Modi
@ 2016-05-02  4:38                         ` Kaushal Modi
  2016-05-02 14:38                           ` Michael Heerdegen
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-05-02  4:38 UTC (permalink / raw)
  To: Drew Adams, Michael Heerdegen; +Cc: Bruce Connor, help-gnu-emacs

>
> When running "emacs", the finder-inf is required twice: once by
> my-setup-package.el and second time by loadup.el.
>
> When running "emacs -Q -l init.el" or "emacs -q -l init.el", finder-inf is
> required just once, by my-setup-package.el.
>

I also confirmed that when I do not do (package-initialize) from outside
init.el, attempt to require finder-inf.el is not made from within
loadup.el. In that case, the only load-file-name is the init.el.
-- 

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-02  4:38                         ` Kaushal Modi
@ 2016-05-02 14:38                           ` Michael Heerdegen
  2016-05-02 15:10                             ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Heerdegen @ 2016-05-02 14:38 UTC (permalink / raw)
  To: help-gnu-emacs

Kaushal Modi <kaushal.modi@gmail.com> writes:

> I also confirmed that when I do not do (package-initialize) from
> outside init.el, attempt to require finder-inf.el is not made from
> within loadup.el. In that case, the only load-file-name is the
> init.el.

Hmm, I read everything carefully.  I didn't find anything obviously
bogus or wrong, including the termux hacks.

Maybe you have just hit, by accident, a bug that is also present in
vanilla Emacs, and it's nothing wrong with your stuff.  If there is
something wrong with it, I have no clue what it could be.


Michael.




^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-02 14:38                           ` Michael Heerdegen
@ 2016-05-02 15:10                             ` Kaushal Modi
  2016-05-02 15:33                               ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-05-02 15:10 UTC (permalink / raw)
  To: Michael Heerdegen, help-gnu-emacs

Hi Michael,

Thanks for your time and continuous support.

Unless someone finds time to debug the problem in this thread, as I see
this issue only on my phone build, the workaround I am using is to not put
(package-initialize) in a separate file, but in init.el itself.

It's unfortunate though that the problem is related to the location of
(package-initialize) in my emacs config.

On Mon, May 2, 2016 at 10:39 AM Michael Heerdegen <michael_heerdegen@web.de>
wrote:

> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
> > I also confirmed that when I do not do (package-initialize) from
> > outside init.el, attempt to require finder-inf.el is not made from
> > within loadup.el. In that case, the only load-file-name is the
> > init.el.
>
> Hmm, I read everything carefully.  I didn't find anything obviously
> bogus or wrong, including the termux hacks.
>
> Maybe you have just hit, by accident, a bug that is also present in
> vanilla Emacs, and it's nothing wrong with your stuff.  If there is
> something wrong with it, I have no clue what it could be.
>
>
> Michael.
>
>
> --

-- 
Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-05-02 15:10                             ` Kaushal Modi
@ 2016-05-02 15:33                               ` Eli Zaretskii
  0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2016-05-02 15:33 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: michael_heerdegen, help-gnu-emacs

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Mon, 02 May 2016 15:10:17 +0000
> 
> Unless someone finds time to debug the problem in this thread, as I see
> this issue only on my phone build, the workaround I am using is to not put
> (package-initialize) in a separate file, but in init.el itself.

You should debug this on the C level.  See the other thread where I
suggested that.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
       [not found] <mailman.1147.1461781734.7477.help-gnu-emacs@gnu.org>
@ 2016-09-06  7:26 ` rn3aoh.g
  2016-09-20 16:15   ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: rn3aoh.g @ 2016-09-06  7:26 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, 27 April 2016 21:28:56 UTC+3, Kaushal Modi  wrote:

> I was experimenting running emacs on Android using Termux (
> https://play.google.com/store/apps/details?id=com.termux ) inspired by this
> blog post by Artur Malabarba (
> http://endlessparentheses.com/running-emacs-on-android.html ).
> 
> I have got things almost working except for seemingly random error messages
> like the one in the below backtrace.

If anyone still cares about this issue, I have spent the last week stumbling around trying to figure out the actual cause of this bug.

I am pretty sure I have nailed it, it results from Emacs having to run undumped due to Android's requirement for PIE executables and tripping over an upstream bug filed all the way back in 2013 because of this. I would really appreciate if anyone could tell me whether the solution I came up with is correct:

https://github.com/termux/termux-packages/issues/423

--
Eugene Medvedev


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-09-06  7:26 ` Help debugging a backtrace rn3aoh.g
@ 2016-09-20 16:15   ` Kaushal Modi
  2016-09-21  1:53     ` Jude DaShiell
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-09-20 16:15 UTC (permalink / raw)
  To: rn3aoh.g, help-gnu-emacs

Hi Eugene,

I appreciate the work you put behind this.

I am now able to use my usual emacs config *as is* with no changes on
Termux after I updated the emacs package with your fixes.

I no longer need to move `(package-initialize)` to init.el.
(Reference:
https://lists.gnu.org/archive/html/help-gnu-emacs/2016-04/msg00128.html )

Thanks!

On Tue, Sep 6, 2016 at 3:30 AM <rn3aoh.g@gmail.com> wrote:

> If anyone still cares about this issue, I have spent the last week
> stumbling around trying to figure out the actual cause of this bug.
>
> I am pretty sure I have nailed it, it results from Emacs having to run
> undumped due to Android's requirement for PIE executables and tripping over
> an upstream bug filed all the way back in 2013 because of this. I would
> really appreciate if anyone could tell me whether the solution I came up
> with is correct:
>
> https://github.com/termux/termux-packages/issues/423
>
> --
> Eugene Medvedev
>
-- 

Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-09-20 16:15   ` Kaushal Modi
@ 2016-09-21  1:53     ` Jude DaShiell
  2016-09-21 17:12       ` Kaushal Modi
  0 siblings, 1 reply; 22+ messages in thread
From: Jude DaShiell @ 2016-09-21  1:53 UTC (permalink / raw)
  To: Kaushal Modi, rn3aoh.g, help-gnu-emacs

Is it possible with a debug situation where a .emacs has to be debugged 
to run emacs --debug then key in some command that has emacs tell you 
what the first line is that has the error?

On Tue, 20 Sep 2016, Kaushal Modi wrote:

> Date: Tue, 20 Sep 2016 12:15:06
> From: Kaushal Modi <kaushal.modi@gmail.com>
> To: rn3aoh.g@gmail.com, help-gnu-emacs@gnu.org
> Subject: Re: Help debugging a backtrace
> 
> Hi Eugene,
>
> I appreciate the work you put behind this.
>
> I am now able to use my usual emacs config *as is* with no changes on
> Termux after I updated the emacs package with your fixes.
>
> I no longer need to move `(package-initialize)` to init.el.
> (Reference:
> https://lists.gnu.org/archive/html/help-gnu-emacs/2016-04/msg00128.html )
>
> Thanks!
>
> On Tue, Sep 6, 2016 at 3:30 AM <rn3aoh.g@gmail.com> wrote:
>
>> If anyone still cares about this issue, I have spent the last week
>> stumbling around trying to figure out the actual cause of this bug.
>>
>> I am pretty sure I have nailed it, it results from Emacs having to run
>> undumped due to Android's requirement for PIE executables and tripping over
>> an upstream bug filed all the way back in 2013 because of this. I would
>> really appreciate if anyone could tell me whether the solution I came up
>> with is correct:
>>
>> https://github.com/termux/termux-packages/issues/423
>>
>> --
>> Eugene Medvedev
>>
>

-- 




^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-09-21  1:53     ` Jude DaShiell
@ 2016-09-21 17:12       ` Kaushal Modi
  2016-09-22 18:52         ` Jude DaShiell
  0 siblings, 1 reply; 22+ messages in thread
From: Kaushal Modi @ 2016-09-21 17:12 UTC (permalink / raw)
  To: Jude DaShiell, rn3aoh.g, help-gnu-emacs

On Tue, Sep 20, 2016 at 9:53 PM Jude DaShiell <jdashiel@panix.com> wrote:

> Is it possible with a debug situation where a .emacs has to be debugged
> to run emacs --debug then key in some command that has emacs tell you
> what the first line is that has the error?
>

I am not sure what you mean by that.

When you run emacs --debug-init, it will show you an elisp backtrace of the
first error in your emacs config. If your config has no error, you will see
emacs start as usual. The backtrace will lead to the first line causing
that error.

Once your emacs session has started, and you want a backtrace on any error
that occurs later on in the session, do M-x toggle-debug-on-error. Then you
will get a backtrace on any error (even the harmless ones).


-- 

Kaushal Modi


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help debugging a backtrace
  2016-09-21 17:12       ` Kaushal Modi
@ 2016-09-22 18:52         ` Jude DaShiell
  0 siblings, 0 replies; 22+ messages in thread
From: Jude DaShiell @ 2016-09-22 18:52 UTC (permalink / raw)
  To: Kaushal Modi, rn3aoh.g, help-gnu-emacs

Thanks much, this is a huge help.  I didn't know exactly how to read 
back traces so ought to be able to fix things more effectively in 
future.

On Wed, 21 Sep 2016, Kaushal Modi wrote:

> Date: Wed, 21 Sep 2016 13:12:22
> From: Kaushal Modi <kaushal.modi@gmail.com>
> To: Jude DaShiell <jdashiel@panix.com>, rn3aoh.g@gmail.com,
>     help-gnu-emacs@gnu.org
> Subject: Re: Help debugging a backtrace
> 
> On Tue, Sep 20, 2016 at 9:53 PM Jude DaShiell <jdashiel@panix.com> wrote:
>
>> Is it possible with a debug situation where a .emacs has to be debugged
>> to run emacs --debug then key in some command that has emacs tell you
>> what the first line is that has the error?
>>
>
> I am not sure what you mean by that.
>
> When you run emacs --debug-init, it will show you an elisp backtrace of the
> first error in your emacs config. If your config has no error, you will see
> emacs start as usual. The backtrace will lead to the first line causing
> that error.
>
> Once your emacs session has started, and you want a backtrace on any error
> that occurs later on in the session, do M-x toggle-debug-on-error. Then you
> will get a backtrace on any error (even the harmless ones).
>
>
>

-- 




^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-09-22 18:52 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1147.1461781734.7477.help-gnu-emacs@gnu.org>
2016-09-06  7:26 ` Help debugging a backtrace rn3aoh.g
2016-09-20 16:15   ` Kaushal Modi
2016-09-21  1:53     ` Jude DaShiell
2016-09-21 17:12       ` Kaushal Modi
2016-09-22 18:52         ` Jude DaShiell
2016-04-27 18:28 Kaushal Modi
2016-04-27 19:01 ` Nick Dokos
2016-04-27 19:37   ` Kaushal Modi
2016-04-28 20:59     ` Kaushal Modi
2016-04-29 21:27       ` Michael Heerdegen
2016-04-29 21:36         ` Kaushal Modi
2016-04-29 22:56           ` Kaushal Modi
2016-05-01 14:22             ` Michael Heerdegen
2016-05-01 14:27               ` Michael Heerdegen
2016-05-01 19:05                 ` Kaushal Modi
2016-05-01 20:45                   ` Michael Heerdegen
2016-05-01 21:10                     ` Drew Adams
2016-05-02  4:20                       ` Kaushal Modi
2016-05-02  4:38                         ` Kaushal Modi
2016-05-02 14:38                           ` Michael Heerdegen
2016-05-02 15:10                             ` Kaushal Modi
2016-05-02 15:33                               ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.