Bug 507346 - ruby bindings: "TypeError: can't convert Fixnum into String" if you pass a string where a list is expected
ruby bindings: "TypeError: can't convert Fixnum into String" if you pass a st...
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-22 08:58 EDT by Richard W.M. Jones
Modified: 2010-03-27 06:31 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-27 06:31:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2009-06-22 08:58:46 EDT
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 09:29:01 EDT
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 09:29:48 EDT
Correction, that should be:

g.command( ["ls", "/"] )
Comment 3 Richard W.M. Jones 2009-06-22 10:09:07 EDT
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 05:14:56 EDT
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 15:27:37 EDT
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 19:26:23 EDT
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 05:27:21 EDT
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 13:12:43 EDT
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 06:27:55 EDT
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 06:31:02 EDT
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.