all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: niwtrx@icloud.com, 38912@debbugs.gnu.org, Pip Cet <pipcet@gmail.com>
Subject: bug#38912: 27.0.60; PDumper meets segmentation fault when evil is loaded
Date: Mon, 06 Jan 2020 13:13:31 -0500	[thread overview]
Message-ID: <jwvimlozck4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83h818ebmr.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 06 Jan 2020 19:30:04 +0200")

The problem is simply that `sxhash` doesn't use the same "rules" about
which objects are compared by identity and which objects are compared
by contents.

In `src/fns.c`, when we compare `internal_equal` and `sxhash`, we see
that `sxhash` only looks at the contents of vectorlikes if they are:

      BIGNUMP, VECTORP, RECORDP, or BOOL_VECTOR_P

whereas `internal_equal` looks inside many more vectorlikes:

	if (BIGNUMP (o1))
	  return mpz_cmp (*xbignum_val (o1), *xbignum_val (o2)) == 0;
	if (OVERLAYP (o1))
	  {
	    if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2),
				 equal_kind, depth + 1, ht)
		|| !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
				    equal_kind, depth + 1, ht))
	      return false;
	    o1 = XOVERLAY (o1)->plist;
	    o2 = XOVERLAY (o2)->plist;
	    depth++;
	    goto tail_recurse;
	  }
	if (MARKERP (o1))
	  {
	    return (XMARKER (o1)->buffer == XMARKER (o2)->buffer
		    && (XMARKER (o1)->buffer == 0
			|| XMARKER (o1)->bytepos == XMARKER (o2)->bytepos));
	  }
	/* Boolvectors are compared much like strings.  */
	if (BOOL_VECTOR_P (o1))
	  {
	    EMACS_INT size = bool_vector_size (o1);
	    if (size != bool_vector_size (o2))
	      return false;
	    if (memcmp (bool_vector_data (o1), bool_vector_data (o2),
			bool_vector_bytes (size)))
	      return false;
	    return true;
	  }
	if (WINDOW_CONFIGURATIONP (o1))
	  {
	    eassert (equal_kind != EQUAL_NO_QUIT);
	    return compare_window_configurations (o1, o2, false);
	  }

	/* Aside from them, only true vectors, char-tables, compiled
	   functions, and fonts (font-spec, font-entity, font-object)
	   are sensible to compare, so eliminate the others now.  */
	if (size & PSEUDOVECTOR_FLAG)
	  {
	    if (((size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
		< PVEC_COMPILED)
	      return false;
	    size &= PSEUDOVECTOR_SIZE_MASK;
	  }
	for (ptrdiff_t i = 0; i < size; i++)
	  {
	    Lisp_Object v1, v2;
	    v1 = AREF (o1, i);
	    v2 = AREF (o2, i);
	    if (!internal_equal (v1, v2, equal_kind, depth + 1, ht))
	      return false;
	  }
	return true;
      }
      break;

so the problem doesn't affect only byte-compiled objects but also
overlays, markers, windowconfigs, chartables, and fonts, AFAICT.

The fix should be to make `sxhash` follow the same rules as `internal_equal`.

This is a fairly long-standing problem, so unless it is newly triggered
in "normal" circumstances in Emacs-27, the fix is probably best on
`master`.


        Stefan






  reply	other threads:[~2020-01-06 18:13 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04  1:49 bug#38912: 27.0.60; PDumper meets segmentation fault when evil is loaded NiwTinray via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-04  9:17 ` Eli Zaretskii
     [not found]   ` <D1473DD8-48F8-4204-80B5-BE6396B8B668@icloud.com>
2020-01-05 18:45     ` Eli Zaretskii
2020-01-06 15:51       ` Pip Cet
2020-01-06 16:34         ` Eli Zaretskii
2020-01-06 16:38           ` Pip Cet
2020-01-06 17:20             ` Eli Zaretskii
2020-01-06 17:01           ` Daniel Colascione
2020-01-06 17:13             ` Pip Cet
2020-01-06 17:30               ` Eli Zaretskii
2020-01-06 18:13                 ` Stefan Monnier [this message]
2020-01-06 18:19                   ` Noam Postavsky
2020-01-06 18:29                   ` Eli Zaretskii
2020-01-07 19:31                   ` Pip Cet
2020-01-07 20:03                     ` Stefan Monnier
2020-01-07  2:38               ` Paul Eggert
2020-01-07  3:34                 ` dancol
2020-01-07 14:16                   ` Stefan Monnier
2020-01-07 14:16                   ` Stefan Monnier
2020-01-07 19:32                     ` Paul Eggert
2020-01-07 19:32                     ` Paul Eggert
2020-01-07 15:47                 ` Eli Zaretskii
2020-01-07 17:37                   ` Stefan Monnier
2020-01-07 17:43                     ` Eli Zaretskii
2020-01-07 18:01                       ` Stefan Monnier
2020-01-07 18:11                         ` Eli Zaretskii
2020-01-07 18:47                           ` Stefan Monnier
2020-01-07 18:47                           ` Stefan Monnier
2020-01-07 18:29                         ` martin rudalics
2020-01-07 18:29                         ` martin rudalics
2020-01-07 18:43                           ` Stefan Monnier
2020-01-07 18:58                             ` martin rudalics
2020-01-07 18:43                           ` Stefan Monnier
2020-01-07 18:01                       ` Stefan Monnier
2020-01-07 17:43                     ` Eli Zaretskii
2020-01-07 17:37                   ` Stefan Monnier
2020-01-06 17:13             ` Pip Cet
2020-01-06 17:25             ` Eli Zaretskii
2020-01-07 23:43             ` Richard Stallman
2020-01-06 17:10       ` Daniel Colascione
2020-03-05  7:14         ` Eli Zaretskii
2020-03-09  2:15           ` Daniel Colascione
2020-03-09  3:26             ` Eli Zaretskii
2021-06-24 16:30               ` bug#32503: 26.1; Byte-compiled functions don't hash consistently Lars Ingebrigtsen
2022-04-28 11:41                 ` bug#38912: 27.0.60; PDumper meets segmentation fault when evil is loaded Lars Ingebrigtsen

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=jwvimlozck4.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=38912@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=niwtrx@icloud.com \
    --cc=pipcet@gmail.com \
    /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.