明けまして、おめでとうございます。

昨年はEmacs 25.1がリリースされた一方で、
unexec問題によりGNU Emacsが
危機に立たされました。

そんな中で昨日は、
Emacs 25.2 pretetがリリース
されました。

unexec問題を解決すべく、
Daniel Colascione氏は
portable dumperパッチ
を出しました。

テスト段階に入った ところで、
バグを見付けたため、
それを修正してからブランチに取り込む予定
です。

> Has anyone had a chance to play around with the portable dumper branch, and to
> review the changes? I'd love to hear some thoughts.

I've found that pdumper does awful things to weak hash tables restored
from dump. I'm fixing that bug --- I'll push when that bit works.

彼は、
flicker-free double-buffered patch
を出すほどの猛者です。

だから、
彼はやってくれると信じています。

世界中にこれだけ熱狂的ファンがいるEmacsが、
滅びるなんてことはまず考えられません。

それにEmacsの実装は無数に存在 します。

2000年問題を乗り切ったように、
Emacs危機も必ず乗り越えてくれると
僕は信じています。

人間には
「火事場の馬鹿力」が象徴するように
とてつもない力が秘められています。

僕はGNU Emacsの存続を信じて、
今年も使い続けます。

もちろん新生日刊Emacsも更新し続けます。

今年もよろしくお願いします。

Debian GNU/Linuxは大丈夫

ちょっと気になってしまいましたので、
コードを追ってみました。

僕はDebian GNU/Linux testingの環境で
glibc 2.24-8を使っていますが、

./configure で

checking whether malloc is Doug Lea style... no

と出ています。

config.hでは

/* Define to 1 if the system memory allocator is Doug Lea style, with malloc
   hooks and malloc_set_state. */
/* #undef DOUG_LEA_MALLOC */

となります。

そこで、 malloc_[gs]et_state
ソースコードを検索してみると、
このように #ifdef DOUG_LEA_MALLOC
囲まれていることがわかります。

#ifdef DOUG_LEA_MALLOC

略
/* Get and free this pointer; useful around unexec.  */
void
alloc_unexec_pre (void)
{
  malloc_state_ptr = malloc_get_state ();
}
void
alloc_unexec_post (void)
{
  free (malloc_state_ptr);
}

/* Restore the dumped malloc state.  Because malloc can be invoked
   even before main (e.g. by the dynamic linker), the dumped malloc
   state must be restored as early as possible using this special hook.  */
static void
malloc_initialize_hook (void)
{
  static bool malloc_using_checking;

  if (! initialized)
    {
      略
    }
  else
    {
      略
      malloc_set_state (malloc_state_ptr);
# ifndef XMALLOC_OVERRUN_CHECK
      alloc_unexec_post ();
# endif
    }
}

略
#endif

となり、
削除される予定の

  • malloc_get_state
  • malloc_set_state

は使われません。

lisp.hでも空定義になっています。

#ifdef DOUG_LEA_MALLOC
extern void alloc_unexec_pre (void);
extern void alloc_unexec_post (void);
#else
INLINE void alloc_unexec_pre (void) {}
INLINE void alloc_unexec_post (void) {}
#endif

だから、Emacsのビルドは問題なくできます。

glibcの開発版のNEWS を見ても

The malloc_get_state and malloc_set_state functions have been removed.
Already-existing binaries that dynamically link to these functions will
get a hidden implementation in which malloc_get_state is a stub.  As far
as we know, these functions are used only by GNU Emacs and this change
will not adversely affect already-built Emacs executables.  Any undumped
Emacs executables, which normally exist only during an Emacs build, should
be rebuilt by re-running “./configure; make” in the Emacs build tree.

他の環境ではどうかわかりませんが、
そう悲観する問題ではありませんよね。

本日もお読みいただき、ありがとうございました。参考になれば嬉しいです。