unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: 5303@debbugs.gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: cyd@stupidchicken.com, michael.albinus@gmx.de,
	Richard Stallman <rms@gnu.org>
Subject: bug#5303: 23.1.91; Cannot load .emacs-history from savehist.el
Date: Thu, 21 Jan 2010 20:24:30 +0200	[thread overview]
Message-ID: <83636v71up.fsf@gnu.org> (raw)
In-Reply-To: <e01d8a51001201702n578d0c7v7bd1ed91a4ab3674@mail.gmail.com>

> From: Lennart Borgman <lennart.borgman@gmail.com>
> Date: Thu, 21 Jan 2010 02:02:49 +0100
> Cc: Michael Albinus <michael.albinus@gmx.de>, drew.adams@oracle.com, cyd@stupidchicken.com, 
> 	5303@debbugs.gnu.org
> 
> On Wed, Jan 20, 2010 at 7:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > It doesn't happen for me with stock Emacs 23.1, so it _is_ a
> > regression.
> 
> A quick check with my old binaries shows that 2009-08-04 works but
> 2009-09-15 fails.
> 
> Some change in that period added tramp-completion-file-name-handler to
> file-name-handler-alist.
> Removing it from there makes (load "c:/emacs-history") succeed again.
> 
> Note however that tramp-completion-file-name-handler run the real handler.
> So it looks more like it is the presence of the pattern
> 
>   ("\\`\\([a-zA-Z]:\\)?/[^/]*\\'" . tramp-completion-file-name-handler)
> 
> in file-name-handler-alist that causes the problem. Which probably
> means that the problem is in `load' as Eli has suggested.

To fix the problem (which I also believe is in `load' or maybe between
`load' and `openp'), I need to better understand some of the code in
`load'.

Would someone who knows please help me answer the following questions
regarding the fragment below?  Stefan? Yidong? Richard? anyone?

The questions are:

  . Why do we test for ".elc" OR non-zero return value from
    safe_to_load_p?  What is the purpose of handling files without the
    .elc extension as byte-compiled?

  . Was safe_to_load_p intended to return non-zero value for invalid
    file descriptors such as -2?


  if (!bcmp (SDATA (found) + SBYTES (found) - 4,
	     ".elc", 4)
      || (version = safe_to_load_p (fd)) > 0)
    /* Load .elc files directly, but not when they are
       remote and have no handler!  */
    {
      if (fd != -2)
	{
	  struct stat s1, s2;
	  int result;

	  GCPRO3 (file, found, hist_file_name);

	  if (version < 0
	      && ! (version = safe_to_load_p (fd)))
	    {
	      safe_p = 0;
	      if (!load_dangerous_libraries)
		{
		  if (fd >= 0)
		    emacs_close (fd);
		  error ("File `%s' was not compiled in Emacs",
			 SDATA (found));
		}
	      else if (!NILP (nomessage) && !force_load_messages)
		message_with_string ("File `%s' not compiled in Emacs", found, 1);
	    }

	  compiled = 1;

	  efound = ENCODE_FILE (found);

#ifdef DOS_NT
	  fmode = "rb";
#endif /* DOS_NT */
	  stat ((char *)SDATA (efound), &s1);
	  SSET (efound, SBYTES (efound) - 1, 0);
	  result = stat ((char *)SDATA (efound), &s2);
	  SSET (efound, SBYTES (efound) - 1, 'c');

	  if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
	    {
	      /* Make the progress messages mention that source is newer.  */
	      newer = 1;

	      /* If we won't print another message, mention this anyway.  */
	      if (!NILP (nomessage) && !force_load_messages)
		{
		  Lisp_Object msg_file;
		  msg_file = Fsubstring (found, make_number (0), make_number (-1));
		  message_with_string ("Source file `%s' newer than byte-compiled file",
				       msg_file, 1);
		}
	    }
	  UNGCPRO;
	}
    }
  else
    {
      /* We are loading a source file (*.el).  */
      if (!NILP (Vload_source_file_function))
	{
	  Lisp_Object val;

	  if (fd >= 0)
	    emacs_close (fd);
	  val = call4 (Vload_source_file_function, found, hist_file_name,
		       NILP (noerror) ? Qnil : Qt,
		       (NILP (nomessage) || force_load_messages) ? Qnil : Qt);
	  return unbind_to (count, val);
	}
    }






  reply	other threads:[~2010-01-21 18:24 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8F73D1539CE042B8A9B48F767127C43B@us.oracle.com>
2010-01-16 19:33 ` bug#5303: 23.1.91; Cannot load .emacs-history from savehist.el Chong Yidong
2010-01-16 20:03   ` Lennart Borgman
2010-01-16 21:11     ` Kevin Rodgers
2010-01-17 16:54     ` Michael Albinus
2010-01-17 16:58       ` Lennart Borgman
2010-01-17 17:18         ` Michael Albinus
2010-01-17 19:46           ` Lennart Borgman
2010-01-19 13:40             ` Michael Albinus
2010-01-19 17:39               ` Drew Adams
2010-01-19 19:28                 ` Eli Zaretskii
2010-01-19 19:30                   ` Chong Yidong
2010-01-19 19:36                   ` Michael Albinus
2010-01-19 21:24                     ` Eli Zaretskii
2010-01-19 22:13                       ` Eli Zaretskii
2010-01-20  1:25                       ` Lennart Borgman
2010-01-20  8:44                       ` Michael Albinus
2010-01-20  8:46                         ` Lennart Borgman
2010-01-20  8:56                           ` Michael Albinus
2010-01-20  9:02                             ` Lennart Borgman
2010-01-20  9:45                         ` Michael Albinus
2010-01-20 10:39                           ` Eli Zaretskii
2010-01-20 10:50                             ` Michael Albinus
2010-01-19 19:37                   ` Drew Adams
2010-01-19 19:44                     ` Eli Zaretskii
2010-01-19 19:52                       ` Drew Adams
2010-01-19 21:31                         ` Eli Zaretskii
2010-01-19 20:01               ` Lennart Borgman
2010-01-20  9:00                 ` Michael Albinus
2010-01-20  9:04                   ` Lennart Borgman
2010-01-20 10:13                     ` Michael Albinus
2010-01-20 10:38                       ` Lennart Borgman
2010-01-20 12:01                         ` Michael Albinus
2010-01-20 12:03                           ` Lennart Borgman
2010-01-20 12:15                             ` Michael Albinus
2010-01-20 12:21                               ` Lennart Borgman
2010-01-20 15:32                           ` Drew Adams
2010-01-20 15:41                             ` Michael Albinus
2010-01-20 17:33                               ` Drew Adams
2010-01-20 18:18                               ` Eli Zaretskii
2010-01-21  1:02                                 ` Lennart Borgman
2010-01-21 18:24                                   ` Eli Zaretskii [this message]
2010-01-21 18:42                                     ` Chong Yidong
2010-01-21 20:41                                       ` Chong Yidong
2010-01-20 18:17                             ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83636v71up.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=5303@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=michael.albinus@gmx.de \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=rms@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).