Bug 507346 - ruby bindings: "TypeError: can't convert Fixnum into String" if you pass a string where a list is expected
Summary: ruby bindings: "TypeError: can't convert Fixnum into String" if you pass a st...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-22 12:58 UTC by Richard W.M. Jones
Modified: 2010-03-27 10:31 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-27 10:31:02 UTC


Attachments (Terms of Use)

Description Richard W.M. Jones 2009-06-22 12:58:46 UTC
Originally reported by Marek Goldmann.

irb(main):005:0> g.launch
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
=> nil
irb(main):006:0> g.wait_ready
=> nil
irb(main):007:0> g.list_partitions
=> ["/dev/sda1"]
irb(main):008:0> g.mount( "/dev/sda1", "/" )
=> nil
irb(main):009:0> g.ls("/")
=> [".gem", ".rnd", "bin", "boot", "dev", "etc", "home", "lib", "lib64", "lost+found", "media", "mnt", "opt", "proc", "root", "sbin", "selinux", "srv", "sys", "tmp", "usr", "var"]
irb(main):010:0> g.command("ls /")
TypeError: can't convert Fixnum into String
  from (irb):10:in `command'
  from (irb):10
  from :0
irb(main):011:0> g.command("'ls /'")
TypeError: can't convert Fixnum into String
  from (irb):11:in `command'
  from (irb):11
  from :0
irb(main):012:0>

Comment 1 Richard W.M. Jones 2009-06-22 13:29:01 UTC
The problem here is that the string being passed should
be a list, ie:

g.command(["ls /"])

However the error message is pretty obscure.  It should
either silently convert the string to a single element list,
or else give a proper error message.

Comment 2 Richard W.M. Jones 2009-06-22 13:29:48 UTC
Correction, that should be:

g.command( ["ls", "/"] )

Comment 3 Richard W.M. Jones 2009-06-22 14:09:07 UTC
This should be fixed[1] by the following cset:

http://git.et.redhat.com/?p=libguestfs.git;a=commitdiff;h=227b1eea90713d190a9cf5463af106af0b4eee2c

[1] ie. the error message, you still have to pass
an array, not a string.

Comment 4 Fedora Update System 2009-06-23 09:14:56 UTC
libguestfs-1.0.51-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/libguestfs-1.0.51-1.fc11

Comment 5 Fedora Update System 2009-06-29 19:27:37 UTC
libguestfs-1.0.54-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/libguestfs-1.0.54-2.fc11

Comment 6 Fedora Update System 2009-07-02 23:26:23 UTC
libguestfs-1.0.55-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/libguestfs-1.0.55-1.fc11

Comment 7 Fedora Update System 2009-07-11 09:27:21 UTC
libguestfs-1.0.58-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/libguestfs-1.0.58-2.fc11

Comment 8 Fedora Update System 2009-07-11 17:12:43 UTC
libguestfs-1.0.54-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2009-07-19 10:27:55 UTC
libguestfs-1.0.58-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Richard W.M. Jones 2010-03-27 10:31:02 UTC
Long fixed upstream:

irb(main):010:0> g.command("ls /")
TypeError: wrong argument type String (expected Array)


Note You need to log in before you can comment on or make changes to this bug.