Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2018 05:59:49 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r328255 - vendor/illumos/dist/cmd/zfs
Message-ID:  <201801220559.w0M5xnbs062736@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Jan 22 05:59:48 2018
New Revision: 328255
URL: https://svnweb.freebsd.org/changeset/base/328255

Log:
  8972 zfs holds: In scripted mode, do not pad columns with spaces
  
  illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39
  
  https://www.illumos.org/issues/8972:
  'zfs holds -H' does not properly output content in scripted mode. It uses a
  tab instead of two spaces, but it still pads column widths with spaces when
  it should not.
  
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Approved by: Dan McDonald <danmcd@joyent.com>
  Author: Allan Jude <allanjude@freebsd.org>

Modified:
  vendor/illumos/dist/cmd/zfs/zfs_main.c

Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c
==============================================================================
--- vendor/illumos/dist/cmd/zfs/zfs_main.c	Mon Jan 22 05:57:14 2018	(r328254)
+++ vendor/illumos/dist/cmd/zfs/zfs_main.c	Mon Jan 22 05:59:48 2018	(r328255)
@@ -5569,8 +5569,6 @@ print_holds(boolean_t scripted, size_t nwidth, size_t 
 			uint64_t val = 0;
 			time_t time;
 			struct tm t;
-			char sep = scripted ? '\t' : ' ';
-			size_t sepnum = scripted ? 1 : 2;
 
 			(void) nvpair_value_uint64(nvp2, &val);
 			time = (time_t)val;
@@ -5578,8 +5576,13 @@ print_holds(boolean_t scripted, size_t nwidth, size_t 
 			(void) strftime(tsbuf, DATETIME_BUF_LEN,
 			    gettext(STRFTIME_FMT_STR), &t);
 
-			(void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname,
-			    sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf);
+			if (scripted) {
+				(void) printf("%s\t%s\t%s\n", zname,
+				    tagname, tsbuf);
+			} else {
+				(void) printf("%-*s  %-*s  %s\n", nwidth,
+				    zname, tagwidth, tagname, tsbuf);
+			}
 		}
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801220559.w0M5xnbs062736>