Subject: bug#5309 closed by Eli Zaretskii <[email-masked]> (Re: bug#5303: 23.1.91; Cannot load .emacs-history from savehist.el)

From: [email-masked] (Emacs bug Tracking System)
Date: Fri, 22 Jan 2010 08:55:04 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs,w32 package:

#5303: 23.1.91; Cannot load .emacs-history from savehist.el

It has been closed by Eli Zaretskii <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Eli Zaretskii <[email-masked]> by
replying to this email.

-- 
5303: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5303
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#5303: 23.1.91; Cannot load .emacs-history from savehist.el
From: Eli Zaretskii <[email-masked]>
To: Chong Yidong <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Fri, 22 Jan 2010 10:54:42 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Chong Yidong <[email-masked]>
> Cc: [email-masked], [email-masked],
>         Stefan Monnier <[email-masked]>,
>         Richard Stallman <[email-masked]>
> Date: Thu, 21 Jan 2010 15:41:06 -0500
> 
> Chong Yidong <[email-masked]> writes:
> 
> >>   . Was safe_to_load_p intended to return non-zero value for invalid
> >>     file descriptors such as -2?
> >
> > I think that is a bug.
> 
> Does it fix the bug if safe_to_load_p returns 0 when the call to
> emacs_read on line 895 returns a value <= 0?

It does, but I prefer not to call safe_to_load_p at all in that case.
I've installed a slightly different fix, see below.

(There's another, possibly similar bug: load-file fails for
C:/the-file.el.gz because jka-compr signals a wrong type argument
error.  But that problem existed with the original Fload as well.  I
will file a separate bug and see what I can find there.)

2010-01-22  Eli Zaretskii  <[email-masked]>

	* lread.c (Fload): Don't treat files without .elc extension as
	byte-compiled if they are ``magic'', i.e. `openp' returned -2 for
	them.  (bug#5303)

=== modified file 'src/lread.c'
--- src/lread.c	2010-01-13 08:35:10 +0000
+++ src/lread.c	2010-01-22 08:35:48 +0000
@@ -1155,7 +1155,7 @@ Return t if the file exists and loads su
 
   if (!bcmp (SDATA (found) + SBYTES (found) - 4,
 	     ".elc", 4)
-      || (version = safe_to_load_p (fd)) > 0)
+      || (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
     /* Load .elc files directly, but not when they are
        remote and have no handler!  */
     {

Subject: 23.1.91; Cannot load .emacs-history from savehist.el
From: "Drew Adams" <[email-masked]>
To: <[email-masked]>
Date: Sun, 3 Jan 2010 17:48:11 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Sending this again, but with a much smaller attachment (46 KB), after having
pared down the file. I intended to send this new attachment as a reply to the
original bug report, but I never received that mail, so I couldn't reply to it.
I waited almost 7 hours.

I'm guessing that the original report was somehow lost or was perhaps rejected
because of the large (568 KB) attachment size (?). Dunno. (Seems like a
submitter should at least receive a rejection notice in that case, but I
received nothing.)

So, apologies for creating a new bug, but I have no bug number from the first
report attempt to reply to. Hopefully this time it will get through. If the
original bug does get opened, then we can delete that. The original message is
below, so you have all the info in this bug report.

HTH.

-----------------------------------------
From: Drew Adams Sent: Sunday, January 03, 2010 11:14 AM
To: [email-masked]'
Subject: 23.1.91; Cannot load .emacs-history from savehist.el

emacs -Q
Trying to load the attached file raises the error "End of file during
parsing: c:/.emacs-history".
 
There is no real end-of-file problem, however: This file was created by
savehist.el using Emacs 23.1, and it loads fine in all releases of Emacs
(20 through 23).  An error is raised only for the Emacs 23.1.91.1
pretest.

NOTE: I had to attach a copy of the original file, because Windows doesn't allow
me to attach a file named `.emacs-history'. But trying to load that copy,
`emacs-history', also raises the same error.

However, something weird is going on. If the file is in c:/ when I try to load
it, then the error is raised. If the file is in c:/mydir/ when I try to load it,
then it loads with no error. I do not understand this at all. Exactly the same
file, different behavior. And it doesn't matter whether I make the file copy
using Emacs C-x C-w or using Windows copy+paste.
 
Dunno if simply attaching the file will enable you to reproduce
the bug - hope so.

In GNU Emacs 23.1.91.1 (i386-mingw-nt5.1.2600)
 of 2010-01-02 on PRETEST
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'