Closed waifung0207 closed 11 years ago
Hi, I've never seen this error before. That's strange because none of the 3 migration files are UTF-8 (they are only ASCII) so I don't really understand why you have an error about an invalid byte sequence in UTF-8...
Using google, I found a possible explaination:
Hope it helps...
Thanks for your reply and maybe I added more info for tracing the problem.
My server environment is:
From the stackoverflow page, they mentioned that some "data corruption" may cause the problem but I am not sure which data should it be. (db tables like "webdav_settings" DB table is not created after running the rake command)
Below are the output message after rake with --trace:
rake aborted! invalid byte sequence in UTF-8 /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:344:in
block (2 levels) in load_magic' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:343:in
each' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:343:inblock in load_magic' /usr/lib/ruby/1.9.1/open-uri.rb:35:in
open' /usr/lib/ruby/1.9.1/open-uri.rb:35:inopen' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:335:in
load_magic' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:375:inblock in <module:MIME>' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:370:in
each' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:370:in<module:MIME>' /var/lib/gems/1.9.1/gems/shared-mime-info-0.1/lib/shared-mime-info.rb:33:in
<top (required)>' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:inrequire' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in
block (2 levels) in require' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:ineach' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in
block in require' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:ineach' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in
require' /var/lib/gems/1.9.1/gems/bundler-1.2.1/lib/bundler.rb:128:inrequire' /usr/share/redmine/config/application.rb:7:in
<top (required)>' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
require' /usr/share/redmine/Rakefile:5:in<top (required)>' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in
load' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:inload_rakefile' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:501:in
raw_load_rakefile' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:inblock in load_rakefile' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:inload_rakefile' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in
block in run' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in<top (required)>' /usr/local/bin/rake:19:in
load' /usr/local/bin/rake:19:in `'
Excuse for my question and hope this can give you some clues on the issue.
Thanks again.
It seems that you are using ruby 1.9.1 and problem occurs with gem shared-mime-info. Here is a post about an incompatibility between these 2 elements: https://github.com/dcparker/ruby-gmail/issues/9
If you absolutely want to use ruby 1.9, I suggest you to remove all references to shared-mime-info in my plugin (Gemfile and lib/file_resource.rb) then replace line 348 in file resource_file.rb with: mimetype = "application/octet-stream"
This way, plugin should not use the shared-mime-info gem anymore... You will loose the content-type but it should work...
Kind regards, Arnaud
I have checked and my Ruby version is:
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
And after changing the files as you suggested (i.e. regarding shared-mime-info), I met other error messages from rake command...
rake aborted! /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:176: syntax error, unexpected tASSOC, expecting ')' ... mylock=Lock.create ( :uid=>newlock, :locktype=>locktype,... ... ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:176: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...te ( :uid=>newlock, :locktype=>locktype, :lockscope=>locksco... ... ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:176: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...ocktype=>locktype, :lockscope=>lockscope, :owner=>User.curre... ... ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:176: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' ...:lockscope=>lockscope, :owner=>User.current.login, ... ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:177: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' :resource => request.url, :timestamp=> Time.now ) ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:177: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' :resource => request.url, :timestamp=> Time.now ) ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:177: syntax error, unexpected ')', expecting keyword_end /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:218: syntax error, unexpected keyword_do_block, expecting keyword_end resources.flatten.each do |res| ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:222: syntax error, unexpected keyword_do_block, expecting keyword_end res.properties.each do |property, value| ^ /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:222: syntax error, unexpected '|', expecting '=' /usr/share/redmine/plugins/redmine_webdav/lib/acts_as_webdav.rb:493: syntax error, unexpected keyword_end, expecting $end
Tasks: TOP => redmine:plugins:migrate => environment
Then after I read this post on stackoverflow: http://stackoverflow.com/questions/8136875/ruby-1-9-2-syntax-error
I removed the space in between "Lock.create" and "(" in the file lib/acts_as_webdav.rb on line 176), i.e.:
mylock=Lock.create(:uid=>newlock, ...... , :timestamp=> Time.now)
Now the plugin seems able to work now!
Thanks so much :)
The problem depends gem shared-mime-info that tries to read the binary file / usr / share / mime / magic to solve this problem patching the file shared-mime-info-0.1/lib/shared-mime-info.rb line 335 open (file) with open (file, "r: binary")
;)
this version: https://github.com/hanklords/shared-mime-info.git work with binary file!!
change in plugins/redmine_webdav/Gemfile: gem "shared-mime-info", :git => "https://github.com/hanklords/shared-mime-info.git"
@vincenzodev : Thanks for the tip but I'm not sure that it will work with ruby 1.8 too (there is a commit with "drop 1.8 support" in the description). I have to test this version in my environment and, if it not works, I will update the documentation to include your solution for ruby 1.9
Hi,
I encountered the error message when install this plugin on my redmine:
Here is the command I was using:
Would like to know whether this is the code issue or I need to find another solution.
Thanks in advance.