GNU bug report logs -
#2878
bindat-pack returns unibyte string for emacs 22 but multibyte string for emacs 23
Previous Next
Reported by: Yee Keat Phuah <ykphuah <at> gmail.com>
Date: Fri, 3 Apr 2009 15:25:05 UTC
Severity: normal
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2878 in the body.
You can then email your comments to 2878 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2878
; Package
emacs
.
(Fri, 03 Apr 2009 15:25:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yee Keat Phuah <ykphuah <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Fri, 03 Apr 2009 15:25:06 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
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
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2878
; Package
emacs
.
(Fri, 03 Apr 2009 16:10:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yee Keat Phuah <ykphuah <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Fri, 03 Apr 2009 16:10:04 GMT)
Full text and
rfc822 format available.
Message #10 received at 2878 <at> emacsbugs.donarmstrong.com (full text, mbox):
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 <at> 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 <at> gnu.org>
>
> If you wish to submit further information on this problem, please
> send it to 2878 <at> emacsbugs.donarmstrong.com, as before.
>
> Please do not send mail to help-debbugs <at> gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
>
> --
> 2878: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2878
> Emacs Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
>
--
Cheers,
Phuah Yee Keat
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2878
; Package
emacs
.
(Sun, 03 May 2009 14:55:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Chong Yidong <cyd <at> stupidchicken.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Sun, 03 May 2009 14:55:06 GMT)
Full text and
rfc822 format available.
Message #15 received at 2878 <at> emacsbugs.donarmstrong.com (full text, mbox):
Miles, could I verify that this patch is correct, and should be checked
in?
> snogglethorpe from #emacs have suggested this patch and it worked for
> my elisp code
> --- 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)))
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#2878
; Package
emacs
.
(Sun, 03 May 2009 22:35:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Miles Bader <miles <at> gnu.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Sun, 03 May 2009 22:35:04 GMT)
Full text and
rfc822 format available.
Message #20 received at 2878 <at> emacsbugs.donarmstrong.com (full text, mbox):
2009/5/3 Chong Yidong <cyd <at> stupidchicken.com>:
> Miles, could I verify that this patch is correct, and should be checked
> in?
>
>> snogglethorpe from #emacs have suggested this patch and it worked for
>> my elisp code
>
>> --- a/lisp/emacs-lisp/bindat.el
>> +++ b/lisp/emacs-lisp/bindat.el
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).
-Miles
--
Do not taunt Happy Fun Ball.
Reply sent
to
Chong Yidong <cyd <at> stupidchicken.com>
:
You have taken responsibility.
(Mon, 04 May 2009 01:25:04 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yee Keat Phuah <ykphuah <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 04 May 2009 01:25:04 GMT)
Full text and
rfc822 format available.
Message #25 received at 2878-done <at> emacsbugs.donarmstrong.com (full text, mbox):
Miles Bader <miles <at> 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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Mon, 01 Jun 2009 14:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.