Actions
Bug #2803
closedzfs get guid pretty-prints the output
Start date:
2012-05-30
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
ZFS tools treat the GUID for an object as a numeric and try pretty printing, which leads to garbage.
- zfs get guid src
NAME PROPERTY VALUE SOURCE
src guid 9.47E -
The GUID is really an identifier, and should not be treated this way.
Updated by Garrett D'Amore about 10 years ago
Here's the proposed trivial fix for it:
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c Tue May 29 13:58:04 2012 -0700 +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c Tue May 29 23:42:35 2012 -0700 @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. */ #include <ctype.h> @@ -2280,6 +2281,12 @@ } break; + case ZFS_PROP_GUID: + if (get_numeric_property(zhp, prop, src, &source, &val) != 0) + return (-1); + (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val); + break; + default: switch (zfs_prop_get_type(prop)) { case PROP_TYPE_NUMBER:
Here are tests from before and after:
before:
garrett@velocity{212}> zfs get guid rpoolNAME PROPERTY VALUE SOURCE rpool guid 11.2E -
after:
garrett@velocity{211}> env LD_PRELOAD=/ws/dey/build-dist/src/illumos-gate/usr/src/lib/libzfs/i386/libzfs.so.1 zfs get guid rpool NAME PROPERTY VALUE SOURCE rpool guid 12937182491779411210 -
Updated by Garrett D'Amore about 10 years ago
- Status changed from New to Resolved
- Tags deleted (
needs-triage)
Resolved in:
changeset: 13715:351036203e4b
tag: tip
user: Garrett D'Amore <garrett@damore.org>
date: Wed Jun 06 10:01:43 2012 -0700
description:
2803 zfs get guid pretty-prints the output
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Richard Elling <richard.elling@gmail.com>
Reviewed by: Alexander Eremin <alexander.eremin@nexenta.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
Actions