all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: rms@gnu.org, handa@m17n.org
Subject: Re: [ihs_4664@yahoo.com: Re: Crash calling md5 for a list of buffers]
Date: Fri, 23 Jan 2004 09:22:45 +0900 (JST)	[thread overview]
Message-ID: <200401230022.JAA02106@etlken.m17n.org> (raw)
In-Reply-To: <E1Ajk3o-0005Wo-Nv@fencepost.gnu.org> (message from Richard Stallman on Thu, 22 Jan 2004 14:00:12 -0500)

In article <E1Ajk3o-0005Wo-Nv@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:

> Can you take a look at this?
> ------- Start of forwarded message -------
> To: gnu-emacs-bug@moderators.isc.org
> From: Kevin Rodgers <ihs_4664@yahoo.com>
> Newsgroups: gnu.emacs.bug
> Date: Wed, 21 Jan 2004 10:20:41 -0700
[...]
> Subject: Re: Crash calling md5 for a list of buffers
[...]
>>  Try to eval (mapcar '(lambda (b) (md5 b nil nil 'raw-text)) (buffer-list)).
>>  (mapcar 'md5 (buffer-list)) doesn't work for all buffers (really I don't 
>>  understand why - probably the coding system determined automagically is
>>  not always valid for Fmd5).

I found that function md5 (in fns.c) doesn't pay attention
to the case that the current buffer is different from OBJECT
arg.  Coding system has nothing to do with this bug.  As
I've just committed the atttached change, please try again.
As this bug is serious, I committed it also to RC branch.

> There is something screwy with that file that causes Emacs to
> think it has 1 more character (459097) than it really does (459096).

That's normal because buffer position starts from 1, not 0.

---
Ken'ichi HANDA
handa@m17n.org

2004-01-23  Kenichi Handa  <handa@m17n.org>

	* fns.c (Fmd5): If OBJECT is a buffer different from the current
	one, set buffer to OBJECT temporarily.

Index: fns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fns.c,v
retrieving revision 1.354
diff -u -c -r1.354 fns.c
cvs server: conflicting specifications of output style
*** fns.c	29 Dec 2003 13:51:54 -0000	1.354
--- fns.c	23 Jan 2004 00:09:20 -0000
***************
*** 5454,5465 ****
      }
    else
      {
        CHECK_BUFFER (object);
  
        bp = XBUFFER (object);
  
        if (NILP (start))
! 	b = BUF_BEGV (bp);
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (start);
--- 5454,5471 ----
      }
    else
      {
+       struct buffer *prev = current_buffer;
+ 
+       record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ 
        CHECK_BUFFER (object);
  
        bp = XBUFFER (object);
+       if (bp != current_buffer)
+ 	set_buffer_internal (bp);
  
        if (NILP (start))
! 	b = BEGV;
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (start);
***************
*** 5467,5473 ****
  	}
  
        if (NILP (end))
! 	e = BUF_ZV (bp);
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (end);
--- 5473,5479 ----
  	}
  
        if (NILP (end))
! 	e = ZV;
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (end);
***************
*** 5477,5483 ****
        if (b > e)
  	temp = b, b = e, e = temp;
  
!       if (!(BUF_BEGV (bp) <= b && e <= BUF_ZV (bp)))
  	args_out_of_range (start, end);
  
        if (NILP (coding_system))
--- 5483,5489 ----
        if (b > e)
  	temp = b, b = e, e = temp;
  
!       if (!(BEGV <= b && e <= ZV))
  	args_out_of_range (start, end);
  
        if (NILP (coding_system))
***************
*** 5544,5549 ****
--- 5550,5560 ----
  	}
  
        object = make_buffer_string (b, e, 0);
+       if (prev != current_buffer)
+ 	set_buffer_internal (prev);
+       /* Discard the unwind protect for recovering the current
+ 	 buffer.  */
+       specpdl_ptr--;
  
        if (STRING_MULTIBYTE (object))
  	object = code_convert_string1 (object, coding_system, Qnil, 1);

           reply	other threads:[~2004-01-23  0:22 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <E1Ajk3o-0005Wo-Nv@fencepost.gnu.org>]

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

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

  git send-email \
    --in-reply-to=200401230022.JAA02106@etlken.m17n.org \
    --to=handa@m17n.org \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.