Subject: bug#17407: obsolete-autoloads can clobber regular autoloads

From: Glenn Morris <[email-masked]>
Date: Mon, 05 May 2014 03:21:46 -0400

Package: emacs
Version: 24.4.50

Have an up-to-date build of current trunk:

cd lisp
make autoloads
cp loaddefs.el loaddefs.el.BAK
echo ";;foo" >> mail/rmailsum.el
make autoloads

diff loaddefs.el.BAK loaddefs.el
  - see that all the rmail.el autoloads have vanished

I believe this explains the failure in http://hydra.nixos.org/build/10824210 .

Analysis:

The batch-update-autoloads in `make autoload' extracts autoloads from
rmailsum.el into rmail.el, modifying the hash in the latter and the
file's timestamp. It then calles `make obsolete-autoloads'.
This calls batch-update-autoloads again. This notices that rmail.el has
a changed timestamp, so rescans it for autoloads. Because
generate-autoload-cookie is set to a non-standard value, it finds none,
so it erases them all from loaddefs.el.

I don't understand why `obsolete-autoloads' is scanning rmail.el, when
it calls "-f batch-update-autoloads ${lisp}/obsolete".
Why isn't it just restricting itself to scanning obsolete/, as instructed?