Package: libzfs1
Version: 9.0-3
Severity: normal
Tags: patch

"zpool status" incorrectly prints "raidz" vdevs as "-0" instead of
"raidz1-0", e.g.
    $ zpool status mpool 
      pool: mpool
     state: ONLINE
     scan: scrub repaired 0 in 0h52m with 0 errors on Sun Dec 16 12:43:40 2012
    config:

            NAME        STATE     READ WRITE CKSUM
            mpool       ONLINE       0     0     0
              -0        ONLINE       0     0     0
                ada0p3  ONLINE       0     0     0
                ada1p3  ONLINE       0     0     0
                ada2p3  ONLINE       0     0     0
should be
    $ LD_LIBRARY_PATH=debian/libzfs1/lib zpool status mpool 
      pool: mpool
     state: ONLINE
     scan: scrub repaired 0 in 0h52m with 0 errors on Sun Dec 16 12:43:40 2012
    config:

            NAME        STATE     READ WRITE CKSUM
            mpool       ONLINE       0     0     0
              raidz1-0  ONLINE       0     0     0
                ada0p3  ONLINE       0     0     0
                ada1p3  ONLINE       0     0     0
                ada2p3  ONLINE       0     0     0


I investigated the problem and it turns out to be bad use of snprintf (the
output buffer is the same as one of the positional arguments); Solaris and
possibly FreeBSD libc behave differently than glibc in this case. (FreeBSD 9.0
doesn't exhibit the problem)

I have a patch derived from the zfsonlinux project, where they have also
fixed the bug.  My patch is simply a combination of these two patches:

https://github.com/zfsonlinux/zfs/commit/858219cc4e44
https://github.com/zfsonlinux/zfs/commit/fc24f7c887a0

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.0-2-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libzfs1 depends on:
ii  libbsd0     0.4.2-1
ii  libc0.1     2.13-37
ii  libgeom1    9.0+ds1-3
ii  libnvpair1  9.0-3
ii  libumem1    9.0-3
ii  libuutil1   9.0-3

libzfs1 recommends no packages.

Libzfs1 suggests no packages.

-- no debconf information


Index: zfsutils-9.0/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
===================================================================
--- zfsutils-9.0.orig/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  
2012-12-16 12:15:18.000000000 -0600
+++ zfsutils-9.0/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c       
2012-12-16 13:11:34.171723989 -0600
@@ -3087,6 +3087,8 @@
        (void) ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_VDEV_SETPATH, &zc);
 }
 
+#define        PATH_BUF_LEN    64
+
 /*
  * Given a vdev, return the name to display in iostat.  If the vdev has a path,
  * we use that, stripping off any leading "/dev/dsk/"; if not, we use the type.
@@ -3108,7 +3110,8 @@
 {
        char *path, *devid;
        uint64_t value;
-       char buf[64];
+       char buf[PATH_BUF_LEN];
+       char tmpbuf[PATH_BUF_LEN];
        vdev_stat_t *vs;
        uint_t vsc;
        int have_stats;
@@ -3204,6 +3207,7 @@
                 * If it's a raidz device, we need to stick in the parity level.
                 */
                if (strcmp(path, VDEV_TYPE_RAIDZ) == 0) {
+
                        verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NPARITY,
                            &value) == 0);
                        (void) snprintf(buf, sizeof (buf), "%s%llu", path,
@@ -3220,9 +3224,9 @@
 
                        verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
                            &id) == 0);
-                       (void) snprintf(buf, sizeof (buf), "%s-%llu", path,
-                           (u_longlong_t)id);
-                       path = buf;
+                       (void) snprintf(tmpbuf, sizeof (tmpbuf), "%s-%llu",
+                           path, (u_longlong_t)id);
+                       path = tmpbuf;
                }
        }
 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to