Bug 1249918 - Java liguestfs g.part_list gives java.lang.ArrayStoreException
Java liguestfs g.part_list gives java.lang.ArrayStoreException
Status: CLOSED DUPLICATE of bug 1073906
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
  Show dependency treegraph
Reported: 2015-08-04 03:06 EDT by keesboog
Modified: 2015-08-04 06:24 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-08-04 06:24:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description keesboog 2015-08-04 03:06:41 EDT
Description of problem:

When trying to list the partitions with g.part_list() an unexpected error is thrown from the undelying native method. Other (deprecated or less useful) functions to show the partitions do work.

Version-Release number of selected component (if applicable):
libquestfs-1.24.5 (as distributed via Ubuntu 14.04)

How reproducible:

Steps to Reproduce:
1. use the following code snippet:

            System.out.println("g.part_list does not work");
            try {
                Partition[] partitions = g.part_list("/dev/sda");
            } catch (Exception ex) {
            String sfdisk = g.sfdisk_l("/dev/sda");
            System.out.println("g.sfdisk_l works");
            System.out.println("g.sfdisk_l(\"/dev/sda\"): \n" + sfdisk);


            System.out.println("g.listpartitions also works");
            String[] partitions = g.list_partitions();

            System.out.println("partitions: ");
            for (String partition : partitions) {
                    System.out.println("partition: " + partition);

2. Compile

3. Execute

Actual results:
g.part_list does not work
        at com.redhat.et.libguestfs.GuestFS._part_list(Native Method)
        at com.redhat.et.libguestfs.GuestFS.part_list(GuestFS.java:11131)
        at ListPartitions.main(ListPartitions.java:37)

g.sfdisk_l works

Disk /dev/sda: 1019 cylinders, 162 heads, 62 sectors/track
Units = cylinders of 5142528 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+     49-     50-    248832   83  Linux
/dev/sda2         49+   1019-    970-   4868097    5  Extended
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
/dev/sda5         49+   1019-    970-   4868096   8e  Linux LVM

g.listpartitions also works

partition: /dev/sda1
partition: /dev/sda2
partition: /dev/sda5

Expected results:

Additional info:
Comment 1 Richard W.M. Jones 2015-08-04 03:21:27 EDT
Possible dupe of bug 1073906 (I did not check in detail yet).

If it's a dupe then it would be fixed in 1.24.7 and 1.26+.

Also my comment here is relevant:
Comment 2 Richard W.M. Jones 2015-08-04 06:24:05 EDT
I checked and this is not reproducible with libguestfs 1.31.1.

There was a problem with Java methods (such as g.part_list) which
used the RStructList method of returning lists of structures.  It
didn't affect the other calls you mention because they use a different
return method in the generator.

This is fixed in 1.24.7 and all recent versions of libguestfs.

*** This bug has been marked as a duplicate of bug 1073906 ***

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