https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292016-01-17T22:55:07ZRedmineRedmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=686652016-01-17T22:55:07ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li></ul>Could you add test?
<ul>
<li><a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/entry/tags/3.2.0/test/unit/mail_handler_test.rb#L563">source:tags/3.2.0/test/unit/mail_handler_test.rb#L563</a></li>
<li><a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/entry/tags/3.2.0/test/fixtures/mail_handler/gmail_with_attachment_iso-8859-1.eml">source:tags/3.2.0/test/fixtures/mail_handler/gmail_with_attachment_iso-8859-1.eml</a></li>
</ul> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=686822016-01-18T10:55:41ZPavel Rosický
<ul><li><strong>File</strong> <a href="/attachments/15001">mail_handler_test.rb.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/15001/mail_handler_test.rb.patch">mail_handler_test.rb.patch</a> added</li></ul><p>Done</p> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=686832016-01-18T10:56:59ZPavel Rosický
<ul><li><strong>File</strong> <a href="/attachments/15002">ticket_with_text_attachment_iso-8859-2.eml.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/15002/ticket_with_text_attachment_iso-8859-2.eml.patch">ticket_with_text_attachment_iso-8859-2.eml.patch</a> added</li></ul> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=691092016-02-08T08:40:50ZToshi MARUYAMA
<ul></ul><p>I cannot reproduce on trunk <a class="changeset" title="Send a notification when security settings are changed (#21421)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/15148">r15148</a> with ruby-1.9.3-p551.<br />Test passes <strong>without</strong> <a class="attachment" href="https://www.redmine.org/attachments/14995">mail_handler.rb.patch</a> .<br />You can see latin2 encoded file in files/ directory with following change.<br /><pre><code class="diff syntaxhl"><span class="gh">diff --git a/app/models/attachment.rb b/app/models/attachment.rb
</span><span class="gd">--- a/app/models/attachment.rb
</span><span class="gi">+++ b/app/models/attachment.rb
</span><span class="p">@@ -53,7 +53,7 @@</span> class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_create :files_to_final_location
<span class="gd">- after_rollback :delete_from_disk, :on => :create
</span><span class="gi">+ # after_rollback :delete_from_disk, :on => :create
</span> after_commit :delete_from_disk, :on => :destroy
# Returns an unsaved copy of the attachment
</code></pre></p>
<pre>
$ ruby test/unit/mail_handler_test.rb -n test_mail_with_attachment_latin2
Run options: -n test_mail_with_attachment_latin2 --seed 14783
# Running:
.
Finished in 2.025752s, 0.4936 runs/s, 3.4555 assertions/s.
1 runs, 7 assertions, 0 failures, 0 errors, 0 skips
$ cat files/2016/02/160208173558_yourfile.txt | iconv -f latin2 -t utf8
příliš žluoučký kůn
</pre> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=691222016-02-08T09:49:09ZPavel Rosický
<ul><li><strong>File</strong> <a href="/attachments/15380">encoded.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/15380/encoded.txt">encoded.txt</a> added</li><li><strong>File</strong> <a href="/attachments/15379">original.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/15379/original.txt">original.txt</a> added</li></ul><p>retested against revision <a class="changeset" title="Send a notification when security settings are changed (#21421)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/15148">r15148</a> without mail_handler.rb.patch</p>
<p>MailHandlerTest#test_mail_with_attachment_latin2 [C:/redmine svn/test/unit/mail_handler_test.rb:590]:<br />Expected: 19<br /> Actual: 12</p>
<p>About your application's environment<br />Rails version 4.2.5.1<br />Ruby version 2.1.5-p273 (x64-mingw32)<br />RubyGems version 2.2.3<br />Rack version 1.6.4<br />Middleware Rack::Sendfile, ActionDispatch::Static, Rack::Lock, #<<br />ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000000094378e0>, Rack::<br />Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, A<br />ctionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::<br />RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Con<br />nectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch:<br />:Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDis<br />patch::ParamsParser, ActionDispatch::XmlParamsParser, Rack::Head, Rack::Conditio<br />nalGet, Rack::ETag, Rack::ContentLength, RequestStore::Middleware, OpenIdAuthent<br />ication<br />Application root C:/redmine svn<br />Environment development<br />Database adapter mysql2<br />Database schema version 20151031095005</p>
<p>Environment:<br /> Redmine version 3.2.0.devel<br /> Ruby version 2.1.5-p273 (2014-11-13) [x64-mingw32]<br /> Rails version 4.2.5.1<br /> Environment production<br /> Database adapter Mysql2<br />SCM:<br /> Git 1.9.5<br /> Filesystem<br />Redmine plugins:<br /> no plugin installed</p>
<p>no other tests are failing (except IssueNestedSetConcurrencyTest which supposed to be a known problem on mysql) and with mail_handler.rb.patch applied this one passes as well.</p>
<p>IssueNestedSetConcurrencyTest#test_concurrency [C:/redmine svn/test/unit/issue_nested_set_concurrency_test.rb:45]:<br />Expected "Mysql2::Error: Deadlock found when trying to get lock; try restarting<br />transaction: SELECT `issues`.`id` FROM `issues` WHERE (root_id IN (SELECT root_i<br />d FROM issues WHERE id IN (800,794))) ORDER BY `issues`.`id` ASC FOR UPDATE" to<br /> be nil.</p>
<p>I attached both attachments, the original and the one saved to files (encoded.txt). Maybe it depends on the environment, I'll try to find out.</p> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=691322016-02-08T23:38:56ZPavel Rosický
<ul></ul><p><a class="user active" href="https://www.redmine.org/users/10651">toshio harita</a> MARUYAMA - could you retest it on a more recent Ruby version?</p>
<p>passed - ruby 1.9.3p551 (2014-11-13) [i386-mingw32]<br />failed - ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]<br />failed - ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]<br />failed - jruby 9.0.5.0-SNAPSHOT (2.2.3) 2016-01-20 775b79d Java HotSpot(TM) 64-Bit Server</p> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=695222016-03-04T06:46:46ZToshi MARUYAMA
<ul><li><strong>Target version</strong> set to <i>3.3.0</i></li></ul> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=695232016-03-04T06:47:34ZToshi MARUYAMA
<ul><li><strong>Tracker</strong> changed from <i>Patch</i> to <i>Defect</i></li><li><strong>Subject</strong> changed from <i>Received text attachments doesn't hold the original encoding</i> to <i>Received text attachments doesn't hold the original encoding on Ruby >= 2.1</i></li><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>New</i></li></ul> Redmine - Defect #21742: Received text attachments doesn't hold the original encoding on Ruby >= 2.1https://www.redmine.org/issues/21742?journal_id=695242016-03-04T07:43:35ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li></ul><p>Committed in trunk, thanks.<br />I have reported to upstream.<br /><a class="external" href="https://github.com/mikel/mail/issues/972">https://github.com/mikel/mail/issues/972</a></p>