Bug 1046509
Summary: | ruby-libguestfs throws "expecting 0 or 1 arguments" on Guestfs::Guestfs.new | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Dominic Cleal <dcleal> |
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | 20 | CC: | mbooth, ptoscano, rjones, virt-maint |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | libguestfs-1.24.5-1.fc20 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-01-13 03:00:12 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1072062, 1072079 |
Description
Dominic Cleal
2013-12-25 22:35:12 UTC
$ irb -rguestfs irb(main):001:0> Guestfs::Guestfs.new ArgumentError: expecting 0 or 1 arguments from (irb):1:in `new' from (irb):1 from /usr/bin/irb:12:in `<main>' irb(main):003:0> Guestfs::create() => #<Guestfs::Guestfs:0x0000000255b110> The documentation and examples all refer to using the new() method, but the tests all use create(). The examples worked when I wrote them, but aren't routinely tested so seem to have regressed since then. Since the tests use create(), they didn't pick up the regression. I'm not over familiar with ruby, so I'm not sure which syntax is correct, but there's clearly a bug here. I just found this commit: https://github.com/libguestfs/libguestfs/commit/25521f17d5b0841a13d66fc515fac0cffe23d9a1 which indicates that new() should work, and is better than using create(). commit 25521f17d5b0841a13d66fc515fac0cffe23d9a1 Author: Richard Jones <rjones> Date: Thu Sep 2 12:01:06 2010 +0100 ruby: Add Guestfs::Guestfs.new() method. This is a more standard way to create objects in Ruby. The old way was to call the module function Guestfs::create() which still works. diff --git a/src/generator.ml b/src/generator.ml index 97dc6ac..3f5fd6c 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -10835,6 +10835,10 @@ void Init__guestfs () c_guestfs = rb_define_class_under (m_guestfs, \"Guestfs\", rb_cObject); e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError); +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC + rb_define_alloc_func (c_guestfs, ruby_guestfs_create); +#endif + rb_define_module_function (m_guestfs, \"create\", ruby_guestfs_create, 0); rb_define_method (c_guestfs, \"close\", ruby_guestfs_close, 0); I've posted a rather large patch which should fix this mess. However it would be good if someone who knows Ruby a bit better could take a look. https://www.redhat.com/archives/libguestfs/2013-December/msg00095.html Well, works for me and no one cared enough to comment, so I have pushed this. Fixed in 1.25.19. Candidate for backporting to 1.24.4, hence setting bug to F20. The ::create module function will work if you want compatibility with F19 and forwards, use .new if you don't care about F19. https://github.com/libguestfs/libguestfs/commit/ee4ce2a0298d012bd8c500c35dc50e1f53e88c8b libguestfs-1.24.4-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/libguestfs-1.24.4-1.fc20 Package libguestfs-1.24.4-1.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing libguestfs-1.24.4-1.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-0216/libguestfs-1.24.4-1.fc20 then log in and leave karma (feedback). libguestfs-1.24.4-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report. libguestfs-1.24.5-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/libguestfs-1.24.5-1.fc20 libguestfs-1.24.5-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report. |