Mailinglist Archive: opensuse-buildservice (339 mails)

< Previous Next >
[opensuse-buildservice] cannot add empty files to a package
  • From: Marcus Hüwe <suse-tux@xxxxxx>
  • Date: Mon, 17 Mar 2008 00:26:08 +0100
  • Message-id: <20080316232607.GA3671@xxxxxxxxxxxxxxxxxxx>
Hi,

I'm just playing with the latest BS packages from trunk (r3552) and
it seems that the api rejects the upload of empty files (see attached
development.log):
marcus@linux:~/home:Admin/foo> touch bar
marcus@linux:~/home:Admin/foo> curl -u Admin:opensuse -X PUT -d "$(cat bar)"
http://127.0.42.2/source/home:Admin/foo/bar?rev=upload
<?xml version="1.0" encoding="UTF-8"?>
<status code="unknown">
<summary>XML validation failed</summary>
<details>illegal document type 'NilClass'</details>
</status>
marcus@linux:~/home:Admin/foo>

Is this a bug or feature?:)
In case it is a bug I attached a small patch which fixes/works around
this problem.


Marcus
add validation mapping: "source", :filelist => :directory
add validation mapping: "source", :index => :directory
add validation mapping: "source", :packagelist => :directory
add validation mapping: "source", :project_meta => :project
add validation mapping: "source", :package_meta => :package
add validation mapping: "source", :pattern_meta => :pattern


Processing SourceController#file (for 127.0.42.2 at 2008-03-17 00:10:37) [PUT]
Session ID: bfc3d3681eb91f668ac07ef8c708a951
Parameters: {"rev"=>"upload", "project"=>"home:Admin", "action"=>"file",
"package"=>"foo", "controller"=>"source", "file"=>"bar"}
checking schema map for controller 'source', action 'file'
schema_file:


Suse::ValidationError (illegal document type 'NilClass'):
/lib/opensuse/validator.rb:140:in `validate'
/lib/opensuse/validator.rb:50:in `validate_incoming_xml'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:469:in
`send!'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:469:in
`call'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:441:in
`run'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:716:in
`run_before_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:695:in
`call_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in
`perform_action'

/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache'

/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in
`cache'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
`perform_action'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`send'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`process_without_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
`process'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in
`process'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
`handle_request'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
`dispatch'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi'

/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:101:in
`process_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:149:in
`with_signal_handler'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:99:in
`process_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:77:in
`process_each_request'
/usr/lib/ruby/vendor_ruby/1.8/fcgi.rb:612:in `each_cgi'
/usr/lib/ruby/vendor_ruby/1.8/fcgi.rb:609:in `each'
/usr/lib/ruby/vendor_ruby/1.8/fcgi.rb:609:in `each_cgi'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:76:in
`process_each_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:50:in `process!'
/usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:24:in `process!'
/public/dispatch.fcgi:24

Rendering status
errorcode 'unknown' - XML validation failed
Rendering status (400)
Index: app/controllers/source_controller.rb
===================================================================
--- app/controllers/source_controller.rb (Revision 3552)
+++ app/controllers/source_controller.rb (Arbeitskopie)
@@ -478,7 +478,12 @@
Suse::Backend.put_source path, request.raw_post
package = Package.find( package_name, :project => project_name )
package.update_timestamp
- logger.info "wrote #{request.raw_post.size} bytes to #{path}"
+ case request.raw_post
+ when String
+ logger.info "wrote #{request.raw_post.size} bytes to #{path}"
+ when NilClass
+ logger.info "wrote #{request.raw_post.to_s.size} bytes to #{path}"
+ end
render_ok
else
render_error :status => 403, :errorcode => 'put_file_no_permission',
Index: lib/opensuse/validator.rb
===================================================================
--- lib/opensuse/validator.rb (Revision 3552)
+++ lib/opensuse/validator.rb (Arbeitskopie)
@@ -136,6 +136,7 @@
case document
when String
doc_str = document
+ when NilClass
else
raise ValidationError, "illegal document type '#{document.class.name}'"
end
< Previous Next >
Follow Ups