From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harald Hanche-Olsen Newsgroups: gmane.emacs.devel Subject: Re: (aset UNIBYTE-STRING MULTIBYTE-CHAR) Date: Wed, 07 May 2008 21:31:12 +0200 (CEST) Message-ID: <20080507.213112.10351177.hanche@math.ntnu.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1210188699 11976 80.91.229.12 (7 May 2008 19:31:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 May 2008 19:31:39 +0000 (UTC) Cc: eliz@gnu.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 07 21:32:15 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JtpMy-0008BP-GU for ged-emacs-devel@m.gmane.org; Wed, 07 May 2008 21:32:04 +0200 Original-Received: from localhost ([127.0.0.1]:58381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtpMG-0000H3-F8 for ged-emacs-devel@m.gmane.org; Wed, 07 May 2008 15:31:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JtpMC-0000Gu-MA for emacs-devel@gnu.org; Wed, 07 May 2008 15:31:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JtpMB-0000Ga-Hb for emacs-devel@gnu.org; Wed, 07 May 2008 15:31:16 -0400 Original-Received: from [199.232.76.173] (port=58738 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtpMB-0000GX-FG for emacs-devel@gnu.org; Wed, 07 May 2008 15:31:15 -0400 Original-Received: from fiinbeck.math.ntnu.no ([129.241.15.140]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JtpMA-00015p-Fr for emacs-devel@gnu.org; Wed, 07 May 2008 15:31:14 -0400 Original-Received: (qmail 61600 invoked from network); 7 May 2008 19:31:12 -0000 Original-Received: from localhost (127.0.0.1) by localhost with SMTP; 7 May 2008 19:31:12 -0000 X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.0.51 on Emacs 23.0.60 / Mule 6.0 (HANACHIRUSATO) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:96706 Archived-At: This works as it should in the latest CVS: (setq foo (make-string 4 ?a)) (aset foo 1 ?€) ; <= that's a euro sign But this fails: (setq foo (make-string 4 ?a)) (aset foo 1 ?å) (aset foo 1 ?€) ; => Error: args out of range The problem seems to lie in these lines (2095-2107) from data.c: if (XINT (newelt) >= 0 && ! SINGLE_BYTE_CHAR_P (XINT (newelt))) { int i; for (i = SBYTES (array) - 1; i >= 0; i--) if (SREF (array, i) >= 0x80) args_out_of_range (array, newelt); /* ARRAY is an ASCII string. Convert it to a multibyte string, and try `aset' again. */ STRING_SET_MULTIBYTE (array); return Faset (array, idx, newelt); } SSET (array, idxval, XINT (newelt)); I am sure the test for members >= 0x80 is there for a good reason, but it clearly screws up this case and makes the fix rather less useful than it should have been. I don't know emacs internals well enough to suggest a fix. And yes, this did bite in real life: It caused mew to choke on a malformed spam email. No disaster obviously, but inconvenient. - Harald PS. My apologies for messing up threading; I wasn't on the list when the message I am responding to was posted on 2008-07-15, so I don't know its message-id.