all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Emanuel Berg <moasenwood@zoho.eu>, help-gnu-emacs@gnu.org
Subject: RE: Fatal error 11: Segmentation Fault
Date: Tue, 2 Apr 2019 18:37:35 -0700 (PDT)	[thread overview]
Message-ID: <5e7fb661-c090-4893-bcab-24ee4d96bea3@default> (raw)
In-Reply-To: <865zrw55gm.fsf@zoho.eu>

> >> If it is in my init files, how come it works
> >> once? I type this using Emacs.
> >
> > Wrong question, I think. The right question
> > is this: "If it _doesn't_ happen when
> > I _don't_ use my init file then what part of
> > my init file makes it happen?"
> 
> My init should by definition not be able to
> cause this, because Elisp shouldn't be able to
> crash Emacs C style - or correct me if I'm
> wrong, by supplying an example which I'll
> evaluate immediately! (crash-emacs) !
> 
> So it is rather some binary module which can
> only be initiated once. This could be a clue as
> to get there faster. Just thought someone might
> know or think of something...

If Emacs never crashes when you don't load
your init file then something in your init
file leads to it crashing.  There's no way
around that.


That something could be as simple as loading
other code that causes the problem.

And yes, ultimately it is C code that has the
bug.  But your init file is (apparently) doing
something that leads to that.

The crash is ultimately due to Emacs C code.
But who knows?  It could be something in your
setup or your OS or whatever that exposes the
Emacs problem.

> > It doesn't matter, for this, whether "it
> > works once". What matters is that it
> > (apparently) _always_ works if you don't load
> > your init file and it (apparently) sometimes
> > does not work if you do load your init file.
> 
> It works once. (kill-emacs), then 'emacs', or
> don't (kill-emacs), then 'emacs' (i.e.
> another Emacs instance) causes the crash
> every time.

Only when you use your init file, right?
What I've said is based on that understanding,
at least.

But if you can make Emacs crash without your
init file, then put that recipe in a report:
`M-x report-emacs-bug'.  So much the better.
In that case you've narrowed down your init
file to nothing. ;-)

> >> Besides, doing a "binary search" isn't so
> >> easy. Many files are interconnected. To mot
> >> load one file does mean commenting out
> >> `require's in lots'a others, as well as
> >> functions who uses their stuff, then
> >> functions that uses those functions, and
> >> so on.
> >
> > Not sure I understand your description there.
> 
> I have all my Elisp in different files,
> a.el, b.el, ..., n.el, tho they are not named
> thus, of course. All those are in a directory
> (with subdirs), called "emacs-init".
> In ~/.emacs, there is a loop that checks for
> files in that directory tree, which then loads
> 'em all. So if I add n-plus-one.el, which
> happens all the time, I don't edit ~/.emacs, it
> loads the new file along with everything else
> automatically. Ain't it cool stuff?
> 
> Well, in cases when binary search is called
> for, like this one, it is still sort'a cool in
> theory. Because I can just make a copy of the
> "emacs-init" directory, move the original one
> OOA, and then start removing files from the
> test directory. Right?

Removing files from your `load-path' only works
without raising an error if you only soft-require
them: (require 'foo nil t).  If you hard-require
a library that you've removed: (require 'foo)
then Emacs raises an error.

If you're looping and loading files in the loop
then try only half a loop, then 1/4, 1/8,...

> In principle, that's right. In practice, like
> I said, the files are all interconnected with
> `provide' and `require'. 

You do not need to explicitly require/load files
that are required by other files that you load,
as I'm sure you know.  So presumably you loop
only over the files you need to explicitly load.
They will load the files they require.

> If I remove one file,
> all files which require that file will have to
> be removed as well. Those, in turn, provide
> to other files which require THEM, and so on.

See above.  "Remove" (comment out or don't
include in your loading loop) only files that
you need explicitly to load, not files that get
loaded by those files.  Your loop should do that
anyway.

E.g., if a.el requires b.el and nothing requires
a.el then your loop should load a, not both a
and b.  Removing something from your loop should
not cause a problem.

> It can still be done obviously, only it takes
> a lot of time and isn't mechanical work.

Maybe so.  It should be _somewhat_ mechanical,
but yes, it requires some thought too.

Believe me, I know it can be less simple than
its abstract description.  And it can definitely
seem slow in the beginning - especially because
you have to start Emacs anew at each iteration,
and those first iterations can be long (loading
and initializing lots of stuff).

But just remember that guy who negotiated the
deal to double the number of rice grains on
consecutive chessboard squares...  Payoff comes
big and quick after several iterations.

What's the alternative?  Trying to reason about
all of your code at once?  Trying to guess what
you might have changed recently that introduced
a new problem?  Tweaking this or that, based on
some intuition?

You can use a debugger (e.g. gdb), of course.
But it can make sense to first narrow things
down a bit, _before_ jumping into a debugger.

> > My init file and the many files it loads are
> > likely more ugly and convoluted than yours
> > (and no, I'm not proud/bragging about that).
> > But binary search still helps and is not
> > that hard.
> 
> If by "convoluted" you mean interconnected
> (provide/require) then do tell how you do it.
> Commenting out stuff until many files are
> virtually empty but still provide/require
> each other?
> 
> Anyway I start this now... Now, all we need is
> a little Energon and a lot of luck.

Good luck.  And thanks for contributing your
bug report (when it comes), to improve Emacs.



  reply	other threads:[~2019-04-03  1:37 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02  1:33 Fatal error 11: Segmentation Fault Emanuel Berg
2019-04-02  2:39 ` Emanuel Berg
2019-04-02  2:48   ` Drew Adams
2019-04-02 15:50     ` Emanuel Berg
2019-04-02 16:27       ` Drew Adams
2019-04-02 23:54         ` Emanuel Berg
2019-04-03  1:37           ` Drew Adams [this message]
2019-04-03  5:30             ` Emanuel Berg
2019-04-03  6:47               ` Emanuel Berg
2019-04-03  7:08                 ` Eli Zaretskii
2019-04-03  7:49                   ` Emanuel Berg
2019-04-03  8:18               ` tomas
2019-04-03 10:51                 ` Using 'git bisect' to pinpoint errors in .emacs. Was: " Vegard Vesterheim
2019-04-03 11:14                   ` Eli Zaretskii
2019-04-03 12:47                     ` Vegard Vesterheim
2019-04-03 14:48                     ` Emanuel Berg
2019-04-03 12:14                   ` Skip Montanaro
2019-04-03 12:30                     ` Eli Zaretskii
2019-04-03 14:52                       ` Emanuel Berg
2019-04-03 15:41                         ` Eli Zaretskii
2019-04-03 15:47                           ` Emanuel Berg
2019-04-03 14:35                   ` Emanuel Berg
2019-04-04  7:40                     ` Vegard Vesterheim
2019-04-03 14:34                 ` Emanuel Berg
2019-04-03 16:29                   ` tomas
2019-04-03 17:06                     ` Drew Adams
2019-04-03 19:19                       ` tomas
2019-04-03 17:41                     ` Robert Thorpe
2019-04-03 21:03                       ` Emanuel Berg
2019-04-03 21:07                         ` Robert Thorpe
2019-04-03 21:16                           ` Emanuel Berg
2019-04-03 20:56                     ` Emanuel Berg
2019-04-02 17:14       ` Óscar Fuentes
2019-04-02 23:56         ` Emanuel Berg
2019-04-03  0:05           ` Emanuel Berg
2019-04-03  0:13             ` Emanuel Berg
2019-04-03  1:20               ` Óscar Fuentes
2019-04-03  1:28                 ` Óscar Fuentes
2019-04-03  2:33                 ` Emanuel Berg
2019-04-03  2:39                   ` Emanuel Berg
2019-04-03  4:47                 ` Emanuel Berg
2019-04-03  5:23                   ` Eli Zaretskii
2019-04-03  5:31                     ` Emanuel Berg
2019-04-03  5:56                       ` Eli Zaretskii
2019-04-03  6:48                         ` Emanuel Berg
2019-04-03  6:59                           ` Eli Zaretskii
2019-04-03  7:51                             ` Emanuel Berg
2019-04-03  8:12                               ` Eli Zaretskii
2019-04-03 14:21                                 ` Emanuel Berg
2019-04-03 14:36                                   ` Eli Zaretskii
2019-04-03 14:57                                     ` Emanuel Berg
2019-04-03 15:48                                       ` Eli Zaretskii
2019-04-03 21:05                                         ` Emanuel Berg
2019-04-04 12:51                                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e7fb661-c090-4893-bcab-24ee4d96bea3@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.