all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#2878: bindat-pack returns unibyte string for emacs 22 but multibyte string for emacs 23
@ 2009-04-03 15:20 ` Yee Keat Phuah
       [not found]   ` <handler.2878.B.123877206328398.ack@emacsbugs.donarmstrong.com>
  2009-05-04  1:25   ` bug#2878: marked as done " Emacs bug Tracking System
  0 siblings, 2 replies; 3+ messages in thread
From: Yee Keat Phuah @ 2009-04-03 15:20 UTC (permalink / raw)
  To: emacs-pretest-bug

Hi,

This piece of code returned nil on emacs 22 and t on emacs 23.
(let* ((spec `((:method-id     vec 4)))
       (data  `((:ref-type  . ,(vector #x00 #x00 #x00 #x00 #x00 #x00 #x00 #x39))
		(:method-id . ,(vector #x09 #x90 #xec #xd8))))
       (packed (bindat-pack spec data)))
  (multibyte-string-p packed))

And because of it being multibyte, when i want to send it over the
wire to a sub process in a binary data format, it gets transformed and
the sub process does not get a byte-by-byte equivalent of the
concatenation of the 2 vectors above. I have tried using
string-as-unibyte and the effect is still the same.

-- 
Cheers,
Phuah Yee Keat






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#2878: Acknowledgement (bindat-pack returns unibyte string for emacs 22 but multibyte string for emacs 23)
       [not found]   ` <handler.2878.B.123877206328398.ack@emacsbugs.donarmstrong.com>
@ 2009-04-03 16:01     ` Yee Keat Phuah
  0 siblings, 0 replies; 3+ messages in thread
From: Yee Keat Phuah @ 2009-04-03 16:01 UTC (permalink / raw)
  To: 2878

Hi,

snogglethorpe from #emacs have suggested this patch and it worked for
my elisp code

diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el
index 4843e27..154bffe 100644
--- a/lisp/emacs-lisp/bindat.el
+++ b/lisp/emacs-lisp/bindat.el
@@ -609,9 +609,9 @@ Optional fourth arg BINDAT-IDX is the starting
offset into BINDAT-RAW."
   (let ((no-return bindat-raw))
     (unless bindat-idx (setq bindat-idx 0))
     (unless bindat-raw
-      (setq bindat-raw (make-vector (+ bindat-idx (bindat-length spec
struct)) 0)))
+      (setq bindat-raw (make-string (+ bindat-idx (bindat-length spec
struct)) 0)))
     (bindat--pack-group struct spec)
-    (if no-return nil (concat bindat-raw))))
+    (if no-return nil bindat-raw)))


On Fri, Apr 3, 2009 at 11:25 PM, Emacs bug Tracking System
<owner@emacsbugs.donarmstrong.com> wrote:
>
> Thank you for filing a new bug report with Emacs.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  Emacs Bugs <bug-gnu-emacs@gnu.org>
>
> If you wish to submit further information on this problem, please
> send it to 2878@emacsbugs.donarmstrong.com, as before.
>
> Please do not send mail to owner@emacsbugs.donarmstrong.com unless you wish
> to report a problem with the Bug-tracking system.
>
>
> --
> 2878: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2878
> Emacs Bug Tracking System
> Contact owner@emacsbugs.donarmstrong.com with problems
>



-- 
Cheers,
Phuah Yee Keat






^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#2878: marked as done (bindat-pack returns unibyte string for  emacs 22 but multibyte string  for emacs 23)
  2009-04-03 15:20 ` bug#2878: bindat-pack returns unibyte string for emacs 22 but multibyte string for emacs 23 Yee Keat Phuah
       [not found]   ` <handler.2878.B.123877206328398.ack@emacsbugs.donarmstrong.com>
@ 2009-05-04  1:25   ` Emacs bug Tracking System
  1 sibling, 0 replies; 3+ messages in thread
From: Emacs bug Tracking System @ 2009-05-04  1:25 UTC (permalink / raw)
  To: Chong Yidong

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]


Your message dated Sun, 03 May 2009 21:18:02 -0400
with message-id <87vdohoed1.fsf@cyd.mit.edu>
and subject line Re: bug#2878: Acknowledgement (bindat-pack returns unibyte string for  emacs 22 but multibyte string for emacs 23)
has caused the Emacs bug report #2878,
regarding bindat-pack returns unibyte string for emacs 22 but multibyte string  for emacs 23
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
2878: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2878
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 3500 bytes --]

From: Yee Keat Phuah <ykphuah@gmail.com>
To: emacs-pretest-bug@gnu.org
Subject: bindat-pack returns unibyte string for emacs 22 but multibyte string  for emacs 23
Date: Fri, 3 Apr 2009 23:20:56 +0800
Message-ID: <9caafe030904030820i4dbda89coc97dc2066f8b1a05@mail.gmail.com>

Hi,

This piece of code returned nil on emacs 22 and t on emacs 23.
(let* ((spec `((:method-id     vec 4)))
       (data  `((:ref-type  . ,(vector #x00 #x00 #x00 #x00 #x00 #x00 #x00 #x39))
		(:method-id . ,(vector #x09 #x90 #xec #xd8))))
       (packed (bindat-pack spec data)))
  (multibyte-string-p packed))

And because of it being multibyte, when i want to send it over the
wire to a sub process in a binary data format, it gets transformed and
the sub process does not get a byte-by-byte equivalent of the
concatenation of the 2 vectors above. I have tried using
string-as-unibyte and the effect is still the same.

-- 
Cheers,
Phuah Yee Keat



[-- Attachment #3: Type: message/rfc822, Size: 2254 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: Miles Bader <miles@gnu.org>
Cc: Yee Keat Phuah <ykphuah@gmail.com>, 2878-done@emacsbugs.donarmstrong.com
Subject: Re: bug#2878: Acknowledgement (bindat-pack returns unibyte string for  emacs 22 but multibyte string for emacs 23)
Date: Sun, 03 May 2009 21:18:02 -0400
Message-ID: <87vdohoed1.fsf@cyd.mit.edu>

Miles Bader <miles@gnu.org> writes:

> I think it should be checked in.  I don't have intimate familiarity
> with this code, but I did look at the problem and make the patch.
>
> The other code in the file stores numerical values into the
> `bindat-raw' using aset, and then wants to return the whole thing as a
> unicode string containing those byte values.  The old code made a
> vector, stored into it, and turned the vector into a string using
> `concat' -- however that ends up making a _multibyte_ string (I don't
> know whether this is a bug in concat or not).  The new method of
> making a string initially and storing directly into it results in a
> unibyte string, which is what is desired (this method is also more
> efficient).

OK, I've checked in your fix.  Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-04  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87vdohoed1.fsf@cyd.mit.edu>
2009-04-03 15:20 ` bug#2878: bindat-pack returns unibyte string for emacs 22 but multibyte string for emacs 23 Yee Keat Phuah
     [not found]   ` <handler.2878.B.123877206328398.ack@emacsbugs.donarmstrong.com>
2009-04-03 16:01     ` bug#2878: Acknowledgement (bindat-pack returns unibyte string for emacs 22 but multibyte string for emacs 23) Yee Keat Phuah
2009-05-04  1:25   ` bug#2878: marked as done " Emacs bug Tracking System

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.