[#30589] [Bug #3391] Use single exclamation mark instead of double exclamation mark for IRB — Diego Viola <redmine@...>

Bug #3391: Use single exclamation mark instead of double exclamation mark for IRB

10 messages 2010/06/04

[#30672] [Bug #3411] Time.local 1916,5,1 #=> 1916-04-30 23:00:00 +0100 — Benoit Daloze <redmine@...>

Bug #3411: Time.local 1916,5,1 #=> 1916-04-30 23:00:00 +0100

12 messages 2010/06/08

[#30699] [Bug #3419] 1.9.2-preview3 possible bug with Rails 3 active_record sqlite_adapter — Joe Sak <redmine@...>

Bug #3419: 1.9.2-preview3 possible bug with Rails 3 active_record sqlite_adapter

9 messages 2010/06/09

[#30734] [Bug #3428] ri outputs ansi escape sequences even when stdout is not a tty — caleb clausen <redmine@...>

Bug #3428: ri outputs ansi escape sequences even when stdout is not a tty

11 messages 2010/06/11

[#30756] [Feature #3436] Spawn the timer thread lazily — Maximilian Gass <redmine@...>

Feature #3436: Spawn the timer thread lazily

15 messages 2010/06/13
[#32686] [Ruby 1.9-Feature#3436] Spawn the timer thread lazily — Mark Somerville <redmine@...> 2010/10/04

Issue #3436 has been updated by Mark Somerville.

[ruby-core:30923] [Feature #3491] Pack missing directives for signed types with specified byte-order

From: Erik M <redmine@...>
Date: 2010-06-27 16:04:06 UTC
List: ruby-core #30923
Feature #3491: Pack missing directives for signed types with specified byte-order
http://redmine.ruby-lang.org/issues/show/3491

Author: Erik M
Status: Open, Priority: Normal
Category: core

The Array#pack and String#unpack have some directives where the byte-order is specified ("little endian" or "network order"), for unsigned long and for unsigned short. But when it comes to signed long and signed short there is no way to specify byte order, you can only use the platform-dependent directives.

This issue was mentioned on a mailing list in 2006: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/186884
and from what I understood it is a bug inherited from the pack and unpack functions in Perl. The conversation ended by matz having talked to the Perl lead programmer about coordination so both languages solve this issue the same way. But then I don't know if anything happened.

___A possible solution___
http://perldoc.perl.org/perlpacktut.html#Byte-order-modifiers mentions Perl 5.9.2 supporting ">" and "<" to specify byte order for the directives that usually use the platform-dependent order. That seems like a solution! The documentation at http://search.cpan.org/~dapm/perl-5.10.1/pod/perlfunc.pod#pack may be easier to read.

___More about current status___
The docs for Ruby 1.9 still seem to miss this feature. Also the 'N' and 'V' directives operate on unsigned longs, which I think is not clear from the documentation. For all the platform-dependent formats cCsSiIlL it has pairs like "Unsigned long" and "Long" (which is then signed), but for the platform-indepedent suddenly "Long" means "Unsigned long" (applies to formats nNvV). I think that is confusing.

As explained in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/165961 it is possible to work around this issue by unpacking with the unsigned directive and then making a function that can convert from unsigned to signed. For Array#pack it seems the function doesn't care if you input signed values, the same directive works for unsigned and signed data when packing.

I'm not sure if this is a bug or a feature request, but to be polite it made it a feature. I tested on ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux].


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next