12
为什么这个RMagick调用会产生分段错误?
一个多小时的时间里,我一直在脑海中trying撞,试图弄清楚这里出了什么问题,而且我敢肯定(或者更希望是)我忽略了很明显的事情。我正在使用Ruby 1.9.1,Sinatra 1.0和RMagick 2.13.1。ImageMagick和RMagick已正确安装并正常运行-我已经成功地操作并保存了irb中的图像。 params数组的相关部分(为便于阅读而更改格式): {"admin_user_new_image_file"=> { :filename=>"freddie-on-shetland-pony.png", :type=>"image/png", :name=>"admin_user_new_image_file", :tempfile=>#<File:/var/folders/a7/a7pO5jMcGLCww9XBGRvWfE+++TI/-Tmp-/RackMultipart20100514-20700-o2tkqu-0>, :head=>"Content-Disposition: form-data; name=\"admin_user_new_image_file\"; filename=\"freddie-on-shetland-pony.png\"\r\nContent-Type: image/png\r\n" } } 相关代码: post "/admin/user/:account_name/image/new/" do if params[:admin_user_new_image_file][:tempfile] thumbnail = Magick::Image.read("png:"+params[:admin_user_new_image_file][:tempfile].path).first end end 错误(第229行是以“ thumbnail =”开头的行: config.ru:229: [BUG] Segmentation fault ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10.3.0] -- control frame ---------- c:0042 p:---- s:0196 b:0196 …