Project

General

Profile

Actions

Bug #7175

closed

unpack('M*') changed behavior between patchlevels

Bug #7175: unpack('M*') changed behavior between patchlevels

Added by briantobin (Brian Tobin) about 13 years ago. Updated about 13 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
Backport:
[ruby-core:48034]

Description

I'm seeing an important difference in the output of string.unpack between two patchlevels of ruby 1.9.3. The output of patchlevel 194 is expected, and the output of 286 is unexpected.

--- Console 1 ---

RUBY_VERSION
=> "1.9.3"
RUBY_PATCHLEVEL
=> 194
"foo =3D =".unpack("M*")
=> ["foo = "]

--- Console 2 ---

RUBY_VERSION
=> "1.9.3"
RUBY_PATCHLEVEL
=> 286
"foo =3D =".unpack("M*")
=> ["foo = ="]

Was this a purposeful change? Our code is processing emails with the "quoted printable" encoding. After upgrading to patchlevel 286 we are getting trailing equals signs after decoding. I feel like this is a regression.

Thanks in advance!

Brian

Updated by briantobin (Brian Tobin) about 13 years ago Actions #1 [ruby-core:48036]

After reading the changelog I see that this changed b/c of bug #5635 (http://bugs.ruby-lang.org/issues/5635).

I still believe that this might be a regression. Looking at our data, the last lines of quoted-printable strings produced by Microsoft products generally have an "=" and no newline.

Reading RFC2045 (http://www.ietf.org/rfc/rfc2045.txt), page 21, item #2, I see that this is invalid. But in practice I'm seeing that it's common.

Updated by briantobin (Brian Tobin) about 13 years ago Actions #2 [ruby-core:48037]

Second update

I discovered that the Mail gem (https://github.com/mikel/mail) is incorrectly stripping the newline after the "=", which makes it illegal. I'll file a bug there.

Updated by drbrain (Eric Hodel) about 13 years ago Actions #4 [ruby-core:48039]

  • Status changed from Open to Third Party's Issue
Actions

Also available in: PDF Atom