File: 0007-Create-Explicit-Binary-Regexp.patch

package info (click to toggle)
ruby-rubymail 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,188 kB
  • ctags: 1,109
  • sloc: ruby: 6,061; makefile: 7
file content (32 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Author: Antonio Terceiro <terceiro@debian.org>
Description: Create explicit binary regexp
 Ruby 2.0 chokes on those regexes saying they are not valid syntax. This
 specific solution is based on the discussion at
 http://www.velocityreviews.com/forums/t856762-ruby-1-9-1-invalid-multibyte-escape-xc0-xdf-regexperror.html

diff --git a/lib/rmail/address.rb b/lib/rmail/address.rb
index 8227841..ae99d16 100644
--- a/lib/rmail/address.rb
+++ b/lib/rmail/address.rb
@@ -691,7 +691,7 @@ module RMail
 	    @sym = SYM_DOMAIN_LITERAL
 	    @lexeme = $1.gsub(/(^|[^\\])[\r\n\t ]+/, '\1').gsub(/\\(.)/, '\1')
 	    break
-          when /\A[\200-\377\w!$%&\'*+\/=?^_\`{\}|~#-]+/m
+          when Regexp.new('\A[\200-\377\w!$%&\'*+\/=?^_\`{\}|~#-]+', Regexp::MULTILINE, 'n')
             # This is just like SYM_ATOM, but includes all characters
             # with high bits.  This is so we can allow such tokens in
             # the display name portion of an address even though it
diff --git a/lib/rmail/header.rb b/lib/rmail/header.rb
index 9102f28..9d5c9b2 100644
--- a/lib/rmail/header.rb
+++ b/lib/rmail/header.rb
@@ -73,7 +73,7 @@ module RMail
 
     class Field                 # :nodoc:
       # fixme, document methadology for this (RFC2822)
-      EXTRACT_FIELD_NAME_RE = /\A([^\x00-\x1f\x7f-\xff :]+):\s*/o
+      EXTRACT_FIELD_NAME_RE = Regexp.new '\A([^\x00-\x1f\x7f-\xff :]+):\s*', nil, 'n'
 
       class << self
         def parse(field)