From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: frederik@ofb.net Newsgroups: gmane.emacs.bugs Subject: bug#25819: 25.1; Added by Package.el. Added by Package.el. Added by Package.el. Added by Package.el. Date: Tue, 21 Feb 2017 15:04:22 -0800 Message-ID: <20170221230422.GJ1204@ofb.net> References: <20170220201438.GG1204@ofb.net> <8ttw7n1925.fsf@fencepost.gnu.org> Reply-To: frederik@ofb.net NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1487718394 25318 195.159.176.226 (21 Feb 2017 23:06:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 21 Feb 2017 23:06:34 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 25819@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 22 00:06:29 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgJVs-00061n-Up for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Feb 2017 00:06:29 +0100 Original-Received: from localhost ([::1]:49037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgJVy-0005wh-Pf for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Feb 2017 18:06:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgJUZ-0005FV-5Q for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2017 18:05:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgJUU-0002a3-99 for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2017 18:05:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cgJUU-0002Zx-6V for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2017 18:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cgJUT-0002bq-Q7 for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2017 18:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: frederik@ofb.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Feb 2017 23:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25819 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 25819-submit@debbugs.gnu.org id=B25819.14877182709991 (code B ref 25819); Tue, 21 Feb 2017 23:05:01 +0000 Original-Received: (at 25819) by debbugs.gnu.org; 21 Feb 2017 23:04:30 +0000 Original-Received: from localhost ([127.0.0.1]:49388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgJTy-0002b5-Mq for submit@debbugs.gnu.org; Tue, 21 Feb 2017 18:04:30 -0500 Original-Received: from icgriddb04.seas.upenn.edu ([158.130.57.72]:56740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgJTy-0002ay-1s for 25819@debbugs.gnu.org; Tue, 21 Feb 2017 18:04:30 -0500 Original-Received: from [10.13.0.6] (helo=ofb.net) by ICGRIDDB04.SEAS.upenn.edu with esmtp (Exim 4.87) (envelope-from ) id 1cgJTw-0004nD-EP; Tue, 21 Feb 2017 18:04:28 -0500 Original-Received: from thutmose (unknown [24.7.113.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ofb.net (Postfix) with ESMTPSA id 3B61740EA6; Tue, 21 Feb 2017 15:04:23 -0800 (PST) Original-Received: from frederik by thutmose with local (Exim 4.88) (envelope-from ) id 1cgJTq-0006G2-GH; Tue, 21 Feb 2017 15:04:22 -0800 Content-Disposition: inline In-Reply-To: <8ttw7n1925.fsf@fencepost.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129637 Archived-At: On Tue, Feb 21, 2017 at 05:19:14PM -0500, Glenn Morris wrote: > frederik@ofb.net wrote: > > > In my ~/.emacs file, I get repeating lines like this: > [...] > > (package-initialize) > > > > (package-initialize) > > > > (package-initialize) > > The function package--ensure-init-file adds this line, but it takes care > to only do so if it's not already there. So it's hard to see how you can > end up with multiple copies. Can you find a reproducible sequence that > causes an extra copy to be added; or can you edebug > package--ensure-init-file to see why it adds multiple copies? > Thanks for the reply. Well, you prompted me to find a reproducible sequence. It turns out that the problem comes from when I start emacs as "root". (This happens automatically in ~/.xinitrc, for better or worse, where I create a screen session with an emacs running as root, which starts a server so that I can edit files using emacsclient as root) My /root/.emacs looks something like this: (setenv "HOME" "/home/frederik/") (setq savehist-file "/root/.emacs-history") (load "~/.emacs") (setenv "HOME" "/root/") Obviously this does not contain a "(package-initialize)" line, so the following test in package--ensure-init-file fails: ;; Don't visit the file if we don't have to. (with-temp-buffer (insert-file-contents user-init-file) (goto-char (point-min)) (re-search-forward "(package-initialize\\_>" nil 'noerror)) (by the way what's with the unnecessary optimization in the lines previous to these? ugh) I wasn't able to figure out why the "(package-initialize)" lines then get inserted in ~/.emacs rather than /root/.emacs, but I hope the above clues provide a good enough place for someone else to start debugging this. Thank you!